Search the Community
Showing results for tags 'specific price id'.
-
Hello, My config : Apache/2.4.18 (Ubuntu) - PHP 7.0.33-0ubuntu0.16.04.3 - MySQL 5.7.25-0ubuntu0.16.04.2 - InnoDB This week-end I've upgraded the shop from MySQL 5.6 to 5.7. I changed the sql_mode to the following removing NO_ZERO_DATE and NO_ZERO_IN_DATE so that the database accepts dates with zeros : +------------------------------------------------------------------------------------------+ | @@sql_mode | +------------------------------------------------------------------------------------------+ | ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +------------------------------------------------------------------------------------------+ 1 row in set (0,00 sec) I tested a bit the website so I went on a product on the back-office and entered a specific price with an unlimited date (0000-00-00 00:00:00). It accepted the line. Then I tried to remove the line and I got the error "The specific price ID is invalid." and the line didn't remove itself. I tried removing other existing specific price lines but the same error appeared. I've searched for the error on the Prestashop files and it is on controllers/admin/AdminProductsController.php l.1171 public function ajaxProcessDeleteSpecificPrice() { if ($this->tabAccess['delete'] === '1') { $id_specific_price = (int)Tools::getValue('id_specific_price'); if (!$id_specific_price || !Validate::isUnsignedId($id_specific_price)) { $error = Tools::displayError('The specific price ID is invalid.'); } else { $specificPrice = new SpecificPrice((int)$id_specific_price); if (!$specificPrice->delete()) { $error = Tools::displayError('An error occurred while attempting to delete the specific price.'); } } } else { $error = Tools::displayError('You do not have permission to delete this.'); } if (isset($error)) { $json = array( 'status' => 'error', 'message'=> $error ); } else { $json = array( 'status' => 'ok', 'message'=> $this->_conf[1] ); } So if there is no specific price ID (which is not the case) or if my specific price ID isn't validated as an Unsigned ID then the error appears. To be validated as an Unisgned ID, it's in classes/Validate.php l.696 with : /** * Check for an integer validity (unsigned) * Mostly used in database for auto-increment * * @param int $id Integer to validate * @return bool Validity is ok or not */ public static function isUnsignedId($id) { return Validate::isUnsignedInt($id); /* Because an id could be equal to zero when there is no association */ } So my ID must be Unisgned if I don't want to have this error. Except that when I go to the SQL table of the specific price, my ID is Unsigned : 1 id_specific_price Primaire bigint(11) UNSIGNED Non Aucune AUTO_INCREMENT So I don't understand why I got this error. I never got it with MySQL 5.6. Does someone know if something in MySQL 5.7 prevents my bigint unsigned ID from beeing an UnsignedID ?
- 2 replies
-
- product admin
- invalid
-
(and 2 more)
Tagged with: