0009642: remove cleared_time from timesheets
authorAlexander Stintzing <a.stintzing@metaways.de>
Mon, 10 Feb 2014 09:36:42 +0000 (10:36 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 10 Feb 2014 15:15:19 +0000 (16:15 +0100)
remove cleared_time from timesheets

- check first if it is used somewhere
- if not: remove it completely

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

Change-Id: Iffe83422ad2768a35db28b3ea2092ee0b45e9128
Reviewed-on: https://gerrit.tine20.org/tine20/2788
Tested-by: jenkins user
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Timetracker/ControllerTest.php
tine20/Timetracker/Controller/Timesheet.php
tine20/Timetracker/Model/Timesheet.php
tine20/Timetracker/Setup/DemoData.php
tine20/Timetracker/Setup/Update/Release8.php [new file with mode: 0644]
tine20/Timetracker/Setup/setup.xml

index 0d9e6f3..5fbc866 100644 (file)
@@ -493,7 +493,7 @@ class Timetracker_ControllerTest extends PHPUnit_Framework_TestCase
         $i=0;
         
         $now = Tinebase_DateTime::now();
-        $data = array('account_id' => Tinebase_Core::getUser()->getId(), 'cleared_time' => $now,  'is_cleared' => true, 'timeaccount_id' => $this->_objects['timeaccount']->getId(), 'description' => 'test', 'duration' => 1, 'title' => 'test');
+        $data = array('account_id' => Tinebase_Core::getUser()->getId(), 'is_cleared' => true, 'timeaccount_id' => $this->_objects['timeaccount']->getId(), 'description' => 'test', 'duration' => 1, 'title' => 'test');
         
         while ($i<10) {
             $data['start_date'] = $now->addHour(1);
index b6c6213..b6c3a8b 100644 (file)
@@ -105,8 +105,8 @@ class Timetracker_Controller_Timesheet extends Tinebase_Controller_Record_Abstra
     {
         $filter = new Timetracker_Model_TimesheetFilter(array());
         $filter->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'timeaccount_id', 'operator' => 'equals', 'value' => $timeaccountId)));
-        $filter->addFilter(new Tinebase_Model_Filter_Date(array('field' => 'cleared_time', 'operator' => 'before', 'value' => $endDate)));
-        $filter->addFilter(new Tinebase_Model_Filter_Date(array('field' => 'cleared_time', 'operator' => 'after', 'value' => $startDate)));
+        $filter->addFilter(new Tinebase_Model_Filter_Date(array('field' => 'start_date', 'operator' => 'before', 'value' => $endDate)));
+        $filter->addFilter(new Tinebase_Model_Filter_Date(array('field' => 'start_date', 'operator' => 'after', 'value' => $startDate)));
         $filter->addFilter(new Tinebase_Model_Filter_Bool(array('field' => 'is_cleared', 'operator' => 'equals', 'value' => true)));
         
         $timesheets = $this->search($filter);
index be3ab6c..26abb54 100644 (file)
@@ -52,7 +52,6 @@ class Timetracker_Model_Timesheet extends Tinebase_Record_Abstract
         'billed_in'             => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         'is_cleared'            => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => 0),
         'is_cleared_combined'   => array(Zend_Filter_Input::ALLOW_EMPTY => true),
-        'cleared_time'          => array(Zend_Filter_Input::ALLOW_EMPTY => true),
     // custom fields array
         'customfields'          => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => array()),    
     // modlog information
@@ -78,8 +77,6 @@ class Timetracker_Model_Timesheet extends Tinebase_Record_Abstract
      * @var array list of datetime fields
      */    
     protected $_datetimeFields = array(
-        'cleared_time',
-    // modlog
         'creation_time',
         'last_modified_time',
         'deleted_time',
index cfbcab3..d783c64 100644 (file)
@@ -349,7 +349,6 @@ class Timetracker_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
                     'duration'       => 480,
                     'description'    => static::$_de ? 'DemoData eigenes Zeitkonto' : 'DemoData own timeaccount',
                     'is_cleared'     => (($ta->status == 'billed') ? true : false),
-                    'cleared_time'   => (($ta->status == 'billed') ? $startDate : NULL)
                  ));
             } else {
                 
@@ -364,7 +363,6 @@ class Timetracker_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
                     'duration'       => 240,
                     'description'    => static::$_de ? ('DemoData auf KST ' . $cc->number) : ('DemoData on costcenter ' . $cc->number),
                     'is_cleared'     => (($ta->status == 'billed') ? true : false),
-                    'cleared_time'   => (($ta->status == 'billed') ? $startDate : NULL)
                 ));
                 
                 $sd = clone $startDate;
@@ -380,7 +378,6 @@ class Timetracker_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
                     'duration'       => 240,
                     'description'    => static::$_de ? ('DemoData auf KST ' . $cc->number) : ('DemoData on costcenter ' . $cc->number),
                     'is_cleared'     => (($ta->status == 'billed') ? true : false),
-                    'cleared_time'   => (($ta->status == 'billed') ? $startDate : NULL)
                 ));
             }
         
diff --git a/tine20/Timetracker/Setup/Update/Release8.php b/tine20/Timetracker/Setup/Update/Release8.php
new file mode 100644 (file)
index 0000000..b9ba6fd
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     Timetracker
+ * @subpackage  Setup
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL3
+ * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ */
+class Timetracker_Setup_Update_Release8 extends Setup_Update_Abstract
+{
+    /**
+     * update to 8.1
+     */
+    public function update_0()
+    {
+        $this->_backend->dropCol('timetracker_timesheet', 'cleared_time');
+        $this->setTableVersion('timetracker_timesheet', 4);
+        $this->setApplicationVersion('Timetracker', '8.1');
+    }
+}
index 85f63a7..b8e3e60 100644 (file)
@@ -2,7 +2,7 @@
 <application>
     <name>Timetracker</name>
     <!-- gettext('Timetracker') -->   
-    <version>8.0</version>
+    <version>8.1</version>
     <order>60</order>
     <status>enabled</status>
     <depends>
         </table>
         <table>
             <name>timetracker_timesheet</name>
-            <version>3</version>
+            <version>4</version>
             <declaration>
                 <field>
                     <name>id</name>
                     <default>false</default>
                 </field>
                 <field>
-                    <name>cleared_time</name>
-                    <type>datetime</type>
-                </field>
-                <field>
                     <name>start_date</name>
                     <type>date</type>
                 </field>