Merge branch 'pu/2013.03/modelconfig-hr'
[tine20] / tine20 / Tinebase / Record / Abstract.php
index 1f9101a..217d07e 100644 (file)
@@ -697,6 +697,8 @@ abstract class Tinebase_Record_Abstract implements Tinebase_Record_Interface
                 $_toConvert[$field] = $value->format($_format);
             } elseif (is_array($value)) {
                 $this->_convertDateTimeToString($value, $_format);
+            } elseif (! $value && in_array($field, $this->_datetimeFields)) {
+                $_toConvert[$field] = NULL;
             }
         }
     }
@@ -961,6 +963,13 @@ abstract class Tinebase_Record_Abstract implements Tinebase_Record_Interface
                     $diff[$fieldName] = $subdiff;
                 }
                 continue;
+            } else if ($recordField instanceof Tinebase_Record_Abstract && is_scalar($ownField)) {
+                // maybe we have the id of the record -> just compare the id
+                if ($recordField->getId() == $ownField) {
+                    continue;
+                } else {
+                    $recordField = $recordField->getId();
+                }
             } else if ($ownField == $recordField) {
                 continue;
             } else if (empty($ownField) && empty($recordField)) {