diff --git a/admin-dev/tabs/AdminAccess.php b/admin-dev/tabs/AdminAccess.php index e32e238d9..37b531e4c 100644 --- a/admin-dev/tabs/AdminAccess.php +++ b/admin-dev/tabs/AdminAccess.php @@ -38,7 +38,7 @@ class AdminAccess extends AdminTab if (!in_array($perm, array('view', 'add', 'edit', 'delete', 'all'))) throw new PrestashopException('permission not exists'); - $enabled = (int)Tools::getValue('enabled') ; + $enabled = (int)Tools::getValue('enabled'); $id_tab = (int)(Tools::getValue('id_tab')); $id_profile = (int)(Tools::getValue('id_profile')); $res = true; diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 5b0ac7e04..70c278e88 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -984,7 +984,7 @@ class AdminImport extends AdminTab $this->_warnings[] = sprintf(Tools::displayError('No image found for combination with id_product = %s and image position = %s.'), $product->id, (int)$info['image_position']); } - $id_product_attribute = $product->addProductAttribute((float)($info['price']), (float)($info['weight']), 0, (float)($info['ecotax']), (int)($info['quantity']), $id_image, strval($info['reference']), strval($info['supplier_reference']), strval($info['ean13']), (int)($info['default_on']), strval($info['upc'])); + $id_product_attribute = $product->addProductAttribute((float)($info['price']), (float)($info['weight']), 0, (float)($info['ecotax']), $id_image, strval($info['reference']), strval($info['supplier_reference']), strval($info['ean13']), (int)($info['default_on']), strval($info['upc'])); $id_attribute_group = 0; $group = ''; foreach (explode($fsep, $info['group']) as $group) diff --git a/admin-dev/tabs/AdminOrders.php b/admin-dev/tabs/AdminOrders.php index cfe035e8d..600724fa2 100644 --- a/admin-dev/tabs/AdminOrders.php +++ b/admin-dev/tabs/AdminOrders.php @@ -30,19 +30,19 @@ class AdminOrders extends AdminTab public function __construct() { $this->context = Context::getContext(); - $this->table = 'order'; - $this->className = 'Order'; - $this->view = true; + $this->table = 'order'; + $this->className = 'Order'; + $this->view = true; $this->colorOnBackground = true; - $this->_select = ' + $this->_select = ' a.id_order AS id_pdf, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new, (SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number'; - $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) - LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`) + $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) + LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`) LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)'; @@ -52,7 +52,7 @@ class AdminOrders extends AdminTab foreach ($states AS $state) $statesArray[$state['id_order_state']] = $state['name']; - $this->fieldsDisplay = array( + $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), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), @@ -61,14 +61,13 @@ class AdminOrders extends AdminTab 'osname' => array('title' => $this->l('Status'), 'widthColumn' => 230, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), 'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), 'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); - $this->shopLinkType = 'shop'; - $this->shopShareDatas = Shop::SHARE_ORDER; + $this->shopLinkType = 'shop'; + $this->shopShareDatas = Shop::SHARE_ORDER; parent::__construct(); } public function postProcess() { - /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') AND ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order))) { @@ -116,24 +115,29 @@ class AdminOrders extends AdminTab $history = new OrderHistory(); $history->id_order = (int)$id_order; $history->id_employee = (int)$this->context->employee->id; - $history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order)); - $order = new Order((int)$order->id); - $carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang)); - $templateVars = array(); - if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') AND $order->shipping_number) - $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url)); - elseif ($history->id_order_state == Configuration::get('PS_OS_CHEQUE')) - $templateVars = array( - '{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''), - '{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : '')); - elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE')) - $templateVars = array( - '{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''), - '{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''), - '{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : '')); - if ($history->addWithemail(true, $templateVars)) - Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token); - $this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.'); + if (!(int)Tools::getValue('id_warehouse')) + $this->_errors[] = Tools::displayError('An error occurred while changing the status.'); + else + { + $history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order), (int)Tools::getValue('id_warehouse')); + $order = new Order((int)$order->id); + $carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang)); + $templateVars = array(); + if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') AND $order->shipping_number) + $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url)); + else if ($history->id_order_state == Configuration::get('PS_OS_CHEQUE')) + $templateVars = array( + '{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''), + '{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : '')); + elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE')) + $templateVars = array( + '{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''), + '{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''), + '{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : '')); + if ($history->addWithemail(true, $templateVars)) + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token); + $this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.'); + } } } else @@ -144,7 +148,7 @@ class AdminOrders extends AdminTab elseif (isset($_POST['submitMessage'])) { $_GET['view'.$this->table] = true; - if ($this->tabAccess['edit'] === '1') + if ($this->tabAccess['edit'] === '1') { if (!($id_order = (int)(Tools::getValue('id_order'))) OR !($id_customer = (int)(Tools::getValue('id_customer')))) $this->_errors[] = Tools::displayError('An error occurred before sending message'); @@ -232,14 +236,14 @@ class AdminOrders extends AdminTab $full_product_list = $productList; $full_quantity_list = $qtyList; - if ($customizationList) - { - foreach ($customizationList as $key => $id_order_detail) - { - $full_product_list[$id_order_detail] = $id_order_detail; - $full_quantity_list[$id_order_detail] = $customizationQtyList[$key]; - } - } + if ($customizationList) + { + foreach ($customizationList as $key => $id_order_detail) + { + $full_product_list[$id_order_detail] = $id_order_detail; + $full_quantity_list[$id_order_detail] = $customizationQtyList[$key]; + } + } if ($productList OR $customizationList) { @@ -575,9 +579,37 @@ class AdminOrders extends AdminTab '; + $warehouse_list = Warehouse::getWarehouseList(); + echo ''; + echo ' + '; @@ -594,7 +626,7 @@ class AdminOrders extends AdminTab { echo ' '.$this->l('This order has been placed by a').' '.$this->l('guest').''; - if(!Customer::customerExists($customer->email)) + if (!Customer::customerExists($customer->email)) { echo '