Jump to content

Error al crear factura (actualización 1.6.1.0


UnMail

Recommended Posts

Hola!

 

Os cuento, al actualizar a la versión 1.6.1.0 me he dado cuenta que al crear una factura me salta este error:

 

[PrestaShopException]

Property OrderInvoice->number is empty
at 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();

 

Lo arreglo entrando a PHPMYADMIN y editando la tabla orders_invoice (o algo así no recuerdo el nombre exacto), ahí pongo el número de factura, importe (me sale a 0), y ya se arregla y tengo factura, pero claro esto no es normal, ¿de dónde viene el fallo?

 

Muchas gracias!

 

Saludos!

Edited by UnMail (see edit history)
Link to comment
Share on other sites

Hola,

 

Lo tengo por installatron, con la actualización de 1 click upgrade no me funcionaba, siempre errores por todos sitios, al final se me actualizó solo por installatron.

 

Es un problema de base de datos, parece que al hacer el pedido no se inserta el número de pedido en la tabla invoice, ¿no?

 

Saludos.

Link to comment
Share on other sites

Hola,

 

Si, esta en auto_increment la tabla ps_orders -> id_order

Y la tabla de ps_order_invoice está así:

 

1 id_order_invoice int(11) UNSIGNED No Ninguna AUTO_INCREMENT

2 id_order int(11) No Ninguna

3 number int(11) No Ninguna

4 delivery_number int(11) No Ninguna

5 delivery_date datetime Sí NULL

6 total_discount_tax_excl decimal(20,6) No 0.000000

7 total_discount_tax_incl decimal(20,6) No 0.000000

8 total_paid_tax_excl decimal(20,6) No 0.000000

9 total_paid_tax_incl decimal(20,6) No 0.000000

10 total_products decimal(20,6) No 0.000000

11 total_products_wt decimal(20,6) No 0.000000

12 total_shipping_tax_excl decimal(20,6) No 0.000000

13 total_shipping_tax_incl decimal(20,6) No 0.000000

14 shipping_tax_computation_method int(10) UNSIGNED No Ninguna

15 total_wrapping_tax_excl decimal(20,6) No 0.000000

16 total_wrapping_tax_incl decimal(20,6) No 0.000000

17 shop_address text utf8_general_ci Sí NULL

18 invoice_address text utf8_general_ci Sí NULL

19 delivery_address text utf8_general_ci Sí NULL

20 company_address text utf8_general_ci Sí NULL

21 note text utf8_general_ci Sí NULL

22 date_add datetime No Ninguna

 

 

Yo creo que el problema está cuando se crea el pedido que no está guardando en la base de datos los datos en la tabla invoice, ya que no puede ser que no estén los datos de precio, total etc.. en la tabla invoice.

Edited by UnMail (see edit history)
Link to comment
Share on other sites

A que te refieres con creado?

 

Tengo otro problema y es que cuando ponen pago con transferencia en el albarán indica No hay pago, y en la pestaña de pago si que indico que ha llegado el dinero, este fallo lo tengo desde siempre.

 

Saludos.

Link to comment
Share on other sites

  • 1 month later...

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...