Skip to content

Commit

Permalink
T-14272/feat: Allow multiple complete statuses to trigger fulfilment
Browse files Browse the repository at this point in the history
  • Loading branch information
brtkwr committed Nov 22, 2023
1 parent e159421 commit 6fd8b95
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Api/Config/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public function getFulfillTrigger(?int $storeId = null): string;
*
* @param int|null $storeId
*
* @return string
* @return array
*/
public function getFulfillOrderStatus(?int $storeId = null): string;
public function getFulfillOrderStatusList(?int $storeId = null): array;

/**
* Check if international telephone is enabled
Expand Down
4 changes: 2 additions & 2 deletions Model/Config/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public function getFulfillTrigger(?int $storeId = null): string
/**
* @inheritDoc
*/
public function getFulfillOrderStatus(?int $storeId = null): string
public function getFulfillOrderStatusList(?int $storeId = null): array
{
return (string)$this->getConfig(self::XML_PATH_FULFILL_ORDER_STATUS, $storeId);
return explode(',', (string)$this->getConfig(self::XML_PATH_FULFILL_ORDER_STATUS, $storeId));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Observer/SalesOrderSaveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function execute(Observer $observer)
&& $order->getTwoOrderId()
) {
if (($this->configRepository->getFulfillTrigger() == 'complete')
&& ($this->configRepository->getFulfillOrderStatus() == $order->getStatus())
&& in_array($order->getStatus(), $this->configRepository->getFulfillOrderStatusList())
) {
if (!$this->isWholeOrderShipped($order)) {
$error = __("Two requires whole order to be shipped before it can be fulfilled.");
Expand Down
4 changes: 2 additions & 2 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@
</depends>
<config_path>payment/two_payment/fulfill_trigger</config_path>
</field>
<field id="fulfill_order_status" translate="label" type="select" sortOrder="30" showInDefault="1"
<field id="fulfill_order_status" translate="label" type="multiselect" sortOrder="30" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Fulfilment order status</label>
<comment>If fulfilment trigger is On Completion, select the order status which triggers fulfilment.</comment>
<comment>If fulfilment trigger is On Completion, select one of more order statuses which can trigger fulfilment.</comment>
<source_model>Two\Gateway\Model\Config\Source\FulfillOrderStatus</source_model>
<depends>
<field id="active">1</field>
Expand Down

0 comments on commit 6fd8b95

Please sign in to comment.