fix parameters for invoices
This commit is contained in:
@@ -36,17 +36,26 @@ class Orders
|
||||
public static function saveOrder($data)
|
||||
{
|
||||
$basket = $data['basket'];
|
||||
unset($data['basket']);
|
||||
$invoice = $data['invoice'];
|
||||
unset($data['basket'], $data['invoice']);
|
||||
$data += self::getSummaryOfBasket($basket);
|
||||
$order = self::store($data);
|
||||
$detail = OrderDetails::saveBasket($order->id, $basket['detail']);
|
||||
$data['ref'] = $order->ref;
|
||||
unset($data['comment']);
|
||||
unset($data['agree']);
|
||||
unset($data['delivery_address_id']);
|
||||
unset($data['detail']);
|
||||
unset($data['sale_channel_id']);
|
||||
$detail = $order ? OrderDetails::saveBasket($order->id, $basket['detail']) : false;
|
||||
unset($data['comment'], $data['agree'], $data['delivery_address_id'], $data['sale_channel_id']);
|
||||
$invoice = $detail ? Invoices::saveInvoice($order->id, $data + $invoice) : false;
|
||||
|
||||
return ($order && $detail) ? Invoices::saveInvoice($order->id, $data) : false;
|
||||
return $invoice ? $order : false;
|
||||
}
|
||||
|
||||
public static function getSummaryOfBasket($basket)
|
||||
{
|
||||
return [
|
||||
'total' => $basket['total'],
|
||||
'taxes' => $basket['taxes'],
|
||||
'total_taxed' => $basket['total_taxed'],
|
||||
'shipping' => $basket['shipping'],
|
||||
'total_shipped' => $basket['total_shipped'],
|
||||
];
|
||||
}
|
||||
|
||||
public static function edit($id)
|
||||
|
||||
Reference in New Issue
Block a user