Skip to content

Commit

Permalink
Fix: Empty Stocks Writing
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Jun 12, 2023
1 parent a981bdb commit 269c649
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 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.2.8.0"
mod-file: "splashsync.2.8.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 = '2.8.0';
$this->version = '2.8.1';
$this->author = 'SplashSync';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => '8.99.99');
Expand Down
2 changes: 1 addition & 1 deletion modules/splashsync/src/Objects/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function __construct()
* Check if Source Product Catalog Mode is Active
*
* In this mode:
* - ALL Products Textual Informations are Read Only
* - ALL Products Textual Information are Read Only
* - BUT External can create Products with minimal Infos (SKU, Name)
*
* @return bool
Expand Down
14 changes: 7 additions & 7 deletions modules/splashsync/src/Objects/Product/StockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ protected function getStockLocationFields(string $key, string $fieldName)
/**
* Write Given Fields
*
* @param string $fieldName Field Identifier / Name
* @param int $fieldData Field Data
* @param string $fieldName Field Identifier / Name
* @param null|int $fieldData Field Data
*
* @throws PrestaShopException
*
* @return void
*/
protected function setStockFields(string $fieldName, int $fieldData)
protected function setStockFields(string $fieldName, ?int $fieldData): void
{
//====================================================================//
// WRITE Field
Expand All @@ -193,7 +193,7 @@ protected function setStockFields(string $fieldName, int $fieldData)
StockAvailable::setQuantity(
$this->ProductId,
(int) $this->AttributeId,
$fieldData,
(int) $fieldData,
// @phpstan-ignore-next-line
Shop::getContextShopID(true),
(bool) Shop::getContextShopID(true)
Expand All @@ -205,12 +205,12 @@ protected function setStockFields(string $fieldName, int $fieldData)
//====================================================================//
// Minimum Order Quantity
case 'minimal_quantity':
if (Validate::isUnsignedInt($fieldData)) {
if (Validate::isUnsignedInt((int) $fieldData)) {
if ($this->AttributeId) {
$this->setSimple($fieldName, $fieldData, "Attribute");
$this->setSimple($fieldName, (int) $fieldData, "Attribute");
$this->addMsfUpdateFields("Attribute", "minimal_quantity");
} else {
$this->setSimple($fieldName, $fieldData);
$this->setSimple($fieldName, (int) $fieldData);
$this->addMsfUpdateFields("Product", "minimal_quantity");
}
}
Expand Down

0 comments on commit 269c649

Please sign in to comment.