Jump to content
AETtec

Error 500 - Add new supplier

Recommended Posts

Posted (edited)

Hello, i have suppliers created, but now when i try to create another one i get the next message on debug mode:

[PrestaShopException]
La propiedad Address->dni está vacía.
at line 1004 in file classes/ObjectModel.php

999.             }
1000. 
1001.             $message = $this->validateField($field, $this->$field);
1002.             if ($message !== true) {
1003.                 if ($die) {
1004.                     throw new PrestaShopException($message);
1005.                 }
1006. 
1007.                 return $error_return ? $message : false;
1008.             }
1009.         }
ObjectModelCore->validateFields - [line 292 - classes/ObjectModel.php]
287.      *
288.      * @throws PrestaShopException
289.      */
290.     public function getFields()
291.     {
292.         $this->validateFields();
293.         $fields = $this->formatFields(self::FORMAT_COMMON);
294. 
295.         // For retro compatibility
296.         if (Shop::isTableAssociated($this->def['table'])) {
297.             $fields = array_merge($fields, $this->getFieldsShop());
ObjectModelCore->getFields - [line 561 - classes/ObjectModel.php]
ObjectModelCore->add - [line 187 - classes/Address.php] - [2 Arguments]
182.     /**
183.      * @see ObjectModel::add()
184.      */
185.     public function add($autodate = true, $null_values = false)
186.     {
187.         if (!parent::add($autodate, $null_values)) {
188.             return false;
189.         }
190. 
191.         if (Validate::isUnsignedId($this->id_customer)) {
192.             Customer::resetAddressCache($this->id_customer, $this->id);
AddressCore->add - [line 516 - classes/ObjectModel.php] - [2 Arguments]
511.      *
512.      * @throws PrestaShopException
513.      */
514.     public function save($null_values = false, $auto_date = true)
515.     {
516.         return (int) $this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);
517.     }
518. 
519.     /**
520.      * Adds current object to the database.
521.      *
ObjectModelCore->save - [line 501 - controllers/admin/AdminSuppliersController.php]
496.                 $this->errors[] = $this->trans('The address is not correct. Please make sure all of the required fields are completed.', array(), 'Admin.Catalog.Notification');
497.             } else {
498.                 if (Tools::isSubmit('id_address') && Tools::getValue('id_address') > 0) {
499.                     $address->update();
500.                 } else {
501.                     $address->save();
502.                     $_POST['id_address'] = $address->id;
503.                 }
504.             }
505. 
506.             return parent::postProcess();
AdminSuppliersControllerCore->postProcess - [line 281 - classes/controller/Controller.php]
276.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
277.                 $this->setMedia();
278.             }
279. 
280.             // postProcess handles ajaxProcess
281.             $this->postProcess();
282. 
283.             if (!empty($this->redirect_after)) {
284.                 $this->redirect();
285.             }
286. 
ControllerCore->run - [line 515 - classes/Dispatcher.php]
510.             if (isset($params_hook_action_dispatcher)) {
511.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
512.             }
513. 
514.             // Running controller
515.             $controller->run();
516. 
517.             // Execute hook dispatcher after
518.             if (isset($params_hook_action_dispatcher)) {
519.                 Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
520.             }
DispatcherCore->dispatch - [line 97 - admin/index.php]
92.     if (!headers_sent()) {
93.         header('Content-Type: text/html; charset=utf-8');
94.     }
95. 
96.     // Prepare and trigger LEGACY admin dispatcher
97.     Dispatcher::getInstance()->dispatch();
98. }

Cant undestand why, and look at the sentence address -> DNI está vacía (DNI Empty) no exists DNI on supplier form... :S

My PS version is 1.7.6.1. New york Theme

Edited by AETtec
More info (see edit history)

Share this post


Link to post
Share on other sites

Please need solution 😕 how can i repair it, dont understand why now i got the error but not at the start

Share this post


Link to post
Share on other sites

It looks like the DNI field is mandatory, isn't there an input for that in the supplier? If not, I guess it's a bug, and you have to make it not mandatory, save, then make it mandatory again

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More