Merge remote-tracking branch 'origin/ticket/14716-order-mobile'

This commit is contained in:
Michael RICOIS 2017-12-21 16:56:29 +01:00
commit 3a5c74c325
8 changed files with 561 additions and 520 deletions

View File

@ -72,13 +72,16 @@ class AdminOrders extends AdminTab
foreach(Country::getCountries((int) $cookie->id_lang, TRUE) as $country) {
$country_array[(int) $country['id_country']] = $country['name'];
}
$appliArray = array(
$deviceList = array(
0 => 'Site',
1 => 'Appli'
1 => 'Appli',
2 => 'Mobile',
);
foreach ($states AS $state)
foreach ($states AS $state){
$statesArray[$state['id_order_state']] = $state['name'];
}
$carriers = Db::getInstance()->ExecuteS('
SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', (
@ -91,6 +94,7 @@ class AdminOrders extends AdminTab
foreach ($carriers as $row) {
$carriersArray[(int)$row['id_carrier']] = $row['name'];
}
$this->fieldsDisplay = array(
'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false),
@ -103,8 +107,9 @@ class AdminOrders extends AdminTab
//'mixed' => array('title' => $this->l('Mixed'), 'callback' => 'printMixedSale', 'orderby' => false, 'search' => false),
'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false),
'id_country' => array('title' => $this->l('Pays'), 'callback' => 'printCountry', 'orderby' => false, 'type' => 'select', 'select' => $country_array, 'filter_key' => 'x!id_country', 'filter_type' => 'int', 'width' => 35,),
'appli' => array('title' => $this->l('Appli'), 'width' => 25, 'align' => 'center', 'type' => 'select', 'select' => $appliArray, 'filter_key' => 'a!appli', 'callback' => 'printAppliIcons', 'orderby' => false),
'appli' => array('title' => $this->l('Device'), 'width' => 25, 'align' => 'center', 'type' => 'select', 'select' => $deviceList, 'filter_key' => 'a!appli', 'callback' => 'printDeviceIcons', 'orderby' => false),
);
parent::__construct();
if(!isset($_POST['submitFilter']) && !isset($_POST['orderFilter_a!date_add'])) {

View File

@ -3814,3 +3814,7 @@ form.form-forward-message .button:focus{
.tab_customer_thread .button:focus{
background-color: rgba(86,84,133,0.6);
}
span.anticon {
color: #000;
}

@ -1 +0,0 @@
Subproject commit b26d6103a62b0eff495b785ec15edf0ad7020ea8

@ -1 +0,0 @@
Subproject commit b26d6103a62b0eff495b785ec15edf0ad7020ea8

@ -1 +0,0 @@
Subproject commit b26d6103a62b0eff495b785ec15edf0ad7020ea8

View File

@ -1,6 +1,6 @@
<?php
class Order extends OrderCore {
class Order extends OrderCore
{
/** @var boolean True if the order comes from app */
public $appli = 0;
@ -27,7 +27,7 @@ class Order extends OrderCore {
'total_wrapping' => 'isPrice',
'shipping_number' => 'isUrl',
'conversion_rate' => 'isFloat',
'appli' => 'isBool'
'appli' => 'isBool',
);
public function getFields()
@ -62,7 +62,7 @@ class Order extends OrderCore {
$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['appli'] = (int)($this->appli);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
@ -91,6 +91,27 @@ class Order extends OrderCore {
return '<img src="/img/'.$name.'.png" alt="" width="18px"/>';
}
public function printDeviceIcons($value, $params)
{
switch($value) {
default:
case 0:
$name = 'computer';
$icon = 'display';
break;
case 1:
$name = 'application';
$icon = 'android';
break;
case 2:
$name = 'mobile';
$icon = 'mobile';
break;
}
return '<span title="'.$name.'" class="anticon anticon-'.$icon.'"></span>';
}
public function printCarrier($value, $params)
{
$laposte_carriers = unserialize(Configuration::get('LAPOSTEWS_CARRIERS', serialize(array())));
@ -103,7 +124,6 @@ class Order extends OrderCore {
}
}
public static function getTotalbyDate($date_start, $date_end, $state = 0){
if($state == 0){
if($date_start == $date_end){

View File

@ -1,5 +1,6 @@
<?php
class PaymentModule extends PaymentModuleCore {
class PaymentModule extends PaymentModuleCore
{
public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
{
global $cart;
@ -21,7 +22,12 @@
// Copying data from cart
$order = new Order();
$order->appli = Tools::isApi()?1:0;
$order->appli = 0;
if (Tools::isApi()) {
$order->appli = 1;
} elseif (Tools::isMobile()) {
$order->appli = 2;
}
$order->id_carrier = (int)($cart->id_carrier);
$order->id_customer = (int)($cart->id_customer);
$order->id_address_invoice = (int)($cart->id_address_invoice);
@ -539,4 +545,4 @@
{
return AddressFormat::generateAddress($the_address, array('avoid' => array()), $line_sep, ' ', $fields_style);
}
}
}

View File

@ -129,6 +129,15 @@ class Tools extends ToolsCore {
return true;
}
public static function isMobile()
{
if (_PS_MOBILE_ == 1) {
return true;
}
return false;
}
public static function isApi()
{
$subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));