0009666: setting contract end_date fails
authorAlexander Stintzing <a.stintzing@metaways.de>
Tue, 11 Feb 2014 12:27:50 +0000 (13:27 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 11 Feb 2014 20:26:33 +0000 (21:26 +0100)
When setting the end-date of a contract having vacation
days assigned already, the following message occurs:
You are not allowed to change the record if a vacation
has been booked already!

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

Change-Id: I6c29460f2bf6685dc94cdf247152ab1b5b65eeda
Reviewed-on: https://gerrit.tine20.org/tine20/2792
Tested-by: jenkins user
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/HumanResources/JsonTests.php
tine20/HumanResources/Controller/Contract.php

index fa8e75d..2a47847 100644 (file)
@@ -154,6 +154,20 @@ class HumanResources_JsonTests extends HumanResources_TestCase
         
         $this->assertEquals(18, count($employee['vacation'][0]));
         $this->assertEquals(3, count($employee['costcenters']));
+        
+        // 0009666: setting contract end_date fails
+        // https://forge.tine20.org/mantisbt/view.php?id=9666
+        
+        $date = new Tinebase_DateTime($employee['contracts'][1]['end_date']);
+        $date->addYear(1);
+        
+        $employee['contracts'][1]['end_date'] = $date;
+        
+        $employee = $this->_json->saveEmployee($employee);
+        
+        $employee['contracts'][1]['end_date'] = $date->addMonth(1);
+        
+        $employee = $this->_json->saveEmployee($employee);
     }
     
     /**
index 74c6156..7991c5d 100644 (file)
@@ -76,7 +76,9 @@ class HumanResources_Controller_Contract extends Tinebase_Controller_Record_Abst
             $_record->feast_calendar_id = $_record->feast_calendar_id['id'];
         }
         
-        $diff = $_record->diff($_oldRecord, array('created_by', 'creation_time', 'last_modified_by', 'last_modified_time', 'notes', 'end_date'))->diff;
+        $diff = $_record->diff($_oldRecord, array(
+            'created_by', 'creation_time', 'last_modified_by', 'last_modified_time', 'notes', 'end_date', 'seq', 'tags'
+        ))->diff;
 
         if (! empty($diff)) {
             if ($this->getFreeTimes($_record)->filter('type', 'vacation')->count() > 0) {