Skip to content

Commit

Permalink
Merge branch '2023.11' into 2024.11
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed Feb 18, 2025
2 parents 72884fc + d7b6baa commit 78cc7a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
29 changes: 23 additions & 6 deletions tine20/Sales/Setup/DemoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -559,6 +563,10 @@ protected function _createSharedInvoices()
*/
protected function _createSharedContracts()
{
if (!Tinebase_Application::getInstance()->isInstalled('Timetracker')) {
return;
}

$cNumber = 1;

$container = $this->_contractController->getSharedContractsContainer();
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion tine20/Tinebase/Setup/DemoData/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 78cc7a9

Please sign in to comment.