Skip to content

Commit

Permalink
Improve Order to Address Commits
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed May 2, 2022
1 parent 1d1c7fc commit 5d28829
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parameters:
# For Building Splash Module
mod-src: '/modules/splashsync'
mod-target: '/splashsync/'
mod-file: "splashsync.1.7.0"
mod-file: "splashsync.1.7.1"

# For Building Splash Manifest
yml-enable: false
Expand Down
2 changes: 1 addition & 1 deletion modules/splashsync/splashsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct()
// Init Module Main Information Fields
$this->name = 'splashsync';
$this->tab = 'administration';
$this->version = '1.7.0';
$this->version = '1.7.1';
$this->author = 'SplashSync';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7');
Expand Down
24 changes: 17 additions & 7 deletions modules/splashsync/src/Objects/Order/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,26 @@ private function hookactionInvoice(object $order, string $action, string $commen
*/
private function hookOrderSecondaryCommits(object $order, string $comment): bool
{
//====================================================================//
// Check NOT Server Mode
if (defined('SPLASH_SERVER_MODE') && !empty(SPLASH_SERVER_MODE)) {
return true;
}
//====================================================================//
// Check if feature is Enabled & NOT Server Mode
if (empty(Splash::configuration()->PsCommitOrderToAddresses)) {
return true;
}
$errors = 0;
//====================================================================//
// Commit Update For Order Shipping Address
if (!empty(Splash::configuration()->PsCommitOrderToAddresses) && isset($order->id_address_delivery)) {
if (!empty($order->id_address_delivery)) {
$errors += !$this->doCommit("Address", (string)$order->id_address_delivery, SPL_A_UPDATE, $comment);
}
if (!empty($order->id_address_invoice)) {
$errors += !$this->doCommit("Address", (string)$order->id_address_invoice, SPL_A_UPDATE, $comment);
}
if (!empty($order->id_address_delivery)) {
$errors += !$this->doCommit("Address", (string)$order->id_address_delivery, SPL_A_UPDATE, $comment);
}
//====================================================================//
// Commit Update For Order Billing Address
if (!empty($order->id_address_invoice)) {
$errors += !$this->doCommit("Address", (string)$order->id_address_invoice, SPL_A_UPDATE, $comment);
}

return !$errors;
Expand Down

0 comments on commit 5d28829

Please sign in to comment.