diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index cd3f86d23fd..d856da56456 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -253,17 +253,6 @@ class DolibarrApi unset($object->stats_mrptoconsume); unset($object->stats_mrptoproduce); - unset($object->origin_object); - unset($object->origin); - unset($object->element); - unset($object->element_for_permission); - unset($object->fk_element); - unset($object->table_element); - unset($object->table_element_line); - unset($object->class_element_line); - unset($object->picto); - unset($object->linked_objects); - unset($object->fieldsforcombobox); unset($object->regeximgext); @@ -290,10 +279,21 @@ class DolibarrApi unset($object->prefix_comm); - if (!isset($object->table_element) || $object->table_element != 'ticket') { + if (!isset($object->table_element) || ! in_array($object->table_element, array('expensereport_det', 'ticket'))) { unset($object->comments); } + unset($object->origin_object); + unset($object->origin); + unset($object->element); + unset($object->element_for_permission); + unset($object->fk_element); + unset($object->table_element); + unset($object->table_element_line); + unset($object->class_element_line); + unset($object->picto); + unset($object->linked_objects); + // Remove the $oldcopy property because it is not supported by the JSON // encoder. The following error is generated when trying to serialize // it: "Error encoding/decoding JSON: Type is not supported"