Major update of unit tests / updated routers + models + react

This commit is contained in:
Jonathan Labreuille
2016-02-04 19:04:52 +01:00
parent 233020ca20
commit 55f851208b
25 changed files with 523 additions and 441 deletions

View File

@@ -33,30 +33,19 @@ class CustomFields {
function save($data = array()) {
$custom_field = CustomField::createOrUpdate($data);
$errors = $custom_field->getErrors();
if($custom_field === false) {
$result = array(
if(!empty($errors)) {
return array(
'result' => false,
'errors' => array(
__('The custom field could not be created.')
)
'errors' => $errors
);
} else {
$errors = $custom_field->getValidationErrors();
if(!empty($errors)) {
$result = array(
'result' => false,
'errors' => $errors
);
} else {
$result = array(
'result' => true,
'field' => $custom_field->asArray()
);
}
return array(
'result' => true,
'field' => $custom_field->asArray()
);
}
return $result;
}
function get($id) {