diff --git a/tine20/Sales/Setup/DemoData.php b/tine20/Sales/Setup/DemoData.php index e88192db765..951cd9b89d7 100644 --- a/tine20/Sales/Setup/DemoData.php +++ b/tine20/Sales/Setup/DemoData.php @@ -546,6 +546,10 @@ protected function _createSharedInvoices() $now->setDate($now->format('Y'), $now->format('m'), 1); $now->setTime(3,0,0); + if (! $this->_referenceDate) { + $this->_setReferenceDate(); + } + $date = clone $this->_referenceDate; while ($date < $now) { @@ -559,6 +563,10 @@ protected function _createSharedInvoices() */ protected function _createSharedContracts() { + if (!Tinebase_Application::getInstance()->isInstalled('Timetracker')) { + return; + } + $cNumber = 1; $container = $this->_contractController->getSharedContractsContainer(); @@ -756,6 +764,10 @@ protected function _createSharedOffers() foreach ($customers as $customer) { $oc = $orderconfirmations->getByIndex($i); + if (!$oc) { + // order confirmation not found + continue; + } $i++; $relations = array(array( 'own_model' => 'Sales_Model_Offer', @@ -832,12 +844,17 @@ protected function _onCreate() : array('Management', 'IT', 'Marketing', 'Public Relations', 'Production', 'Administration') ; - foreach ($divisionsArray as $divisionName) { - try { - HumanResources_Controller_Division::getInstance()->create(new HumanResources_Model_Division(array('title' => $divisionName))); - } catch (Zend_Db_Statement_Exception $e) { - } catch (Tinebase_Exception_Duplicate $e) { - } catch (Tinebase_Exception_SystemGeneric $e) {} + if (Tinebase_Application::getInstance()->isInstalled('HumanResources')) { + foreach ($divisionsArray as $divisionName) { + try { + HumanResources_Controller_Division::getInstance()->create(new HumanResources_Model_Division( + ['title' => $divisionName] + )); + } catch (Zend_Db_Statement_Exception $e) { + } catch (Tinebase_Exception_Duplicate $e) { + } catch (Tinebase_Exception_SystemGeneric $e) { + } + } } $this->_loadCostCentersAndDivisions(); diff --git a/tine20/Tinebase/Setup/DemoData/Abstract.php b/tine20/Tinebase/Setup/DemoData/Abstract.php index a8d0116658c..d46d41f3bba 100644 --- a/tine20/Tinebase/Setup/DemoData/Abstract.php +++ b/tine20/Tinebase/Setup/DemoData/Abstract.php @@ -445,7 +445,9 @@ protected function _loadCostCentersAndDivisions() $this->_costCenterKeys[] = $cc->getId(); } - $this->_divisions = HumanResources_Controller_Division::getInstance()->search(); + if (Tinebase_Application::getInstance()->isInstalled('HumanResources')) { + $this->_divisions = HumanResources_Controller_Division::getInstance()->search(); + } return $this->_costCenters; }