Closed tchauviere closed 9 years ago
$id_carrier is not cast to (int)
NOK expected to be int or null to create new carriers initially. https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L259 https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L347
Casting null
value to int
will make the Object to return a new instance, just like null
value itself does. So you can cast it to int
Once you have done “new Carrier()”, please check if the object is well loaded with “Validate::isLoadedObject($carrier)” and add error message if needed
NOK (see above) new objectModel has no id before save, the check is misplace at this time and will fail to install. https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L260
Casting null
value to int
will make the Object to return a new instance, just like null
value itself does. So you can cast it to int
Missing (int) cast “if ($country->id_zone != $id_zone_be)”
NOK we don't understand https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L301
I meant the following `if ((int)$country->id_zone != (int)$id_zone_be)``
$id_order_state is not cast to (int)
NOK int or NULL expected here (same answer as id_carrier above). https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L387
Casting null
value to int
will make the Object to return a new instance, just like null
value itself does. So you can cast it to int
Once you have done “new OrderState()”, please check if the object is well loaded with “Validate::isLoadedObject($order_state)” and add error message if needed
NOK (same answer as id_carrier above) https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L387
Casting null
value to int
will cause the Object to return a new instance, just like null
value itself does. So you can cast it to int
Consider using Tools::copy instead of copy()
NOK Tools::copy() doesn't exist in 1.4 https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L563
Please do the following then: (FYI 1.5.5.0 is the version where appeared Tools::copy() according to Validator PS Guide)
if (version_compare(PS_VERSION, '<', '1.5.5.0')
copy()
else
Tools:copy()
$id_carrier is not cast to (int)
NOK expected to be int or null to create new carriers initially. https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L259 https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L348
Casting null
value to int
will make the Object to return a new instance, just like null
value itself does. So you can cast it to int
=> Tested on 1.5 / 1.6 no problem doing so, it works like I said (null or 0 return a new empty object)
Missing (int) cast “if ($country->id_zone != $id_zone_be)”
NOK we don't understand https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L301
I meant the following `if ((int)$country->id_zone != (int)$id_zone_be)``
$id_order_state is not cast to (int)
NOK int or NULL expected here (same answer as id_carrier above). https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L388
Casting null
value to int
will make the Object to return a new instance, just like null
value itself does. So you can cast it to int
=> Tested on 1.5 / 1.6 no problem doing so, it works like I said (null or 0 return a new empty object)
Consider using Tools::copy instead of copy()
NOK Tools::copy() doesn't exist in 1.4 https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L563
Please do the following then: (FYI 1.5.5.0 is the version where appeared Tools::copy() according to Validator PS Guide)
if (version_compare(PS_VERSION, '<', '1.5.5.0')
copy()
else
Tools:copy()
Thibaud, I realize that there was a misunderstanding here, the part that was NOK for us was that:
https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L259 https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L348 Once you have done “new Carrier()”, please check if the object is well loaded with “Validate::isLoadedObject($carrier)” and add error message if needed
https://github.com/PrestaShop/bpostshm/blob/master/bpostshm.php#L387 Once you have done “new OrderState()”, please check if the object is well loaded with “Validate::isLoadedObject($order_state)” and add error message if needed
We'll add (int) and that Tools:copy()
Hi @Stigmi,
Yes I realized the misunderstanding this morning too. That's why I removed these lines in the update ;)
OK last commit have taken all your comments.
Fixed!
Here are some few enhancements that can be done to improve module stability: