Merge branch 'ticket-14716-AppData' into develop

This commit is contained in:
Marion Muszynski 2017-11-20 11:33:18 +01:00
commit bc60df4a4d
3 changed files with 74 additions and 2 deletions

View File

@ -2303,6 +2303,8 @@ class AdminOrders extends AdminTab
<br /> <br />
<fieldset style="width: 400px"> <fieldset style="width: 400px">
<legend><img src="../img/admin/details.gif" /> '.$this->l('Order details').'</legend> <legend><img src="../img/admin/details.gif" /> '.$this->l('Order details').'</legend>
<label>'.$this->l('Depuis l\'Appli :').' </label>
<div style="margin: 2px 0 1em 50px;">'.($order->appli?'OUI':'NON').'</div>
<label>'.$this->l('Original cart:').' </label> <label>'.$this->l('Original cart:').' </label>
<div style="margin: 2px 0 1em 190px;"><a href="?tab=AdminCarts&id_cart='.$cart->id.'&viewcart&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)).'">'.$this->l('Cart #').sprintf('%06d', $cart->id).'</a></div> <div style="margin: 2px 0 1em 190px;"><a href="?tab=AdminCarts&id_cart='.$cart->id.'&viewcart&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)).'">'.$this->l('Cart #').sprintf('%06d', $cart->id).'</a></div>
<label>'.$this->l('Payment mode:').' </label> <label>'.$this->l('Payment mode:').' </label>

View File

@ -1,5 +1,74 @@
<?php <?php
class Order extends OrderCore { class Order extends OrderCore {
/** @var boolean True if the order comes from app */
public $appli = 0;
protected $fieldsValidate = array(
'id_address_delivery' => 'isUnsignedId',
'id_address_invoice' => 'isUnsignedId',
'id_cart' => 'isUnsignedId',
'id_currency' => 'isUnsignedId',
'id_lang' => 'isUnsignedId',
'id_customer' => 'isUnsignedId',
'id_carrier' => 'isUnsignedId',
'secure_key' => 'isMd5',
'payment' => 'isGenericName',
'recyclable' => 'isBool',
'gift' => 'isBool',
'gift_message' => 'isMessage',
'total_discounts' => 'isPrice',
'total_paid' => 'isPrice',
'total_paid_real' => 'isPrice',
'total_products' => 'isPrice',
'total_products_wt' => 'isPrice',
'total_shipping' => 'isPrice',
'carrier_tax_rate' => 'isFloat',
'total_wrapping' => 'isPrice',
'shipping_number' => 'isUrl',
'conversion_rate' => 'isFloat',
'appli' => 'isBool'
);
public function getFields()
{
ObjectModel::validateFields();
$fields['id_address_delivery'] = (int)($this->id_address_delivery);
$fields['id_address_invoice'] = (int)($this->id_address_invoice);
$fields['id_cart'] = (int)($this->id_cart);
$fields['id_currency'] = (int)($this->id_currency);
$fields['id_lang'] = (int)($this->id_lang);
$fields['id_customer'] = (int)($this->id_customer);
$fields['id_carrier'] = (int)($this->id_carrier);
$fields['secure_key'] = pSQL($this->secure_key);
$fields['payment'] = pSQL($this->payment);
$fields['module'] = pSQL($this->module);
$fields['conversion_rate'] = (float)($this->conversion_rate);
$fields['recyclable'] = (int)($this->recyclable);
$fields['gift'] = (int)($this->gift);
$fields['gift_message'] = pSQL($this->gift_message);
$fields['shipping_number'] = pSQL($this->shipping_number);
$fields['total_discounts'] = (float)($this->total_discounts);
$fields['total_paid'] = (float)($this->total_paid);
$fields['total_paid_real'] = (float)($this->total_paid_real);
$fields['total_products'] = (float)($this->total_products);
$fields['total_products_wt'] = (float)($this->total_products_wt);
$fields['total_shipping'] = (float)($this->total_shipping);
$fields['carrier_tax_rate'] = (float)($this->carrier_tax_rate);
$fields['total_wrapping'] = (float)($this->total_wrapping);
$fields['invoice_number'] = (int)($this->invoice_number);
$fields['delivery_number'] = (int)($this->delivery_number);
$fields['invoice_date'] = pSQL($this->invoice_date);
$fields['delivery_date'] = pSQL($this->delivery_date);
$fields['valid'] = (int)($this->valid) ? 1 : 0;
$fields['appli'] = (int)($this->appli) ? 1 : 0;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
return $fields;
}
public function printMixedSale($value, $params) { public function printMixedSale($value, $params) {
return Db::getInstance()->getValue(' return Db::getInstance()->getValue('
SELECT COUNT(DISTINCT `id_sale`) SELECT COUNT(DISTINCT `id_sale`)

View File

@ -21,6 +21,7 @@
// Copying data from cart // Copying data from cart
$order = new Order(); $order = new Order();
$order->appli = Tools::isApi()?1:0;
$order->id_carrier = (int)($cart->id_carrier); $order->id_carrier = (int)($cart->id_carrier);
$order->id_customer = (int)($cart->id_customer); $order->id_customer = (int)($cart->id_customer);
$order->id_address_invoice = (int)($cart->id_address_invoice); $order->id_address_invoice = (int)($cart->id_address_invoice);