0011858: renamed fields might break concurrent update
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 12 May 2016 16:07:13 +0000 (18:07 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 13 May 2016 13:59:11 +0000 (15:59 +0200)
* checks if property exists in record with has()
* renames a remaining "price" property to salesprice
 in lead pdf export

https://forge.tine20.org/view.php?id=11858

Change-Id: I27d0aa661a5837498468a28f59c12bc871959a49
Reviewed-on: http://gerrit.tine20.com/customers/3154
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Crm/Export/Pdf.php
tine20/Tinebase/Timemachine/ModificationLog.php

index cfdfe62..8b9a61c 100644 (file)
@@ -278,7 +278,7 @@ class Crm_Export_Pdf extends Tinebase_Export_Pdf
                         $product = $relation->related_record;
                         
                         $quantity = (isset($relation['remark']['quantity'])) ? $relation['remark']['quantity'] : 1;
-                        $price = (isset($relation['remark']['price'])) ? $relation['remark']['price'] : $product->price;
+                        $price = (isset($relation['remark']['price'])) ? $relation['remark']['price'] : $product->salesprice;
                         // @todo set precision for the price ?
                         $price = Zend_Locale_Format::toNumber($price, array('locale' => $_locale)/*, array('precision' => 2)*/) . " €";
                         $description = (isset($relation['remark']['description'])) ? $relation['remark']['description'] : $product->description;
index 978b00d..c279572 100644 (file)
@@ -487,8 +487,13 @@ class Tinebase_Timemachine_ModificationLog
     protected function _resolveScalarMergeUpdate(Tinebase_Record_Interface $newRecord, Tinebase_Model_ModificationLog $diff)
     {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-            . " Merge current value into update data, as it was not changed in update request.");
-        $newRecord[$diff->modified_attribute] = $diff->new_value;
+            . ' Merge current value into update data, as it was not changed in update request.');
+        if ($newRecord->has($diff->modified_attribute)) {
+            $newRecord[$diff->modified_attribute] = $diff->new_value;
+        } else {
+            if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                . ' It seems that the attribute ' . $diff->modified_attribute . ' no longer exists in this record. Skipping ...');
+        }
     }
 
     /**