UnMail Posted July 26, 2015 Share Posted July 26, 2015 Hi, I update my prestashop at 1.6.1.0 and when i create new invoice have this error: [PrestaShopException] Property OrderInvoice->number is emptyat line 881 in file classes/ObjectModel.php 876. 877. $message = $this->validateField($field, $this->$field);878. if ($message !== true)879. {880. if ($die)881. throw new PrestaShopException($message);882. return $error_return ? $message : false;883. }884. }885. 886. return true; ObjectModelCore->validateFields - [line 245 - classes/ObjectModel.php]240. * @return array All object fields241. * @throws PrestaShopException242. */243. public function getFields()244. {245. $this->validateFields();246. $fields = $this->formatFields(self::FORMAT_COMMON);247. 248. // For retro compatibility249. if (Shop::isTableAssociated($this->def['table']))250. $fields = array_merge($fields, $this->getFieldsShop()); ObjectModelCore->getFields - [line 469 - classes/ObjectModel.php]464. }465. 466. // Database insertion467. if (Shop::checkIdShopDefault($this->def['table']))468. $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);469. if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values))470. return false;471. 472. // Get object id in database473. $this->id = Db::getInstance()->Insert_ID();474. ObjectModelCore->add - [line 152 - classes/order/OrderInvoice.php]147. 148. $delivery_address = new Address((int)$order->id_address_delivery);149. $deliveryAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);150. $this->delivery_address = AddressFormat::generateAddress($delivery_address, $deliveryAddressPatternRules, '<br />', ' ');151. 152. return parent::add();153. }154. 155. public function getProductsDetail()156. {157. return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' OrderInvoiceCore->add - [line 431 - classes/ObjectModel.php] - [2 Arguments]426. * @return bool Insertion result427. * @throws PrestaShopException428. */429. public function save($null_values = false, $auto_date = true)430. {431. return (int)$this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);432. }433. 434. /**435. * Adds current object to the database436. * ObjectModelCore->save - [line 1214 - classes/order/Order.php]1209. $order_invoice->total_wrapping_tax_excl = $this->total_wrapping_tax_excl;1210. $order_invoice->total_wrapping_tax_incl = $this->total_wrapping_tax_incl;1211. 1212. // Save Order invoice1213. 1214. $order_invoice->save();1215. if (Configuration::get('PS_INVOICE'))1216. $this->setLastInvoiceNumber($order_invoice->id, $this->id_shop);1217. 1218. if (Configuration::get('PS_ATCP_SHIPWRAP'))1219. { OrderCore->setInvoice - [line 295 - classes/order/OrderHistory.php] - [1 Arguments]290. $order->current_state = $this->id_order_state;291. $order->valid = $new_os->logable;292. $order->update();293. 294. if ($new_os->invoice && !$order->invoice_number)295. $order->setInvoice($use_existing_payment);296. elseif ($new_os->delivery && !$order->delivery_number)297. $order->setDeliverySlip();298. 299. // set orders as paid300. if ($new_os->paid == 1) OrderHistoryCore->changeIdOrderState - [line 525 - controllers/admin/AdminOrdersController.php] - [3 Arguments]520. $history->id_employee = (int)$this->context->employee->id;521. 522. $use_existings_payment = false;523. if (!$order->hasInvoice())524. $use_existings_payment = true;525. $history->changeIdOrderState((int)$order_state->id, $order, $use_existings_payment);526. 527. $carrier = new Carrier($order->id_carrier, $order->id_lang);528. $templateVars = array();529. if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)530. $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url)); AdminOrdersControllerCore->postProcess - [line 171 - classes/controller/Controller.php]166. // setMedia MUST be called before postProcess167. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))168. $this->setMedia();169. 170. // postProcess handles ajaxProcess171. $this->postProcess();172. 173. if (!empty($this->redirect_after))174. $this->redirect();175. 176. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) ControllerCore->run - [line 373 - classes/Dispatcher.php]368. // Execute hook dispatcher369. if (isset($params_hook_action_dispatcher))370. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);371. 372. // Running controller373. $controller->run();374. }375. catch (PrestaShopException $e)376. {377. $e->displayMessage();378. } DispatcherCore->dispatch - [line 54 - admin/index.php] 49. $_POST['controller'] = strtolower($_POST['tab']);50. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))51. $_REQUEST['controller'] = strtolower($_REQUEST['tab']);52. 53. // Prepare and trigger admin dispatcher54. Dispatcher::getInstance()->dispatch(); How can repair this? Thanks a lot! Link to comment Share on other sites More sharing options...
NemoPS Posted July 27, 2015 Share Posted July 27, 2015 For any order?I'd try replacing both the classes/ and controllers/ folder with some new ones from a fresh archive. SOmething might have gone wrong during the upgrade Link to comment Share on other sites More sharing options...
UnMail Posted July 30, 2015 Author Share Posted July 30, 2015 Hi, I try a replace the folders classes and controllers and not have result, same problem. :( Thanks! Link to comment Share on other sites More sharing options...
UnMail Posted August 3, 2015 Author Share Posted August 3, 2015 Hi, Its possible its cause by problem in BBDD?, i think have problem in the table orders, but dont know what. Thanks for the support. Link to comment Share on other sites More sharing options...
NemoPS Posted August 4, 2015 Share Posted August 4, 2015 Now I would really like to know what BBDD stands for but I do not.Anyway it looks like the issue comes from the object's validation. $order->setInvoiceIs failing Link to comment Share on other sites More sharing options...
UnMail Posted August 4, 2015 Author Share Posted August 4, 2015 Hi, BBDD = Database in spanish haha Not solve the problem, really need solve this but dont know how solve it. Thanks for the support. Link to comment Share on other sites More sharing options...
NemoPS Posted August 5, 2015 Share Posted August 5, 2015 No idea, it's an invalid invoice, number, you can try printing out the values and see what it says, or have a developer look into it Link to comment Share on other sites More sharing options...
Mario70 Posted August 13, 2015 Share Posted August 13, 2015 Hi, after upgrade I've the same problem: Property OrderInvoice->number is emptyat line 881 in file classes/ObjectModel.php Thanks all. Link to comment Share on other sites More sharing options...
UnMail Posted August 13, 2015 Author Share Posted August 13, 2015 I not have solution, someone have idea to resolve this? Link to comment Share on other sites More sharing options...
Mario70 Posted August 17, 2015 Share Posted August 17, 2015 I opened a ticket still unanswered. It's a great problem. Link to comment Share on other sites More sharing options...
UnMail Posted August 17, 2015 Author Share Posted August 17, 2015 Where open the ticket? Link to comment Share on other sites More sharing options...
Mario70 Posted August 18, 2015 Share Posted August 18, 2015 Here: https://www.prestashop.com/it/support Link to comment Share on other sites More sharing options...
trippodo Posted August 20, 2015 Share Posted August 20, 2015 hello, i have the same error after upgrade to 1.6.1.0 please help! Link to comment Share on other sites More sharing options...
UnMail Posted August 20, 2015 Author Share Posted August 20, 2015 someone know to solve this? :( Link to comment Share on other sites More sharing options...
Mario70 Posted August 22, 2015 Share Posted August 22, 2015 after the upgrade to version 1.6.1.1 this is the new error code, the line has changed from 881 to 909 Property OrderInvoice->number is emptyat line 909 in file classes/ObjectModel.php Link to comment Share on other sites More sharing options...
trippodo Posted August 22, 2015 Share Posted August 22, 2015 same for me! Property OrderInvoice->number is empty at line 909 in file classes/ObjectModel.php Link to comment Share on other sites More sharing options...
UnMail Posted August 22, 2015 Author Share Posted August 22, 2015 same for me too Link to comment Share on other sites More sharing options...
UnMail Posted August 24, 2015 Author Share Posted August 24, 2015 i put the error in first message. thanks Link to comment Share on other sites More sharing options...
Armando Salvador Posted August 26, 2015 Share Posted August 26, 2015 Uops, sorry UnMail, mobile version of this forum not show the code in messages. Please, can you access to your phpMyAdmin list the table prefix_order_invoice and paste here?, The number is a field that you have got in this table, search the order id in the field id_order. The number is the value that PrestaShops uses to show the order number in PDF. I can't reproduce the error but could be a solution verify if id_order_invoice is the same that number in other cases and copy the value from id_order_invoice to number. Tell me something. Link to comment Share on other sites More sharing options...
UnMail Posted August 26, 2015 Author Share Posted August 26, 2015 Hi, The error its the system not put values in table invoice, not put cost, id order, etc... Link to comment Share on other sites More sharing options...
UnMail Posted August 28, 2015 Author Share Posted August 28, 2015 (edited) Someone?? Edited August 28, 2015 by UnMail (see edit history) Link to comment Share on other sites More sharing options...
trippodo Posted August 29, 2015 Share Posted August 29, 2015 anyone ??? Please HELP!!! Link to comment Share on other sites More sharing options...
UnMail Posted September 1, 2015 Author Share Posted September 1, 2015 Not possible prestashop team see this? Link to comment Share on other sites More sharing options...
Eutanasio Posted September 3, 2015 Share Posted September 3, 2015 Same here after upgrading to 1.6.1. Quiet often when changing order status o using the search filters in the BO. Link to comment Share on other sites More sharing options...
trippodo Posted September 16, 2015 Share Posted September 16, 2015 Someone?? Please HELPPPPPP!!!!!!!!!! Link to comment Share on other sites More sharing options...
trippodoshop Posted September 16, 2015 Share Posted September 16, 2015 please help....!!! Link to comment Share on other sites More sharing options...
scotch86 Posted September 16, 2015 Share Posted September 16, 2015 (edited) Hi everybody, i understood the problem! i think it's a bug of the last version of PS (1.6.1), there is an error in the code in function setInvoice (in my 1.6.1.1) there is if ($id = (int)$this->hasDelivery()) { $order_invoice = new OrderInvoice($id); } else { $order_invoice = new OrderInvoice(); } but the only $id value returned by $this->hasDelivery() can be 1 because in that method the result is casted to bool. so if in DB there is an OrderInvoice with id 1, this will be wrongly fetched (for every order will be always fetched the invoice with id = 1). Instead if in DB there isn't an OrderInvoice with id = 1 you'll have the error described in this topic: Property OrderInvoice->number is empty I'll comunicate this problem to presta developers, for the moment i solved making an override (attached to the post) to put in /override/classes/order/ (remember to erase the file /cache/class_index.php after has put the file in the override) i hope this will help you too. I also created an issue on the bugtracker: http://forge.prestashop.com/browse/PSCSX-6832 Order.php Edited September 17, 2015 by scotch86 (see edit history) Link to comment Share on other sites More sharing options...
trippodoshop Posted September 16, 2015 Share Posted September 16, 2015 Dear scotch86, you are a genius !!! I applied your change and everything works perfectly !!! THANKS!!!!!!!!!! 1 Link to comment Share on other sites More sharing options...
scotch86 Posted September 16, 2015 Share Posted September 16, 2015 Link to comment Share on other sites More sharing options...
LaVallDesign Posted September 28, 2015 Share Posted September 28, 2015 I have version 1.6.1.0. What do I have to do? Link to comment Share on other sites More sharing options...
mudol Posted April 21, 2016 Share Posted April 21, 2016 (edited) I have this problem too on ps 1.6.1.0, and this solution not working for me, after put this file in overrides/classes/order and delete file /cache/class_index, i make order, in databes still dont have new record in invoices, when i go to Back office in Orders and try to change status i have blank page with Your file, when i delete this file i can change order status but still have this error about empty invoice number Dou You know if this bug its still in ps 1.6.1.5? edit: i think i solved problem, i dont have entry in DB with id = 1, after change second entry to '1' i can change status without error and correct number invoice Edited April 21, 2016 by mudol (see edit history) Link to comment Share on other sites More sharing options...
Michel presta Posted August 28, 2017 Share Posted August 28, 2017 UpI ha ve the same problem with the upgrade to 1.6.1.16 version A little diference: [PrestaShopException]Property StockMvt->id_employee is emptyat line 917 in file classes/ObjectModel.phpCan you help me please Link to comment Share on other sites More sharing options...
Scully Posted September 1, 2017 Share Posted September 1, 2017 @Michael, You are in the completely wrong thread. Your error has nothing to do with all the ones handeled in previous posts within this thread. Link to comment Share on other sites More sharing options...
Michel presta Posted September 4, 2017 Share Posted September 4, 2017 Hiyes if you read the first topic, it is the same error.Just the field change Link to comment Share on other sites More sharing options...
Scully Posted September 4, 2017 Share Posted September 4, 2017 If I compare the two error messages, it's different: Property OrderInvoice->number is emptyat line 881 in file classes/ObjectModel.phpProperty StockMvt->id_employee is emptyat line 917 in file classes/ObjectModel.php Hence the cause is also different. The initial error refers to the order invoice number, yours is employee ID. Link to comment Share on other sites More sharing options...
tuk66 Posted September 19, 2017 Share Posted September 19, 2017 Up I ha ve the same problem with the upgrade to 1.6.1.16 version A little diference: [PrestaShopException]Property StockMvt->id_employee is empty at line 917 in file classes/ObjectModel.php Can you help me please StockMvt->id_employee is required so this problem is in the database. Something caused it. A module or a fatal error (timeout). I think you can only fix this value in the ps_stock_mvt table and hope it won't appear again. Link to comment Share on other sites More sharing options...
NemoPS Posted September 22, 2017 Share Posted September 22, 2017 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),This really is required, so you need to track the error back and see why it's not assigning the id Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now