public function initContent() { parent::initContent(); $log_on = Configuration::get('YA_ORG_LOGGING_ON'); if (Tools::getValue('label')) { $data = explode('_', Tools::getValue('label')); } else { $data = explode('_', Tools::getValue('customerNumber')); } if (!empty($data) && isset($data[1])) { $ordernumber = $data['1']; $this->context->smarty->assign('ordernumber', $ordernumber); $this->context->smarty->assign('time', date('Y-m-d H:i:s ')); if (!$ordernumber) { if ($log_on) { $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified')); } $this->setTemplate('error.tpl'); } else { $cart = new Cart((int) $ordernumber); $qty = $cart->nbProducts(); $this->context->smarty->assign('nbProducts', $qty); if (!Validate::isLoadedObject($cart) || $qty < 1) { if ($log_on) { $this->module->logSave('yakassa_success: Error ' . $this->module->l('Shopping cart does not exist')); } $this->setTemplate('error.tpl'); } else { $ordernumber = (int) $cart->id; if (!$ordernumber) { if ($log_on) { $this->module->logSave('yakassa_success: Error ' . $this->module->l('Order number is not specified')); } $this->setTemplate('error.tpl'); } else { $order = new Order((int) Order::getOrderByCartId($cart->id)); $customer = new Customer((int) $order->id_customer); if ($order->hasBeenPaid()) { if ($log_on) { $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order paid')); } Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id); } else { if ($log_on) { $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order wait payment')); } $this->setTemplate('waitingPayment.tpl'); } } } } } else { if ($log_on) { $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified')); } $this->setTemplate('error.tpl'); } }
public static function create(Order $order, $product_list, $shipping_cost = false, $amount = 0, $amount_choosen = false, $add_tax = true) { $currency = new Currency((int) $order->id_currency); $order_slip = new OrderSlip(); $order_slip->id_customer = (int) $order->id_customer; $order_slip->id_order = (int) $order->id; $order_slip->conversion_rate = $currency->conversion_rate; if ($add_tax) { $add_or_remove = 'add'; $inc_or_ex_1 = 'excl'; $inc_or_ex_2 = 'incl'; } else { $add_or_remove = 'remove'; $inc_or_ex_1 = 'incl'; $inc_or_ex_2 = 'excl'; } $order_slip->{'total_shipping_tax_' . $inc_or_ex_1} = 0; $order_slip->{'total_shipping_tax_' . $inc_or_ex_2} = 0; $order_slip->partial = 0; if ($shipping_cost !== false) { $order_slip->shipping_cost = true; $carrier = new Carrier((int) $order->id_carrier); $address = Address::initialize($order->id_address_delivery, false); $tax_calculator = $carrier->getTaxCalculator($address); $order_slip->{'total_shipping_tax_' . $inc_or_ex_1} = $shipping_cost === null ? $order->{'total_shipping_tax_' . $inc_or_ex_1} : (double) $shipping_cost; if ($tax_calculator instanceof TaxCalculator) { $order_slip->{'total_shipping_tax_' . $inc_or_ex_2} = Tools::ps_round($tax_calculator->{$add_or_remove . 'Taxes'}($order_slip->{'total_shipping_tax_' . $inc_or_ex_1}), _PS_PRICE_COMPUTE_PRECISION_); } else { $order_slip->{'total_shipping_tax_' . $inc_or_ex_2} = $order_slip->{'total_shipping_tax_' . $inc_or_ex_1}; } } else { $order_slip->shipping_cost = false; } $order_slip->amount = 0; $order_slip->{'total_products_tax_' . $inc_or_ex_1} = 0; $order_slip->{'total_products_tax_' . $inc_or_ex_2} = 0; foreach ($product_list as &$product) { $order_detail = new OrderDetail((int) $product['id_order_detail']); $price = (double) $product['unit_price']; $quantity = (int) $product['quantity']; $order_slip_resume = OrderSlip::getProductSlipResume((int) $order_detail->id); if ($quantity + $order_slip_resume['product_quantity'] > $order_detail->product_quantity) { $quantity = $order_detail->product_quantity - $order_slip_resume['product_quantity']; } if ($quantity == 0) { continue; } if (!Tools::isSubmit('cancelProduct') && $order->hasBeenPaid()) { $order_detail->product_quantity_refunded += $quantity; } $order_detail->save(); $address = Address::initialize($order->id_address_invoice, false); $id_address = (int) $address->id; $id_tax_rules_group = Product::getIdTaxRulesGroupByIdProduct((int) $order_detail->product_id); $tax_calculator = TaxManagerFactory::getManager($address, $id_tax_rules_group)->getTaxCalculator(); $order_slip->{'total_products_tax_' . $inc_or_ex_1} += $price * $quantity; if (in_array(Configuration::get('PS_ROUND_TYPE'), array(Order::ROUND_ITEM, Order::ROUND_LINE))) { if (!isset($total_products[$id_tax_rules_group])) { $total_products[$id_tax_rules_group] = 0; } } else { if (!isset($total_products[$id_tax_rules_group . '_' . $id_address])) { $total_products[$id_tax_rules_group . '_' . $id_address] = 0; } } $product_tax_incl_line = Tools::ps_round($tax_calculator->{$add_or_remove . 'Taxes'}($price) * $quantity, _PS_PRICE_COMPUTE_PRECISION_); switch (Configuration::get('PS_ROUND_TYPE')) { case Order::ROUND_ITEM: $product_tax_incl = Tools::ps_round($tax_calculator->{$add_or_remove . 'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_) * $quantity; $total_products[$id_tax_rules_group] += $product_tax_incl; break; case Order::ROUND_LINE: $product_tax_incl = $product_tax_incl_line; $total_products[$id_tax_rules_group] += $product_tax_incl; break; case Order::ROUND_TOTAL: $product_tax_incl = $product_tax_incl_line; $total_products[$id_tax_rules_group . '_' . $id_address] += $price * $quantity; break; } $product['unit_price_tax_' . $inc_or_ex_1] = $price; $product['unit_price_tax_' . $inc_or_ex_2] = Tools::ps_round($tax_calculator->{$add_or_remove . 'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_); $product['total_price_tax_' . $inc_or_ex_1] = Tools::ps_round($price * $quantity, _PS_PRICE_COMPUTE_PRECISION_); $product['total_price_tax_' . $inc_or_ex_2] = Tools::ps_round($product_tax_incl, _PS_PRICE_COMPUTE_PRECISION_); } unset($product); foreach ($total_products as $key => $price) { if (Configuration::get('PS_ROUND_TYPE') == Order::ROUND_TOTAL) { $tmp = explode('_', $key); $address = Address::initialize((int) $tmp[1], true); $tax_calculator = TaxManagerFactory::getManager($address, $tmp[0])->getTaxCalculator(); $order_slip->{'total_products_tax_' . $inc_or_ex_2} += Tools::ps_round($tax_calculator->{$add_or_remove . 'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_); } else { $order_slip->{'total_products_tax_' . $inc_or_ex_2} += $price; } } $order_slip->{'total_products_tax_' . $inc_or_ex_2} -= (double) $amount && !$amount_choosen ? (double) $amount : 0; $order_slip->amount = $amount_choosen ? (double) $amount : $order_slip->{'total_products_tax_' . $inc_or_ex_1}; $order_slip->shipping_cost_amount = $order_slip->{'total_shipping_tax_' . $inc_or_ex_1}; if ((double) $amount && !$amount_choosen) { $order_slip->order_slip_type = 1; } if ((double) $amount && $amount_choosen || $order_slip->shipping_cost_amount > 0) { $order_slip->order_slip_type = 2; } if (!$order_slip->add()) { return false; } $res = true; foreach ($product_list as $product) { $res &= $order_slip->addProductOrderSlip($product); } return $res; }
/** * finds the order evaluation * display the right tpl * * @param array $params * @return boolean */ public function hookAdminOrder($params) { //gets the actual certissim order state $sql_order = "SELECT s.`label`\n\t\t\tFROM `" . _DB_PREFIX_ . self::CERTISSIM_STATE_TABLE_NAME . "` s\n\t\t\tINNER JOIN `" . _DB_PREFIX_ . self::CERTISSIM_ORDER_TABLE_NAME . "` o\n\t\t\tON o.`id_certissim_state` = s.`id_certissim_state`\n\t\t\tWHERE o.`id_order`=" . $params['id_order']; $order_label = Db::getInstance()->getValue($sql_order); CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Order label : {$order_label}"); //builds the Order object $order = new Order($params['id_order']); if (_PS_VERSION_ >= "1.5" && Shop::isFeatureActive()) { $shop_id = $order->id_shop; } else { $shop_id = null; } //initialization of Certissim service $sac = new CertissimSac($shop_id); //actions depending on the certissim order state switch ($order_label) { //if order has been sent: loads the template 'sent' case 'sent': //sets the tpl name $template_name = "sent"; //defines the URL for the action that will allow user to checkout the score of the order if (_PS_VERSION_ < '1.5') { $url_update = 'index.php?tab=AdminCertissim&action=checkoutScore&id_order=' . $params['id_order'] . '&token=' . Tools::getAdminTokenLite('AdminCertissim'); } else { $url_update = $this->context->link->getAdminLink('AdminCertissim') . "&id_order=" . $params['id_order'] . "&action=checkoutScore"; } //assign the URL previously defined $this->smarty->assign('url_get_eval', $url_update); break; //if order has already been scored: loads the template 'scored' //if order has already been scored: loads the template 'scored' case 'scored': $template_name = $this->loadScoredTemplate($params['id_order'], $sac); break; //if the analysis returned an error: loads the error template //if the analysis returned an error: loads the error template case 'error': $template_name = $this->loadErrorTemplate($params['id_order'], $sac); break; //if the order is ready to be sent: loads the template 'ready-to-send' //if the order is ready to be sent: loads the template 'ready-to-send' case 'ready to send': $template_name = 'ready-to-send'; break; //if the order is not concerned: loads the template 'not-concerned' //if the order is not concerned: loads the template 'not-concerned' case 'not concerned': $template_name = 'not-concerned'; //checks the payment status of the order $order = new Order($params['id_order']); if (version_compare(_PS_VERSION_, '1.5', '<')) { $paid = $order->hasBeenPaid(); } else { $paid = $order->getCurrentOrderState()->paid; } $this->smarty->assign('paid', $paid); //if the order has been paid, the template contains a link allowing admin user to send the order to Certissim if ($paid) { //defines the URL of the action that sends the order to Certissim if (_PS_VERSION_ < '1.5') { $url_send_order = 'index.php?tab=AdminCertissim&action=sendOrder&id_order=' . $params['id_order'] . '&token=' . Tools::getAdminTokenLite('AdminCertissim'); } else { $url_send_order = $this->context->link->getAdminLink('AdminCertissim') . "&action=sendOrder&id_order=" . $params['id_order']; } $this->smarty->assign('url_send_order', $url_send_order); //checks if an error occured while sending the order to Certissim $order_array = $this->orderToArray($params['id_order'], array('error')); //if an error has been logged: loads the error message into the tpl if (!is_null($order_array['error']) && $order_array['error'] != '') { $this->smarty->assign('txt', $this->l('An error has been encountered when the order has been sent to Certissim: ') . '\'' . $order_array['error'] . '\' ' . $this->l('Please check your configuration and send this order again.')); } else { $this->smarty->assign('txt', $this->l('The order has been paid with a payment method that is not configured for fraud screening or an error occured.')); } } else { $this->smarty->assign('txt', $this->l('The order has not been paid yet, and the payment method used is not configured for fraud screening.')); } break; //if the certissim state is unknown: end of process //if the certissim state is unknown: end of process default: CertissimLogger::insertLog(__METHOD__ . ' : ' . __LINE__, "Statut '{$order_label}' non reconnu pour la commande " . $params['id_order']); return false; break; } $this->smarty->assign('logo_path', __PS_BASE_URI__ . 'modules/' . $this->name . '/img/certissim_mini.png'); //defines the width of the fieldset according to the PS version if (version_compare(_PS_VERSION_, '1.5', '<')) { return $this->smarty->display(_PS_MODULE_DIR_ . $this->name . '/views/templates/hook/' . $template_name . '.tpl'); } $this->smarty->assign('width', ''); return $this->display(__FILE__, $template_name . '.tpl'); }
public function initToolbar() { if ($this->display == 'view') { $order = new Order((int) Tools::getValue('id_order')); if ($order->hasBeenShipped()) { $type = $this->l('Return products'); } elseif ($order->hasBeenPaid()) { $type = $this->l('Standard refund'); } else { $type = $this->l('Cancel products'); } if (!$order->hasBeenShipped() && !$this->lite_display) { $this->toolbar_btn['new'] = array('short' => 'Create', 'href' => '#', 'desc' => $this->l('Add a product'), 'class' => 'add_product'); } if (Configuration::get('PS_ORDER_RETURN') && !$this->lite_display) { $this->toolbar_btn['standard_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $type, 'class' => 'process-icon-standardRefund'); } if ($order->hasInvoice() && !$this->lite_display) { $this->toolbar_btn['partial_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $this->l('Partial refund'), 'class' => 'process-icon-partialRefund'); } } $res = parent::initToolbar(); if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->toolbar_btn['new']) && Shop::isFeatureActive()) { unset($this->toolbar_btn['new']); } return $res; }
/** * @global object $cookie Employee cookie necessary to keep trace of his/her actions */ public function postProcess() { global $currentIndex, $cookie; /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') and $id_order = intval(Tools::getValue('id_order')) and Validate::isLoadedObject($order = new Order($id_order))) { if ($this->tabAccess['edit'] === '1') { if (!$order->hasBeenShipped()) { die(Tools::displayError('The shipping number can only be set once the order has been shipped!')); } $_GET['view' . $this->table] = true; if (!($shipping_number = pSQL(Tools::getValue('shipping_number')))) { $this->_errors[] = Tools::displayError('Invalid new order status!'); } else { global $_LANGMAIL; $order->shipping_number = $shipping_number; $order->update(); $customer = new Customer(intval($order->id_customer)); $carrier = new Carrier(intval($order->id_carrier)); if (!Validate::isLoadedObject($customer) or !Validate::isLoadedObject($carrier)) { die(Tools::displayError()); } $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => intval($order->id)); $subject = 'Package in transit'; Mail::Send(intval($order->id_lang), 'in_transit', (is_array($_LANGMAIL) and key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject, $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname); } } else { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } } elseif (Tools::isSubmit('submitState') and $id_order = intval(Tools::getValue('id_order')) and Validate::isLoadedObject($order = new Order($id_order))) { if ($this->tabAccess['edit'] === '1') { $_GET['view' . $this->table] = true; if (!($newOrderStatusId = intval(Tools::getValue('id_order_state')))) { $this->_errors[] = Tools::displayError('Invalid new order status!'); } else { $history = new OrderHistory(); $history->id_order = $id_order; $history->changeIdOrderState(intval($newOrderStatusId), intval($id_order)); $history->id_employee = intval($cookie->id_employee); $carrier = new Carrier(intval($order->id_carrier), intval($order->id_lang)); $templateVars = array('{followup}' => ($history->id_order_state == _PS_OS_SHIPPING_ and $order->shipping_number) ? str_replace('@', $order->shipping_number, $carrier->url) : ''); if ($history->addWithemail(true, $templateVars)) { Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('an error occurred while changing status or was unable to send e-mail to the customer'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } } elseif (isset($_POST['submitMessage'])) { $_GET['view' . $this->table] = true; if ($this->tabAccess['edit'] === '1') { if (!($id_order = intval(Tools::getValue('id_order'))) or !($id_customer = intval(Tools::getValue('id_customer')))) { $this->_errors[] = Tools::displayError('an error occurred before sending message'); } elseif (!Tools::getValue('message')) { $this->_errors[] = Tools::displayError('message cannot be blank'); } else { /* Get message rules and and check fields validity */ $rules = call_user_func(array('Message', 'getValidationRules'), 'Message'); foreach ($rules['required'] as $field) { if (($value = Tools::getValue($field)) == false and (string) $value != '0') { if (!Tools::getValue('id_' . $this->table) or $field != 'passwd') { $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is required'); } } } foreach ($rules['size'] as $field => $maxLength) { if (Tools::getValue($field) and Tools::strlen(Tools::getValue($field)) > $maxLength) { $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is too long') . ' (' . $maxLength . ' ' . Tools::displayError('chars max') . ')'; } } foreach ($rules['validate'] as $field => $function) { if (Tools::getValue($field)) { if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8'))) { $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is invalid'); } } } if (!sizeof($this->_errors)) { $message = new Message(); $message->id_employee = intval($cookie->id_employee); $message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8'); $message->id_order = $id_order; $message->private = Tools::getValue('visibility'); if (!$message->add()) { $this->_errors[] = Tools::displayError('an error occurred while sending message'); } elseif ($message->private) { Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder&conf=11' . '&token=' . $this->token); } elseif (Validate::isLoadedObject($customer = new Customer($id_customer))) { $order = new Order(intval($message->id_order)); if (Validate::isLoadedObject($order)) { $title = html_entity_decode($this->l('New message regarding your order') . ' ' . $message->id_order, ENT_NOQUOTES, 'UTF-8'); $varsTpl = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order}' => $message->id_order, '{message}' => Configuration::get('PS_MAIL_TYPE') == 2 ? $message->message : nl2br2($message->message)); if (Mail::Send(intval($order->id_lang), 'order_merchant_comment', $title, $varsTpl, $customer->email, $customer->firstname . ' ' . $customer->lastname)) { Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder&conf=11' . '&token=' . $this->token); } } } $this->_errors[] = Tools::displayError('an error occurred while sending e-mail to the customer'); } } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } elseif (Tools::isSubmit('cancelProduct') and Validate::isLoadedObject($order = new Order(intval(Tools::getValue('id_order'))))) { if ($this->tabAccess['delete'] === '1') { $productList = Tools::getValue('id_order_detail'); $customizationList = Tools::getValue('id_customization'); $qtyList = Tools::getValue('cancelQuantity'); $customizationQtyList = Tools::getValue('cancelCustomizationQuantity'); if ($productList or $customizationList) { if ($productList) { foreach ($productList as $key => $id_order_detail) { $qtyCancelProduct = abs($qtyList[$key]); if (!$qtyCancelProduct) { $this->_errors[] = Tools::displayError('No quantity selected for product.'); } } } if ($customizationList) { foreach ($customizationList as $id_customization => $id_order_detail) { $qtyCancelProduct = abs($customizationQtyList[$id_customization]); if (!$qtyCancelProduct) { $this->_errors[] = Tools::displayError('No quantity selected for product.'); } } } if (!sizeof($this->_errors) and $productList) { foreach ($productList as $key => $id_order_detail) { $qtyCancelProduct = abs($qtyList[$key]); $orderDetail = new OrderDetail(intval($id_order_detail)); // Reinject product if (isset($_POST['reinjectQuantities']) or !$order->hasBeenDelivered() and !$order->hasBeenPaid()) { $reinjectableQuantity = intval($orderDetail->product_quantity_in_stock) - intval($orderDetail->product_quantity_reinjected); $quantityToReinject = $qtyCancelProduct > $reinjectableQuantity ? $reinjectableQuantity : $qtyCancelProduct; if (!Product::reinjectQuantities($orderDetail, $quantityToReinject)) { $this->_errors[] = Tools::displayError('Cannot re-stock product') . ' <span class="bold">' . $orderDetail->product_name . '</span>'; } } // Delete product if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct)) { $this->_errors[] = Tools::displayError('an error occurred during deletion for the product') . ' <span class="bold">' . $orderDetail->product_name . '</span>'; } Module::hookExec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail)); } } if (!sizeof($this->_errors) and $customizationList) { foreach ($customizationList as $id_customization => $id_order_detail) { $orderDetail = new OrderDetail(intval($id_order_detail)); $qtyCancelProduct = abs($customizationQtyList[$id_customization]); if (!$order->deleteCustomization($id_customization, $qtyCancelProduct, $orderDetail)) { $this->_errors[] = Tools::displayError('an error occurred during deletion for the product customization') . ' ' . $id_customization; } } } // E-mail params if ((isset($_POST['generateCreditSlip']) or isset($_POST['generateDiscount'])) and !sizeof($this->_errors)) { $customer = new Customer(intval($order->id_customer)); $params['{lastname}'] = $customer->lastname; $params['{firstname}'] = $customer->firstname; $params['{id_order}'] = $order->id; } // Generate credit slip if (isset($_POST['generateCreditSlip']) and !sizeof($this->_errors)) { if (!OrderSlip::createOrderSlip($order, $productList, $qtyList, isset($_POST['shippingBack']))) { $this->_errors[] = Tools::displayError('Cannot generate credit slip'); } else { Module::hookExec('orderSlip', array('order' => $order, 'productList' => $productList, 'qtyList' => $qtyList)); @Mail::Send(intval($order->id_lang), 'credit_slip', html_entity_decode($this->l('New credit slip regarding your order #') . $order->id, ENT_NOQUOTES, 'UTF-8'), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname); } } // Generate voucher if (isset($_POST['generateDiscount']) and !sizeof($this->_errors)) { if (!($voucher = Discount::createOrderDiscount($order, $productList, $qtyList, $this->l('Credit Slip concerning the order #'), isset($_POST['shippingBack'])))) { $this->_errors[] = Tools::displayError('Cannot generate voucher'); } else { $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false, false); $params['{voucher_num}'] = $voucher->name; @Mail::Send(intval($order->id_lang), 'voucher', html_entity_decode($this->l('New voucher regarding your order #') . $order->id, ENT_NOQUOTES, 'UTF-8'), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname); } } } else { $this->_errors[] = Tools::displayError('No product or quantity selected.'); } // Redirect if no errors if (!sizeof($this->_errors)) { Tools::redirectLink($currentIndex . '&id_order=' . $order->id . '&vieworder&conf=1&token=' . $this->token); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } elseif (isset($_GET['messageReaded'])) { Message::markAsReaded(intval($_GET['messageReaded']), intval($cookie->id_employee)); } parent::postProcess(); }
/** * Override for Prestashop 1.5v */ private function initToolbar15() { if ($this->display == 'view') { $order = new Order((int) Tools::getValue('id_order')); if ($order->hasBeenShipped()) { $type = $this->l('Return products'); } elseif ($order->hasBeenPaid()) { $type = $this->l('Standard refund'); } else { $type = $this->l('Cancel products'); } if (!$order->hasBeenShipped() && !$this->lite_display) { $this->toolbar_btn['new'] = array('short' => 'Create', 'href' => '#', 'desc' => $this->l('Add a product'), 'class' => 'add_product'); } if (Configuration::get('PS_ORDER_RETURN') && !$this->lite_display) { $this->toolbar_btn['standard_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $type, 'class' => 'process-icon-standardRefund'); } if ($order->hasInvoice() && !$this->lite_display) { $this->toolbar_btn['partial_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $this->l('Partial refund'), 'class' => 'process-icon-partialRefund'); } } if (DynamicParcelDistribution::isEnabled('dynamicparceldistribution') && Configuration::get(DynamicParcelDistribution::CONST_PREFIX . 'ALLOW_COURIER_PICKUP')) { $this->toolbar_btn['call_carrier'] = array('short' => 'Create', 'href' => '#', 'desc' => $this->l('Call DPD Carrier'), 'class' => 'process-icon-partialRefund', 'js' => 'showCarrierWindow()'); } if (Configuration::get('MULTISHIPPING_ENABLED')) { $this->bulk_actions['GenerateMultishippingXML'] = array('text' => $this->l('Generuoti XML')); } $res = parent::initToolbar(); if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->toolbar_btn['new']) && Shop::isFeatureActive()) { unset($this->toolbar_btn['new']); } return $res; }