Jump to content

Marta_web04

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Marta_web04

  1. Disculpa me he explicado mal, he reemplazado el código por tu solución, esto edita la fecha de la factura ? o permite personalizarla desde el backend ? un saludo public function add($autodate = true, $null_values = false) { $order = new Order($this->id_order); // Obtain the payments for this order $payments = OrderPayment::getByOrderReference($order->reference); if (!empty($payments)) { // Get the date of the last payment $last_payment = end($payments); if ($last_payment && property_exists($last_payment, 'date_add')) { $this->date_add = $last_payment->date_add; } } // Call the parent method to add the invoice $result = parent::add($autodate, $null_values); // If the date was overwritten, set it again if (!empty($payments) && $this->date_add !== $last_payment->date_add) { $this->date_add = $last_payment->date_add; Db::getInstance()->update('order_invoice', ['date_add' => $this->date_add], 'id_order_invoice = ' . (int)$this->id); } // Set the shop address $this->shop_address = OrderInvoice::getCurrentFormattedShopAddress($order->id_shop); return $result; }
×
×
  • Create New...