only allow non-scalars for updates in Lead notification
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 17 Mar 2016 10:08:05 +0000 (11:08 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 17 Mar 2016 10:30:20 +0000 (11:30 +0100)
see 0011694: show tags and history / latest changes in lead notification mail

Change-Id: I25c85d18422aac37d9e68ce3d3c57d117f063d17
Reviewed-on: http://gerrit.tine20.com/customers/2926
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Crm/Controller/Lead.php

index 1eebbe0..c288ea2 100644 (file)
@@ -301,6 +301,7 @@ class Crm_Controller_Lead extends Tinebase_Controller_Record_Abstract
      *
      * TODO generalize
      * TODO translate field names (modelconfig?)
+     * TODO allow non scalar values
      */
     protected function _getNotificationUpdates($lead, $oldLead)
     {
@@ -312,11 +313,14 @@ class Crm_Controller_Lead extends Tinebase_Controller_Record_Abstract
         foreach ($lead->diff($oldLead, array('seq', 'notes', 'tags', 'relations', 'last_modified_time', 'last_modified_by'))->diff
              as $key => $value)
         {
-            $result[] = array(
-                'modified_attribute' => $key,
-                'old_value' => $value,
-                'new_value' => $lead->{$key}
-            );
+            // only allow scalars atm
+            if (! is_array($value) && ! is_array($lead->{$key})) {
+                $result[] = array(
+                    'modified_attribute' => $key,
+                    'old_value' => $value,
+                    'new_value' => $lead->{$key}
+                );
+            }
         }
 
         return $result;