Quick fix for humanResources Demodata
authorsstamer <s.stamer@metaways.de>
Fri, 23 Jan 2015 10:16:59 +0000 (11:16 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 23 Jan 2015 17:33:45 +0000 (18:33 +0100)
- there is the case where we have more users then Costcenters or
devisions

Change-Id: I52b385c30c40a20fbe81dc1e6c40c328fd673ed3
Reviewed-on: http://gerrit.tine20.com/customers/1559
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/HumanResources/Setup/DemoData.php

index 365c6f2..c7c7541 100644 (file)
@@ -194,8 +194,6 @@ class HumanResources_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
         // get pwulf as supervisor
         $pwulf = $employees->filter('n_family', 'Wulf')->getFirstRecord();
         
-        $i = 0;
-        
         $sdate = new Tinebase_DateTime();
         $sdate->subMonth(6);
         
@@ -222,7 +220,7 @@ class HumanResources_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
             }
             
             // add costcenter
-            $scs = $this->_costCenters->getByIndex($i);
+            $scs = $this->_costCenters->getByIndex(0);
             
             $hrc = array('cost_center_id' => $scs->getId(), 'start_date' => $this->_startDate);
             $employee->costcenters = array($hrc);
@@ -232,12 +230,11 @@ class HumanResources_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
             $employee->contracts = array($contract->toArray());
             
             // add division
-            $division = $this->_divisions->getByIndex($i);
+            $division = $this->_divisions->getByIndex(0);
             $employee->division_id = $division->getId();
             
             // update and increment counter
             $controller->update($employee);
-            $i++;
         }
         HumanResources_Controller_Account::getInstance()->createMissingAccounts();
     }