Open Prestaworks opened 1 week ago
Hello @Prestaworks ,
I have reproduces your issue on PS 9.0.0 :
product_quantity_refunded is higher than product_quantity :
When I try to order the product, I have an exception :
Although I don't have any error on my log.
ping @PrestaShop/prestashop-core-developers ,
What do you think about this issue ?
Prerequisites
Describe the bug and add attachments
I had a strange case here, some orders was not created properly in the shop. I found this in the logs
PHP Fatal error: Uncaught PDOException: SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in '
domain
.od
.product_quantity
-domain
.od
.product_quantity_refunded
' in /var/www/domain.se/classes/db/DbPDO.php:149 Stack trace:0 /var/www/domain.se/classes/db/DbPDO.php(149): PDO->query()
1 /var/www/domain.se/classes/db/Db.php(377): DbPDOCore->_query()
2 /var/www/domain.se/classes/db/Db.php(567): DbCore->query()
3 /var/www/domain.se/src/Adapter/StockManager.php(175): DbCore->execute()
4 /var/www/domain.se/src/Adapter/StockManager.php(104): PrestaShop\PrestaShop\Adapter\StockManager->updateReservedProductQuantity()
5 /var/www/domain.se/classes/order/OrderHistory.php(433): PrestaShop\PrestaShop\Adapter\StockManager->updatePhysicalProductQuantity()
6 /var/www/domain.se/classes/order/OrderHistory.php(603): OrderHistoryCore->changeIdOrderState()
7 /var/www/domain.se/classes/webservice/WebserviceRequest.php(1671): OrderHistoryCore->addWs()
8 /var/www/domain.se/classes/webservice/WebserviceRequest.php(1446): WebserviceRequestCore->saveEntityFromXml()
9 /var/www/domain.se/classes/webservice/WebserviceRequest.php(582): WebserviceRequestCore->executeEntityPost()
10 /var/www/domain.se/webservice/dispatcher.php(94): WebserviceRequestCore->fetch()
11 {main}
and it seems to be due to some kind of misshap in the DB, this is and old shop, upgraded and has used lots of third party modules, so not sure how the data has been corrupted, but some orders seems to have had more refunds than ordered products
and this cause the order creation process to crash since the column in the database for reserved_quantity in stock_available does not allow negative numbers.
Expected behavior
The order should be completed properly. reserved quantity should perhaps be set to 0.
Steps to reproduce
PrestaShop version(s) where the bug happened
8.1.2
PHP version(s) where the bug happened
8.1
If your bug is related to a module, specify its name and its version
No response
Your company or customer's name goes here (if applicable).
Prestaworks