Skip to content

Commit

Permalink
Merge branch '2024.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed Nov 12, 2024
2 parents 8bead65 + 0362e07 commit ad9c91e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/tine20/HumanResources/ModelConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Tinebase
* @license http://www.gnu.org/licenses/agpl.html
* @copyright Copyright (c) 2013 - 2018 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2013 - 2024 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2014 Serpro (http://www.serpro.gov.br)
* @author Flávio Gomes da Silva Lisboa <[email protected]>
*/
Expand All @@ -15,9 +15,9 @@
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php';

/**
* Test class for Tinebase_ModelConfiguration, using the test class from hr
* Test class for HumanResources_ModelConfigurationTest
*/
class HumanResources_ModelConfigurationTest extends \PHPUnit\Framework\TestCase
class HumanResources_ModelConfigurationTest extends TestCase
{
/**
* tests if the modelconfiguration gets created using the static call
Expand Down
16 changes: 14 additions & 2 deletions tests/tine20/Tinebase/ModelConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
*
* @package Tinebase
* @license http://www.gnu.org/licenses/agpl.html
* @copyright Copyright (c) 2013-2021 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2013-2024 Metaways Infosystems GmbH (http://www.metaways.de)
* @author Alexander Stintzing <[email protected]>
*/
class Tinebase_ModelConfigurationTest extends TestCase
{
protected function tearDown(): void
{
{
Tinebase_Application::getInstance()->setApplicationStatus('Sales', Tinebase_Application::ENABLED);

parent::tearDown();

// reset mc config to prevent problems with following tests
Expand Down Expand Up @@ -140,4 +142,14 @@ public function testConfigViaDefault()
self::assertTrue(isset($fields['sales_tax']['default']), print_r($fields['sales_tax'], true));
self::assertEquals(19.0, $fields['sales_tax']['default'], print_r($fields['sales_tax'], true));
}

public function testModelExpanderWithoutRecordApp()
{
// disable Sales
Tinebase_Application::getInstance()->setApplicationStatus('Sales', Tinebase_Application::DISABLED);
$inventoryMC = Inventory_Model_InventoryItem::getConfiguration();
if ($inventoryMC->jsonExpander) {
self::assertArrayNotHasKey('invoice', $inventoryMC->jsonExpander['properties'], print_r($inventoryMC->jsonExpander, true));
}
}
}
5 changes: 4 additions & 1 deletion tine20/Tinebase/ModelConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ class_exists($this->_appName . '_Model_' . $this->_modelName . 'Grants')) {
self::VALIDATORS => [Zend_Filter_Input::ALLOW_EMPTY => true],*/
];
}
// you can null everything below here to prevent it from being writte to
// you can null everything below here to prevent it from being written to
if (!array_key_exists(self::JSON_EXPANDER, $modelClassConfiguration) && !is_array($this->_jsonExpander)) {
$this->_jsonExpander = [];
}
Expand Down Expand Up @@ -1401,6 +1401,9 @@ class_exists($this->_appName . '_Model_' . $this->_modelName . 'Grants')) {
$fieldDef[self::TYPE] = 'string';
$fieldDef['label'] = NULL;
unset($this->_filterModel[$fieldKey]);
if (isset($this->_jsonExpander['properties'][$fieldKey])) {
unset($this->_jsonExpander['properties'][$fieldKey]);
}
continue;
}
// the property name
Expand Down

0 comments on commit ad9c91e

Please sign in to comment.