-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/fb/sales/divisions' into 2024.11
- Loading branch information
Showing
137 changed files
with
4,077 additions
and
1,470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
* @author Michael Spahn <[email protected]> | ||
*/ | ||
|
||
use Tinebase_Model_Filter_Abstract as TMFA; | ||
|
||
/** | ||
* Test class for Inventory_JsonTest | ||
*/ | ||
|
@@ -199,19 +201,26 @@ public function testSearchByCustomfield() | |
*/ | ||
public function testCostCenterFilter() | ||
{ | ||
$cc = Tinebase_Controller_CostCenter::getInstance()->create(new Tinebase_Model_CostCenter( | ||
array('name' => 'test123qwe', 'number' => 123) | ||
)); | ||
$dimension = Tinebase_Controller_EvaluationDimension::getInstance()->search(Tinebase_Model_Filter_FilterGroup::getFilterForModel(Tinebase_Model_EvaluationDimension::class, [ | ||
[TMFA::FIELD => Tinebase_Model_EvaluationDimension::FLD_NAME, TMFA::OPERATOR => TMFA::OP_EQUALS, TMFA::VALUE => Tinebase_Model_EvaluationDimension::COST_CENTER], | ||
]))->getFirstRecord(); | ||
$dimension->{Tinebase_Model_EvaluationDimension::FLD_ITEMS} = new Tinebase_Record_RecordSet(Tinebase_Model_EvaluationDimensionItem::class, | ||
[new Tinebase_Model_EvaluationDimensionItem([ | ||
Tinebase_Model_EvaluationDimensionItem::FLD_NAME => 'test123qwe', | ||
Tinebase_Model_EvaluationDimensionItem::FLD_NUMBER => 123, | ||
], true)]); | ||
$dimension = Tinebase_Controller_EvaluationDimension::getInstance()->update($dimension); | ||
$ccId = $dimension->{Tinebase_Model_EvaluationDimension::FLD_ITEMS}->getFirstRecord()->getId(); | ||
|
||
$inventoryItem = $this->_getInventoryItem(); | ||
$inventoryItem->costcenter = $cc->getId(); | ||
$inventoryItem->eval_dim_cost_center = $ccId; | ||
|
||
$this->_json->saveInventoryItem($inventoryItem->toArray()); | ||
|
||
$inventoryItem = $this->_getInventoryItem(); | ||
$this->_json->saveInventoryItem($inventoryItem->toArray()); | ||
|
||
$filter = Zend_Json::decode('[{"condition":"OR","filters":[{"condition":"AND","filters":[{"field":"costcenter","operator":"AND","value":[{"field":":id","operator":"equals","value":"'.$cc->getId().'"}],"id":"ext-record-2"}],"id":"ext-comp-1135","label":"test"}]}]'); | ||
$filter = Zend_Json::decode('[{"condition":"OR","filters":[{"condition":"AND","filters":[{"field":"eval_dim_cost_center","operator":"AND","value":[{"field":":id","operator":"equals","value":"'.$ccId.'"}],"id":"ext-record-2"}],"id":"ext-comp-1135","label":"test"}]}]'); | ||
|
||
$result = $this->_json->searchInventoryItems($filter, array()); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* | ||
* @package Sales | ||
* @license http://www.gnu.org/licenses/agpl.html | ||
* @copyright Copyright (c) 2021-2022 Metaways Infosystems GmbH (http://www.metaways.de) | ||
* @copyright Copyright (c) 2021-2024 Metaways Infosystems GmbH (http://www.metaways.de) | ||
* @author Paul Mehrer <[email protected]> | ||
*/ | ||
|
||
|
@@ -22,7 +22,7 @@ public function testInvoiceStorno() | |
$invoice = Sales_Controller_Document_Invoice::getInstance()->create(new Sales_Model_Document_Invoice([ | ||
Sales_Model_Document_Invoice::FLD_CUSTOMER_ID => $customer, | ||
Sales_Model_Document_Invoice::FLD_INVOICE_STATUS => Sales_Model_Document_Invoice::STATUS_PROFORMA, | ||
Sales_Model_Document_Invoice::FLD_RECIPIENT_ID => $customer->postal, | ||
Sales_Model_Document_Invoice::FLD_RECIPIENT_ID => $customer->{Sales_Model_Customer::FLD_DEBITORS}->getFirstRecord()->{Sales_Model_Debitor::FLD_BILLING}->getFirstRecord(), | ||
Sales_Model_Document_Invoice::FLD_POSITIONS => [ | ||
new Sales_Model_DocumentPosition_Invoice([ | ||
Sales_Model_DocumentPosition_Invoice::FLD_TITLE => 'pos 1', | ||
|
@@ -40,6 +40,7 @@ public function testInvoiceStorno() | |
])); | ||
|
||
Tinebase_Record_Expander::expandRecord($invoice); | ||
|
||
$invoice->{Sales_Model_Document_Invoice::FLD_INVOICE_STATUS} = Sales_Model_Document_Invoice::STATUS_BOOKED; | ||
$invoice = Sales_Controller_Document_Invoice::getInstance()->update($invoice); | ||
|
||
|
@@ -61,6 +62,36 @@ public function testInvoiceStorno() | |
$this->assertSame($invoice->{Sales_Model_Document_Invoice::FLD_RECIPIENT_ID}->{Tinebase_ModelConfiguration_Const::FLD_ORIGINAL_ID}, $storno->{Sales_Model_Document_Invoice::FLD_RECIPIENT_ID}->{Tinebase_ModelConfiguration_Const::FLD_ORIGINAL_ID}); | ||
} | ||
|
||
public function testCategoryEvalDimensionCopy() | ||
{ | ||
$customer = $this->_createCustomer(); | ||
$cat = Sales_Controller_Document_Category::getInstance()->getAll()->getFirstRecord(); | ||
$cc = Tinebase_Controller_EvaluationDimension::getInstance()->getAll()->find(Tinebase_Model_EvaluationDimension::FLD_NAME, Tinebase_Model_EvaluationDimension::COST_CENTER); | ||
$cc->{Tinebase_Model_EvaluationDimension::FLD_ITEMS} = new Tinebase_Record_RecordSet(Tinebase_Model_EvaluationDimensionItem::class, [ | ||
new Tinebase_Model_EvaluationDimensionItem([ | ||
Tinebase_Model_EvaluationDimensionItem::FLD_NUMBER => '01', | ||
Tinebase_Model_EvaluationDimensionItem::FLD_NAME => 'foo', | ||
], true), | ||
]); | ||
$cc = Tinebase_Controller_EvaluationDimension::getInstance()->update($cc); | ||
|
||
$cat->eval_dim_cost_center = $cc->{Tinebase_Model_EvaluationDimension::FLD_ITEMS}->getFirstRecord()->getId(); | ||
Sales_Controller_Document_Category::getInstance()->update($cat); | ||
|
||
$order = Sales_Controller_Document_Order::getInstance()->create(new Sales_Model_Document_Order([ | ||
Sales_Model_Document_Order::FLD_CUSTOMER_ID => $customer, | ||
Sales_Model_Document_Order::FLD_ORDER_STATUS => Sales_Model_Document_Order::STATUS_RECEIVED, | ||
Sales_Model_Document_Order::FLD_RECIPIENT_ID => $customer->postal, | ||
Sales_Model_Document_Order::FLD_DOCUMENT_CATEGORY => $cat->getId(), | ||
])); | ||
|
||
$this->assertSame($cat->eval_dim_cost_center, $order->eval_dim_cost_center->getId()); | ||
|
||
Tinebase_Record_Expander::expandRecord($order); | ||
$this->assertNotNull($order->{Sales_Model_Document_Abstract::FLD_DEBITOR_ID}); | ||
$this->assertSame($customer->{Sales_Model_Customer::FLD_DEBITORS}->getFirstRecord()->getId(), $order->{Sales_Model_Document_Abstract::FLD_DEBITOR_ID}->{Sales_Model_Document_Debitor::FLD_ORIGINAL_ID}); | ||
} | ||
|
||
public function testCustomerFilterForDocuments() | ||
{ | ||
$customer = $this->_createCustomer(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.