public function installOrderState() { if (Configuration::get('PS_OS_MYMOD_PAYMENT') < 1) { $order_state = new OrderState(); $order_state->send_email = true; $order_state->module_name = $this->name; $order_state->invoice = false; $order_state->color = '#98c3ff'; $order_state->logable = true; $order_state->shipped = false; $order_state->unremovable = false; $order_state->delivery = false; $order_state->hidden = false; $order_state->paid = false; $order_state->deleted = false; $order_state->name = array((int) Configuration::get('PS_LANG_DEFAULT') => pSQL($this->l('MyMod Payment - Awaiting confirmation'))); $order_state->template = array(); foreach (LanguageCore::getLanguages() as $l) { $order_state->template[$l['id_lang']] = 'mymodpayment'; } // We copy the mails templates in mail directory foreach (LanguageCore::getLanguages() as $l) { $module_path = dirname(__FILE__) . '/views/templates/mails/' . $l['iso_code'] . '/'; $application_path = dirname(__FILE__) . '/../../mails/' . $l['iso_code'] . '/'; if (!copy($module_path . 'mymodpayment.txt', $application_path . 'mymodpayment.txt') || !copy($module_path . 'mymodpayment.html', $application_path . 'mymodpayment.html')) { return false; } } if ($order_state->add()) { // We save the order State ID in Configuration database Configuration::updateValue('PS_OS_MYMOD_PAYMENT', $order_state->id); // We copy the module logo in order state logo directory copy(dirname(__FILE__) . '/logo.gif', dirname(__FILE__) . '/../../img/os/' . $order_state->id . '.gif'); copy(dirname(__FILE__) . '/logo.gif', dirname(__FILE__) . '/../../img/tmp/order_state_mini_' . $order_state->id . '.gif'); } else { return false; } } return true; }
public function removeState($statename) { if ($id_state = Configuration::get($statename)) { $state = new OrderState($id_state); $state->delete(); } }
private function _createOrderState() { if (Configuration::get($this->prefix . 'ORDER_STATE_ID') && Configuration::get($this->prefix . 'ORDER_STATE_PART_ID')) { return true; } // Awaiting payment $os = new OrderState(); $os->name = array('1' => 'Awaiting ' . $this->displayName . ' payment', '2' => 'En attente du paiement par ' . $this->displayName, '3' => 'En espera de pago por ' . $this->displayName); $os->invoice = false; $os->color = 'lightblue'; $os->logable = true; if ($os->save()) { Configuration::updateValue($this->prefix . 'ORDER_STATE_ID', $os->id); copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 'os/' . $os->id . '.gif'); } else { return false; } // Partially paid $os1 = new OrderState(); $os1->name = array('1' => 'Partially paid by ' . $this->displayName, '2' => 'Payé partiellement via ' . $this->displayName, '3' => 'Pagado parcialmente con ' . $this->displayName); $os1->invoice = false; $os1->color = 'lightblue'; $os1->logable = true; if ($os1->save()) { Configuration::updateValue($this->prefix . 'ORDER_STATE_PART_ID', $os1->id); copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 'os/' . $os1->id . '.gif'); return true; } return false; }
public function hookAdminStatsModules($params) { global $cookie; $result = Db::getInstance()->getRow(' SELECT COUNT(o.`id_order`) as total FROM `' . _DB_PREFIX_ . 'orders` o WHERE o.`date_add` BETWEEN ' . ModuleGraph::getDateBetween() . ' ' . (intval(Tools::getValue('id_order_state')) ? 'AND (SELECT oh.id_order_state FROM `' . _DB_PREFIX_ . 'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = ' . intval(Tools::getValue('id_order_state')) : '')); $states = OrderState::getOrderStates(intval($cookie->id_lang)); $this->_html = ' <fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post" style="float: right;"> <select name="id_order_state"> <option value="0"' . (!Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $this->l('All') . '</option>'; foreach ($states as $state) { $this->_html .= '<option value="' . $state['id_order_state'] . '"' . ($state['id_order_state'] == Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $state['name'] . '</option>'; } $this->_html .= '</select> <input type="submit" name="submitState" value="' . $this->l('Filter') . '" class="button" /> </form> <p><img src="../img/admin/down.gif" />' . $this->l('This graph represents the carrier distribution for your orders. You can also limit it to one order state.') . '</p> ' . ($result['total'] ? ModuleGraph::engine(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))) : $this->l('No valid orders for this period.')) . ' </fieldset>'; return $this->_html; }
function getDevices() { $devices_obj = new DbQuery(); $devices_obj->select(' mpn.`id`, mpn.`new_order`, mpn.`new_customer`, mpn.`order_statuses`, mpn.`id_shop`, mpn.`app_connection_id`, mpn.`status`, mpn.`device_unique_id`, md.`account_email`, md.`device_name`, md.`last_activity`, c.`iso_code` AS currency_iso '); $devices_obj->from('mobassistantconnector_push_notifications', 'mpn'); $devices_obj->leftJoin('mobassistantconnector_devices', 'md', 'md.`device_unique_id` = mpn.`device_unique_id`'); $devices_obj->leftJoin('currency', 'c', 'c.`id_currency` = mpn.`currency_code`'); $devices_sql = $devices_obj->build(); $devices = Db::getInstance()->executeS($devices_sql); if (!$devices) { $devices = array(); } $devices = replaceNull($devices); $statuses_db = OrderState::getOrderStates(Configuration::get('PS_LANG_DEFAULT')); $count_statuses = count($statuses_db); $statuses = array(); for ($i = 0; $i < $count_statuses; $i++) { $statuses[$statuses_db[$i]['id_order_state']] = $statuses_db[$i]['name']; } $devices = formDevices($devices, $statuses); return Tools::jsonEncode($devices); }
public function hookAdminStatsModules($params) { $sql = 'SELECT COUNT(o.`id_order`) as total FROM `' . _DB_PREFIX_ . 'orders` o WHERE o.`date_add` BETWEEN ' . ModuleGraph::getDateBetween() . ' ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . ' ' . ((int) Tools::getValue('id_order_state') ? 'AND (SELECT oh.id_order_state FROM `' . _DB_PREFIX_ . 'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = ' . (int) Tools::getValue('id_order_state') : ''); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); $states = OrderState::getOrderStates($this->context->language->id); if (Tools::getValue('export')) { $this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))); } $this->_html = ' <div class="blocStats"><h2 class="icon-' . $this->name . '"><span></span>' . $this->displayName . '</h2> <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" style="float: right;"> <select name="id_order_state"> <option value="0"' . (!Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $this->l('All') . '</option>'; foreach ($states as $state) { $this->_html .= '<option value="' . $state['id_order_state'] . '"' . ($state['id_order_state'] == Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $state['name'] . '</option>'; } $this->_html .= '</select> <input type="submit" name="submitState" value="' . $this->l('Filter') . '" class="button" /> </form> <p><img src="../img/admin/down.gif" />' . $this->l('This graph represents the carrier distribution for your orders. You can also limit it to orders in one state.') . '</p> ' . ($result['total'] ? $this->engine(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))) . '<br /><br /> <a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=language"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a>' : $this->l('No valid orders for this period.')) . ' </div>'; return $this->_html; }
public function initFormByStatus() { $this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses:'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('You can also export orders which have not been charged yet.') . ' (<img src="../img/admin/charged_ko.gif" alt="" />).')), 'submit' => array('title' => $this->l('Generate PDF file by status.'), 'class' => 'button', 'id' => 'submitPrint2')); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT COUNT(o.id_order) as nbOrders, ( SELECT oh.id_order_state FROM ' . _DB_PREFIX_ . 'order_history oh WHERE oh.id_order = oi.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1 ) id_order_state FROM ' . _DB_PREFIX_ . 'order_invoice oi LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (oi.id_order = o.id_order) WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ') GROUP BY id_order_state '); $status_stats = array(); foreach ($result as $row) { $status_stats[$row['id_order_state']] = $row['nbOrders']; } $this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => ''); $this->table = 'invoice_status'; $this->show_toolbar = false; return parent::renderForm(); }
public function postProcess() { ${"GLOBALS"}["blpimnned"] = "id_order_seller"; $dbodbxes = "id_order"; ${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order"); if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) { Tools::redirect("index.php?controller=authentication&back=my-account"); } ${"GLOBALS"}["tvasln"] = "id_order"; $jpdhpfqcj = "id_order"; if (!(int) Configuration::get("PS_INVOICE")) { die(Tools::displayError("Invoices are disabled in this shop.")); } if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) { ${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj}); } if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) { die(Tools::displayError("Invoice not found")); } ${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]}); ${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id); if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) { die(Tools::displayError("You do not have permission to see this invoice")); } if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) { die(Tools::displayError("You do not have permission to see this invoice")); } if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) { die(Tools::displayError("No invoice available")); } $this->order = ${${"GLOBALS"}["ymjzko"]}; }
public function displaySettings($post_action) { $curr_order_state = new OrderState((int) $this->mondialrelay->account_shop['MR_ORDER_STATE']); $order_state = array('id_order_state' => $this->mondialrelay->account_shop['MR_ORDER_STATE'], 'name' => $curr_order_state->name[$this->context->language->id]); $this->context->smarty->assign(array('MR_token_admin_mondialrelay' => Tools::getAdminToken('AdminMondialRelay' . (int) Tab::getIdFromClassName('AdminMondialRelay') . (int) $this->context->employee->id), 'MR_account_set' => MondialRelay::isAccountSet(), 'MR_order_state' => $order_state, 'MR_orders_states_list' => OrderState::getOrderStates($this->context->language->id), 'MR_form_action' => $post_action, 'MR_error_list' => $this->post_errors)); echo $this->mondialrelay->fetchTemplate('/tpl/admintab/', 'settings'); }
public function setPaytmOrderState($var_name, $status, $color) { $orderState = new OrderState(); $orderState->name = array(); foreach (Language::getLanguages() as $language) { $orderState->name[$language['id_lang']] = $status; } $orderState->send_email = false; $orderState->color = $color; $orderState->hidden = false; $orderState->delivery = false; $orderState->logable = true; $orderState->invoice = true; if ($orderState->add()) { Configuration::updateValue($var_name, (int) $orderState->id); } return true; }
public function install() { if (version_compare(_PS_VERSION_, '1.5', '<')) { if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn') || !$this->registerHook('orderDetailDisplayed') || !$this->registerHook('adminOrder') || !Configuration::updateValue('SEUR_REMCAR_TIPO_CARGO', 1) || !Configuration::updateValue('SEUR_REMCAR_CARGO_MIN', 0) || !Configuration::updateValue('SEUR_REMCAR_MIN_MOSTRAR', 100)) { return false; } } else { if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn') || !Configuration::updateValue('SEUR_REMCAR_TIPO_CARGO', 1) || !$this->registerHook('displayPDFInvoice') || !$this->registerHook('displayOrderDetail') || !$this->registerHook('displayAdminOrder')) { return false; } } if (!class_exists('SeurLib')) { $this->warning = $this->l('Still has not configured their SEUR module.'); return false; } if (version_compare(_PS_VERSION_, "1.5", ">=") && !Configuration::get('REEMBOLSO_OS_CARGO')) { $orderState = new OrderState(); $orderState->name = array(); foreach (Language::getLanguages() as $language) { if (Tools::strtolower($language['iso_code']) == 'fr') { $orderState->name[$language['id_lang']] = 'SEUR Paiement de la restitution'; } elseif (Tools::strtolower($language['iso_code']) == 'en') { $orderState->name[$language['id_lang']] = 'SEUR Refund payment'; } else { $orderState->name[$language['id_lang']] = 'SEUR Pago reembolso'; } } $orderState->send_email = false; $orderState->color = '#7FA0D3'; $orderState->hidden = false; $orderState->delivery = false; $orderState->logable = true; $orderState->invoice = true; $orderState->paid = false; $orderState->module_name = 'seurcashondelivery'; $orderState->unremovable = true; $orderState->template = 'order_conf'; if ($orderState->add()) { copy(dirname(__FILE__) . '/img/reembolsoestado.gif', _PS_ROOT_DIR_ . '/img/os/' . (int) $orderState->id . '.gif'); } Configuration::updateValue('REEMBOLSO_OS_CARGO', (int) $orderState->id); } $id_modulo = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name="' . pSQL($this->name) . '"'); Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'module_country` WHERE id_module =' . (int) $id_modulo); Db::getInstance()->Execute(' INSERT INTO `' . _DB_PREFIX_ . 'module_country` (id_module, id_country) VALUES (' . (int) $id_modulo . ',' . (int) Country::getByIso("ES") . '), (' . (int) $id_modulo . ',' . (int) Country::getByIso("PT") . '), (' . (int) $id_modulo . ',' . (int) Country::getByIso("AD") . '); '); return true; }
public static function getUrlToInvoice($order, $context) { $url_to_invoice = ''; if ((bool) Configuration::get('PS_INVOICE') && OrderState::invoiceAvailable($order->current_state) && count($order->getInvoicesCollection())) { $url_to_invoice = $context->link->getPageLink('pdf-invoice', true, null, 'id_order=' . $order->id); if ($context->cookie->is_guest) { $url_to_invoice .= '&secure_key=' . $order->secure_key; } } return $url_to_invoice; }
public function process() { parent::process(); if ($id_order = Tools::getValue('id_order') and $email = Tools::getValue('email')) { $order = new Order((int) $id_order); if (!Validate::isLoadedObject($order)) { $this->errors[] = Tools::displayError('Invalid order'); } elseif (!$order->isAssociatedAtGuest($email)) { $this->errors[] = Tools::displayError('Invalid order'); } else { $customer = new Customer((int) $order->id_customer); $id_order_state = (int) $order->getCurrentState(); $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang); $addressInvoice = new Address((int) $order->id_address_invoice); $addressDelivery = new Address((int) $order->id_address_delivery); $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields); $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields); if ($order->total_discounts > 0) { self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts)); } $products = $order->getProducts(); $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart); Product::addCustomizationPrice($products, $customizedDatas); $this->processAddressFormat($addressDelivery, $addressInvoice); self::$smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order' => $order, 'return_allowed' => false, 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'customizedDatas' => $customizedDatas, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues)); if ($carrier->url and $order->shipping_number) { self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); } self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order))); Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order)); if (Tools::isSubmit('submitTransformGuestToCustomer')) { $customer = new Customer((int) $order->id_customer); if (!Validate::isLoadedObject($customer)) { $this->errors[] = Tools::displayError('Invalid customer'); } if (!$customer->transformToCustomer(self::$cookie->id_lang, Tools::getValue('password'))) { $this->errors[] = Tools::displayError('An error occurred while transforming guest to customer.'); } if (!Tools::getValue('password')) { $this->errors[] = Tools::displayError('Invalid password'); } else { self::$smarty->assign('transformSuccess', true); } } } if (sizeof($this->errors)) { /* Handle brute force attacks */ sleep(1); } } self::$smarty->assign(array('action' => 'guest-tracking.php', 'errors' => $this->errors)); }
public function postProcess() { global $cookie; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if ($this->tabAccess['add'] === '1' and Tools::isSubmit('submitAdd' . $this->table)) { $this->deleted = false; $_POST['invoice'] = Tools::getValue('invoice', 0); $_POST['delivery'] = Tools::getValue('delivery', 0); $_POST['logable'] = Tools::getValue('logable', 0); $_POST['send_email'] = Tools::getValue('send_email', 0); $_POST['hidden'] = Tools::getValue('hidden', 0); if (!$_POST['send_email']) { $languages = Language::getLanguages(false); foreach ($languages as $language) { $_POST['template_' . (int) $language['id_lang']] = ''; } } parent::postProcess(); } elseif ($this->tabAccess['delete'] === '1' and isset($_GET['delete' . $this->table])) { $orderState = new OrderState((int) $_GET['id_order_state'], $cookie->id_lang); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); } else { parent::postProcess(); } } elseif ($this->tabAccess['delete'] === '1' and isset($_POST['submitDelorder_state'])) { foreach ($_POST[$this->table . 'Box'] as $selection) { $orderState = new OrderState((int) $selection, $cookie->id_lang); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); break; } } if (empty($this->_errors)) { parent::postProcess(); } } else { parent::postProcess(); } }
/** * Prestashop install */ public function install() { $pendingStatus = Configuration::get('MTGOX_PENDING_STATE_ID'); if ($pendingStatus === false) { $orderState = new OrderState(); $langs = Language::getLanguages(); foreach ($langs as $lang) { $orderState->name[$lang['id_lang']] = pSQL('MtGox payment pending'); } $orderState->invoice = false; $orderState->send_email = false; $orderState->logable = true; $orderState->color = '#FFDD99'; $orderState->save(); Configuration::updateValue('MTGOX_PENDING_STATE_ID', $orderState->id); copy(dirname(__FILE__) . '/logo.gif', dirname(__FILE__) . '/../../img/os/' . (int) $orderState->id . '.gif'); } if (parent::install() == false or !$this->registerHook('payment') or !Configuration::updateValue('MTGOX_MERCHANT_ID', '0') or !Configuration::updateValue('MTGOX_API_KEY', '0') or !Configuration::updateValue('MTGOX_API_SECRET_KEY', '0') or !Configuration::updateValue('MTGOX_PAYMENT_DESCRIPTION', 'MtGox Payment Gateway') or !Configuration::updateValue('MTGOX_EMAIL_ON_SUCCESS', '1') or !Configuration::updateValue('MTGOX_AUTOSELL', '1') or !Configuration::updateValue('MTGOX_INSTANT_ONLY', '0')) { return false; } return true; }
private function createOrderState() { if (!Configuration::get('PS_OS_DEBITNOTE')) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { if (Tools::strtolower($language['iso_code']) == 'fr') { $order_state->name[$language['id_lang']] = 'Paiement par prélèvement automatique'; } elseif (Tools::strtolower($language['iso_code']) == 'de') { $order_state->name[$language['id_lang']] = 'Zahlung per Lastschrift'; } elseif (Tools::strtolower($language['iso_code']) == 'it') { $order_state->name[$language['id_lang']] = 'Il pagamento tramite addebito diretto'; } elseif (Tools::strtolower($language['iso_code']) == 'es') { $order_state->name[$language['id_lang']] = 'El pago mediante domiciliación bancaria'; } elseif (Tools::strtolower($language['iso_code']) == 'br') { $order_state->name[$language['id_lang']] = 'O pagamento por débito directo'; } else { $order_state->name[$language['id_lang']] = 'Payment by direct debit'; } } $order_state->send_email = true; $order_state->color = '#10c8f6'; $order_state->hidden = false; $order_state->delivery = false; $order_state->logable = true; $order_state->invoice = false; $order_state->template = 'debitnote'; if ($order_state->add()) { $source = dirname(__FILE__) . '/logo2.gif'; $destination = dirname(__FILE__) . '/../../img/os/' . (int) $order_state->id . '.gif'; copy($source, $destination); $sourcemail = dirname(__FILE__) . '/mails/'; $destinationmail = dirname(__FILE__) . '/../../mails/'; $this->CopyMailFolder($sourcemail, $destinationmail); } Configuration::updateValue('PS_OS_DEBITNOTE', (int) $order_state->id); } }
public function __construct() { $this->bootstrap = true; $this->table = 'order'; $this->className = 'Order'; $this->lang = false; //$this->addRowAction('view'); $this->explicitSelect = true; $this->allow_export = false; //$this->lite_display=true; $this->deleted = false; $this->context = Context::getContext(); $this->bulk_actions = array('exportU' => array('text' => $this->l('export Ulozenka'), 'icon' => 'icon-refresh')); $this->_select = ' a.id_currency, a.id_order AS id_pdf, cr.iso_code AS currency, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, u.`dobirka`, u.`exported`, u.`id_ulozenka`, u.`pobocka_name`, u.`date_exp`, IF((SELECT COUNT(so.id_order) FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new'; $this->_join = ' LEFT JOIN `' . _DB_PREFIX_ . 'currency` cr ON a.`id_currency` = cr.`id_currency` LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`) LEFT JOIN `' . _DB_PREFIX_ . 'ulozenka` u ON (u.`id_order` = a.`id_order`) LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_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 u.`id_order` > 0'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $statuses_array = array(); $statuses = OrderState::getOrderStates((int) $this->context->language->id); foreach ($statuses as $status) { $statuses_array[$status['id_order_state']] = $status['name']; } $this->fields_list = array('id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'reference' => array('title' => $this->l('Označení'), 'align' => 'center', 'width' => 65), 'id_ulozenka' => array('title' => $this->l('id uloženka'), 'align' => 'center', 'width' => 25), 'customer' => array('title' => $this->l('Zákazník'), 'havingFilter' => true), 'total_paid_tax_incl' => array('title' => $this->l('Celkem'), 'width' => 70, 'align' => 'center', 'prefix' => '<b>', 'suffix' => '</b>', 'type' => 'float'), 'currency' => array('title' => $this->l('Měna'), 'width' => 50, 'prefix' => '<b>', 'suffix' => '</b>', 'align' => 'center', 'filter_key' => 'currency'), 'payment' => array('title' => $this->l('Platba: '), 'width' => 100), 'osname' => array('title' => $this->l('Stav'), 'color' => 'color', 'width' => 100, 'type' => 'select', 'list' => $statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'order_key' => 'osname'), 'pobocka_name' => array('title' => $this->l('Pobočka'), 'width' => 150, 'align' => 'right', 'filter_key' => 'pobocka_name'), 'date_add' => array('title' => $this->l('Datum objednávky'), 'width' => 130, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), 'date_exp' => array('title' => $this->l('Datum exportu'), 'width' => 130, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'date_exp'), 'exported' => array('title' => $this->l('Exportováno'), 'width' => 70, 'align' => 'center', 'type' => 'bool', 'active' => 'exported', 'filter_key' => 'exported'), 'dobirka' => array('title' => $this->l('Dobírka'), 'width' => 70, 'align' => 'center', 'type' => 'bool', 'active' => 'dobirka', 'filter_key' => 'dobirka')); $this->shopLinkType = 'shop'; $this->shopShareDatas = Shop::SHARE_ORDER; if (Tools::isSubmit('id_order')) { // Save context (in order to apply cart rule) $order = new Order((int) Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) { throw new PrestaShopException('Cannot load Order object'); } $this->context->cart = new Cart($order->id_cart); $this->context->customer = new Customer($order->id_customer); } parent::__construct(); }
public function install() { Db::getInstance()->Execute(' CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'rnp_categories` ( `id_category` int(10) unsigned NOT NULL auto_increment, `id_rnp` int(10) NOT NULL, PRIMARY KEY (`id_category`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8'); Db::getInstance()->Execute(' CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'sac_carriers` ( `id_carrier` int(11) NOT NULL, `id_sac_carrier` int(11) NOT NULL, PRIMARY KEY `id_carrier` (`id_carrier`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8'); if (!Configuration::get('RNP_NBDELIVERYDAYS')) { Configuration::updateValue('RNP_NBDELIVERYDAYS', 7); } if (!Configuration::get('RNP_TYPE_DISPLAY')) { Configuration::updateValue('RNP_TYPE_DISPLAY', 1); } if (!parent::install() or !$this->registerHook('payment') or !$this->registerHook('paymentReturn') or !$this->registerHook('adminOrder') or !$this->registerHook('rightColumn')) { return false; } $orderState = new OrderState(); $langs = Language::getLanguages(); foreach ($langs as $lang) { $orderState->name[$lang['id_lang']] = 'Waiting FIA-NET validation'; } $orderState->name[2] = 'Attente FIA-NET validation'; $orderState->invoice = false; $orderState->send_email = false; $orderState->logable = false; $orderState->color = '#3333FF'; $orderState->save(); Configuration::updateValue('RNP_ID_ORDERSTATE', intval($orderState->id)); return true; }
public function hookAdminStatsModules($params) { $sql = 'SELECT COUNT(o.`id_order`) as total FROM `' . _DB_PREFIX_ . 'orders` o WHERE o.`date_add` BETWEEN ' . ModuleGraph::getDateBetween() . ' ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . ' ' . ((int) Tools::getValue('id_order_state') ? 'AND (SELECT oh.id_order_state FROM `' . _DB_PREFIX_ . 'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = ' . (int) Tools::getValue('id_order_state') : ''); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); $states = OrderState::getOrderStates($this->context->language->id); if (Tools::getValue('export')) { $this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))); } $this->html = ' <div class="panel-heading"> ' . $this->displayName . ' </div> <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" class="form-horizontal alert"> <div class="row"> <div class="col-lg-5 col-lg-offset-6"> <select name="id_order_state"> <option value="0"' . (!Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $this->l('All') . '</option>'; foreach ($states as $state) { $this->html .= '<option value="' . $state['id_order_state'] . '"' . ($state['id_order_state'] == Tools::getValue('id_order_state') ? ' selected="selected"' : '') . '>' . $state['name'] . '</option>'; } $this->html .= '</select> </div> <div class="col-lg-1"> <input type="submit" name="submitState" value="' . $this->l('Filter') . '" class="btn btn-default pull-right" /> </div> </div> </form> <div class="alert alert-info"> ' . $this->l('This graph represents the carrier distribution for your orders. You can also narrow the focus of the graph to display distribution for a particular order status.') . ' </div> <div class="row row-margin-bottom"> <div class="col-lg-12"> <div class="col-lg-8"> ' . ($result['total'] ? $this->engine(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))) . ' </div> <div class="col-lg-4"> <a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=language" class="btn btn-default"> <i class="icon-cloud-upload"></i> ' . $this->l('CSV Export') . ' </a>' : $this->l('No valid orders have been received for this period.')) . ' </div> </div> </div>'; return $this->html; }
public function postProcess() { if (Tools::isSubmit('submitAdd' . $this->table)) { $_POST['invoice'] = Tools::getValue('invoice'); $_POST['logable'] = Tools::getValue('logable'); $_POST['send_email'] = Tools::getValue('send_email'); $_POST['hidden'] = Tools::getValue('hidden'); if (!$_POST['send_email']) { $languages = Language::getLanguages(); foreach ($languages as $language) { $_POST['template_' . $language['id_lang']] = ''; } } parent::postProcess(); } elseif (isset($_GET['delete' . $this->table])) { $orderState = new OrderState(intval($_GET['id_order_state'])); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); } else { parent::postProcess(); } } elseif (isset($_POST['submitDelorder_state'])) { foreach ($_POST[$this->table . 'Box'] as $selection) { $orderState = new OrderState(intval($selection)); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); break; } } if (empty($this->_errors)) { parent::postProcess(); } } else { parent::postProcess(); } }
public function getFormYaPokupki() { $state = OrderState::getOrderStates(Context::getContext()->language->id); $dir = _PS_ADMIN_DIR_; $dir = explode('/', $dir); $dir = base64_encode(end($dir) . '_' . Context::getContext()->cookie->id_employee . '_pokupki'); $extend = array(); $carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, null, 5); $type = array(array('name' => 'POST', 'id' => 'POST'), array('name' => 'PICKUP', 'id' => 'PICKUP'), array('name' => 'DELIVERY', 'id' => 'DELIVERY')); $out = array('form' => array('legend' => array('title' => $this->l('Настройки модуля Заказы на маркете'), 'icon' => 'icon-cogs'), 'input' => array(array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Токен для доступа к API Яндекс.Маркет'), 'name' => 'YA_POKUPKI_TOKEN', 'label' => $this->l('Авторизационный токен Яндекс.Маркет')), array('type' => 'checkbox', 'label' => $this->l('Предоплата'), 'name' => 'YA_POKUPKI_PREDOPLATA', 'values' => array('query' => array(array('id' => 'YANDEX', 'name' => $this->l('Оплата при оформлении (только в России)'), 'val' => 1), array('id' => 'SHOP_PREPAID', 'name' => $this->l('Напрямую магазину (только для Украины)'), 'val' => 1)), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'label' => $this->l('Постоплата'), 'name' => 'YA_POKUPKI_POSTOPLATA', 'values' => array('query' => array(array('id' => 'CASH_ON_DELIVERY', 'name' => $this->l('Наличный расчёт при получении товара'), 'val' => 1), array('id' => 'CARD_ON_DELIVERY', 'name' => $this->l('Оплата банковской картой при получении заказа'), 'val' => 1)), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'label' => $this->l('Настройки'), 'name' => 'YA_POKUPKI_SET', 'values' => array('query' => array(array('id' => 'CHANGEC', 'name' => $this->l('Включить смену доставок'), 'val' => 1)), 'id' => 'id', 'name' => 'name')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Ссылка на https://api.partner.market.yandex.ru/v2/'), 'name' => 'YA_POKUPKI_APIURL', 'label' => $this->l('URL партнёрского API Яндекс.Маркет')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Номер Кампании'), 'name' => 'YA_POKUPKI_NC', 'label' => $this->l('Номер Кампании')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Логин пользователя в системе Яндекс.Маркет'), 'name' => 'YA_POKUPKI_LOGIN', 'label' => $this->l('Логин пользователя в системе Яндекс.Маркет')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('ID приложения'), 'name' => 'YA_POKUPKI_ID', 'label' => $this->l('ID приложения')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Пароль приложениюж'), 'name' => 'YA_POKUPKI_PW', 'label' => $this->l('Пароль приложения')), array('col' => 4, 'class' => 't', 'type' => 'text', 'desc' => '<a href="https://oauth.yandex.ru/authorize?response_type=code&display=popup&state=' . $dir . '&client_id=' . Configuration::get('YA_POKUPKI_ID') . "&device_id=" . md5(Configuration::get('YA_POKUPKI_ID')) . '">' . $this->l('Получить токен для доступа к Yandex.Покупки') . '</a>', 'name' => 'YA_POKUPKI_YATOKEN', 'label' => $this->l('Авторизационный токен'), 'disabled' => true), array('col' => 6, 'class' => 't', 'type' => 'text', 'desc' => $this->l('Номер пункта самовывоза'), 'name' => 'YA_POKUPKI_PUNKT', 'label' => $this->l('Идентификатор пункта самовывоза')), array('col' => 6, 'class' => 't', 'type' => 'text', 'name' => 'YA_MARKET_REDIRECT', 'desc' => $this->l('Callback Url для OAuth-приложения'), 'label' => $this->l('Ссылка для приложения')), array('col' => 6, 'class' => 't', 'type' => 'text', 'desc' => $this->l('URL API для заполнения в настройках магазина на Яндекс.Маркет'), 'name' => 'YA_POKUPKI_APISHOP', 'label' => $this->l('Ссылка для обращения к Вашему магазину'))), 'submit' => array('title' => $this->l('Сохранить')))); foreach ($carriers as $a) { $out['form']['input'][] = array('type' => 'select', 'label' => $this->l('Тип доставки') . ' ' . $a['name'], 'name' => 'YA_POKUPKI_DELIVERY_' . $a['id_carrier'], 'desc' => $this->l('POST - Почта, DELIVERY - Курьерская доставка, PICKUP - Самовывоз'), 'options' => array('query' => $type, 'name' => 'name', 'id' => 'id'), 'class' => 't'); } return $out; }
public static function assignOrderStates() { $context = Context::getContext(); $order_states = OrderState::getOrderStates($context->cookie->id_lang); $states_list = array(Configuration::get('PS_OS_BANKWIRE'), Configuration::get('PS_OS_CANCELED'), Configuration::get('PS_OS_CHEQUE'), Configuration::get('PS_OS_ERROR'), Configuration::get('PS_OS_OUTOFSTOCK'), Configuration::get('PS_OS_PAYPAL'), Configuration::get('PS_OS_REFUND'), Configuration::get('PS_OS_SYSPAY'), Configuration::get('PS_OS_SYSPAY_AUTHORIZED'), Configuration::get('PS_OS_SYSPAY_CB'), Configuration::get('PAYPAL_OS_AUTHORIZATION'), Configuration::get('PS_OS_WS_PAYMENT')); $states = array(); foreach ($order_states as $os) { if (!in_array($os['id_order_state'], $states_list)) { $states[] = $os; } } if ($states) { $context->smarty->assign('states', $states); } }
function getContent() { // Loading config currency $config_currency = new Currency((int) $this->ebay_profile->getConfiguration('EBAY_CURRENCY')); $url_vars = array('id_tab' => '1', 'section' => 'parameters'); if (version_compare(_PS_VERSION_, '1.5', '>')) { $url_vars['controller'] = Tools::getValue('controller'); } else { $url_vars['tab'] = Tools::getValue('tab'); } $url = $this->_getUrl($url_vars); $ebayShop = $this->ebay_profile->getConfiguration('EBAY_SHOP') ? $this->ebay_profile->getConfiguration('EBAY_SHOP') : $this->ebay->StoreName; $ebayShopValue = Tools::getValue('ebay_shop', $ebayShop); $ebay_country = EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')); $createShopUrl = 'http://cgi3.ebay.' . $ebay_country->getSiteExtension() . '/ws/eBayISAPI.dll?CreateProductSubscription&&productId=3&guest=1'; $ebay_request = new EbayRequest(); $ebay_sign_in_url = $ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $this->context->cookie->eBaySession; $returns_policy_configuration = $this->ebay_profile->getReturnsPolicyConfiguration(); $returnsConditionAccepted = Tools::getValue('ebay_returns_accepted_option', Configuration::get('EBAY_RETURNS_ACCEPTED_OPTION')); $ebay_paypal_email = Tools::getValue('ebay_paypal_email', $this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')); $shopPostalCode = Tools::getValue('ebay_shop_postalcode', $this->ebay_profile->getConfiguration('EBAY_SHOP_POSTALCODE')); $shopCountry = Tools::getValue('ebay_shop_country', $this->ebay_profile->getConfiguration('EBAY_SHOP_COUNTRY')); $ebayListingDuration = $this->ebay_profile->getConfiguration('EBAY_LISTING_DURATION') ? $this->ebay_profile->getConfiguration('EBAY_LISTING_DURATION') : 'GTC'; $user_profile = $ebay_request->getUserProfile($this->ebay_profile->ebay_user_identifier); $is_multishop = version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive(); $order_states = OrderState::getOrderStates($this->ebay_profile->id_lang); $current_order_state = $this->ebay_profile->getConfiguration('EBAY_SHIPPED_ORDER_STATE'); if ($current_order_state === null) { foreach ($order_states as $order_state) { if ($order_state['template'] === 'shipped') { // NDRArbuz: is this the best way to find it with no doubt? $current_order_state = $order_state['id_order_state']; break; } } } $smarty_vars = array('url' => $url, 'ebay_sign_in_url' => $ebay_sign_in_url, 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), 'configCurrencysign' => $config_currency->sign, 'policies' => EbayReturnsPolicy::getReturnsPolicies(), 'catLoaded' => !Configuration::get('EBAY_CATEGORY_LOADED_' . $this->ebay_profile->ebay_site_id), 'createShopUrl' => $createShopUrl, 'ebayCountry' => EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')), 'ebayReturns' => preg_replace('#<br\\s*?/?>#i', "\n", $this->ebay_profile->getReturnsPolicyConfiguration()->ebay_returns_description), 'ebayShopValue' => $ebayShopValue, 'shopPostalCode' => Tools::getValue('ebay_shop_postalcode', $this->ebay_profile->getConfiguration('EBAY_SHOP_POSTALCODE')), 'listingDurations' => $this->_getListingDurations(), 'ebayShop' => $this->ebay_profile->getConfiguration('EBAY_SHOP'), 'ebay_paypal_email' => Tools::getValue('ebay_paypal_email', $this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')), 'returnsConditionAccepted' => Tools::getValue('ebay_returns_accepted_option', $returns_policy_configuration->ebay_returns_accepted_option), 'automaticallyRelist' => $this->ebay_profile->getConfiguration('EBAY_AUTOMATICALLY_RELIST'), 'ebay_paypal_email' => $ebay_paypal_email, 'returnsConditionAccepted' => $returnsConditionAccepted, 'ebayListingDuration' => $ebayListingDuration, 'automaticallyRelist' => Configuration::get('EBAY_AUTOMATICALLY_RELIST'), 'is_multishop' => $is_multishop, 'within_values' => unserialize(Configuration::get('EBAY_RETURNS_WITHIN_VALUES')), 'within' => $returns_policy_configuration->ebay_returns_within, 'whopays_values' => unserialize(Configuration::get('EBAY_RETURNS_WHO_PAYS_VALUES')), 'whopays' => $returns_policy_configuration->ebay_returns_who_pays, 'activate_mails' => Configuration::get('EBAY_ACTIVATE_MAILS'), 'hasEbayBoutique' => isset($user_profile['StoreUrl']) && !empty($user_profile['StoreUrl']) ? true : false, 'currencies' => TotCompatibility::getCurrenciesByIdShop($this->ebay_profile->id_shop), 'current_currency' => (int) $this->ebay_profile->getConfiguration('EBAY_CURRENCY'), 'ebay_shop_countries' => EbayCountrySpec::getCountries(false), 'current_ebay_shop_country' => $shopCountry, 'send_tracking_code' => (bool) $this->ebay_profile->getConfiguration('EBAY_SEND_TRACKING_CODE'), 'order_states' => $order_states, 'current_order_state' => $current_order_state, 'immediate_payment' => (bool) $this->ebay_profile->getConfiguration('EBAY_IMMEDIATE_PAYMENT')); if (Tools::getValue('relogin')) { $this->ebay->login(); $smarty_vars = array_merge($smarty_vars, array('relogin' => true, 'redirect_url' => $ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $this->context->cookie->eBaySession)); } else { $smarty_vars['relogin'] = false; } if (Tools::getValue('action') == 'regenerate_token') { $smarty_vars['check_token_tpl'] = $this->ebay->_displayCheckToken(); } return $this->display('formParameters.tpl', $smarty_vars); }
public function actionSearch() { $model = new Order(); $errorMessage = null; if (isset($_GET['order_id']) && Order::model()->isValidateOrderId($_GET['order_id'])) { $model = $this->loadExistOrder($_GET['order_id']); $model->order_info = OrderState::model()->getStateZnByStateId($model->order_state_id) . $model->remark; //Open when the product model is finished //$model->product_name = Product::model()->getProductNameByProductId($model->product_id); } else { $model->unsetAttributes(); $errorMessage = '订单号不存在!'; } $this->layout = false; $this->render('_customer', array('model' => $model, 'message' => $errorMessage)); }
public function actionCustomer() { $model = new Order(); $errorMessage = null; if (isset($_GET['order_id']) && Order::model()->isValidateOrderId($_GET['order_id'])) { $model = $this->loadExistOrder($_GET['order_id']); $model->order_info = OrderState::model()->getStateZnByStateId($model->order_state_id) . $model->remark; $model->product_name = Product::model()->getProductNameByProductId($model->product_id); $model->order_photos = Photo::model()->findAllByAttributes(array('product_id' => $model->product_id)); } else { $model->unsetAttributes(); $errorMessage = Yii::t('order', 'Order is not exist!'); } $this->layout = false; $this->render('_customer', array('model' => $model, 'message' => $errorMessage)); }
public function getContent() { $html = ''; if (Tools::isSubmit('submitModule')) { Configuration::updateValue('PAYNETZ_API_MERCHANT_URL', Tools::getvalue('api_merchant_url')); Configuration::updateValue('PAYNETZ_API_SERVER_PORT', Tools::getvalue('api_server_port')); Configuration::updateValue('PAYNETZ_API_LOGIN_ID', Tools::getvalue('api_login_id')); Configuration::updateValue('PAYNETZ_API_PASSWORD', Tools::getvalue('api_password')); Configuration::updateValue('PAYNETZ_API_PRODUCT_ID', Tools::getvalue('api_product_id')); $html .= $this->displayConfirmation($this->l('Configuration updated')); } // For "Hold for Review" order status $currencies = Currency::getCurrencies(false, true); $order_states = OrderState::getOrderStates((int) $this->context->cookie->id_lang); $this->context->smarty->assign(array('available_currencies' => $this->aim_available_currencies, 'currencies' => $currencies, 'module_dir' => $this->_path, 'order_states' => $order_states, 'PAYNETZ_API_MERCHANT_URL' => Configuration::get('PAYNETZ_API_MERCHANT_URL'), 'PAYNETZ_API_SERVER_PORT' => Configuration::get('PAYNETZ_API_SERVER_PORT'), 'PAYNETZ_API_LOGIN_ID' => Configuration::get('PAYNETZ_API_LOGIN_ID'), 'PAYNETZ_API_PASSWORD' => Configuration::get('PAYNETZ_API_PASSWORD'), 'PAYNETZ_API_PRODUCT_ID' => Configuration::get('PAYNETZ_API_PRODUCT_ID'))); return $this->context->smarty->fetch($this->local_path . 'views/templates/admin/configuration.tpl'); }
public function __construct() { foreach (Language::getLanguages(false) as $language) { if (strcmp($language["iso_code"], 'br') == 0) { $this->idLang = $language["id_lang"]; } else { if (strcmp($language["iso_code"], 'en') == 0) { $this->idLang = $language["id_lang"]; } } } $order_state = OrderState::getOrderStates($this->idLang); foreach ($order_state as $value) { if (strcmp($value["name"], Util::getStatusCMS(0)) == 0) { $this->idInitiatedState = $value["id_order_state"]; } } }
public function install() { if (!parent::install() || !$this->registerHook('paymentReturn') || !$this->registerHook('paymentOptions')) { return false; } // TODO : Cek insert new state, Custom CSS $newState = new OrderState(); $newState->send_email = true; $newState->module_name = $this->name; $newState->invoice = false; $newState->color = "#002F95"; $newState->unremovable = false; $newState->logable = false; $newState->delivery = false; $newState->hidden = false; $newState->shipped = false; $newState->paid = false; $newState->delete = false; $languages = Language::getLanguages(true); foreach ($languages as $lang) { if ($lang['iso_code'] == 'id') { $newState->name[(int) $lang['id_lang']] = 'Menunggu pembayaran via Bank BNI'; } else { $newState->name[(int) $lang['id_lang']] = 'Awaiting Bank BNI Payment'; } $newState->template = "bankbni"; } if ($newState->add()) { Configuration::updateValue('PS_OS_BANKBNI', $newState->id); copy(dirname(__FILE__) . '/logo.gif', _PS_IMG_DIR_ . 'tmp/order_state_mini_' . (int) $newState->id . '_1.gif'); foreach ($languages as $lang) { if ($lang['iso_code'] == 'id') { copy(dirname(__FILE__) . '/mails/id/bankbni.html', _PS_MAIL_DIR_ . '/' . strtolower($lang['iso_code']) . '/bankbni.html'); copy(dirname(__FILE__) . '/mails/id/bankbni.txt', _PS_MAIL_DIR_ . '/' . strtolower($lang['iso_code']) . '/bankbni.txt'); } else { copy(dirname(__FILE__) . '/mails/en/bankbni.html', _PS_MAIL_DIR_ . '/' . strtolower($lang['iso_code']) . '/bankbni.html'); copy(dirname(__FILE__) . '/mails/en/bankbni.txt', _PS_MAIL_DIR_ . '/' . strtolower($lang['iso_code']) . '/bankbni.txt'); } } } else { return false; } return true; }
public function __construct() { global $cookie; $evgmwedmihr = "statuses_array"; ${"GLOBALS"}["ynkpdchxy"] = "statuses"; $this->bootstrap = true; $this->table = "order_detail"; $this->identifier = "id_order_detail"; $uabfcuorovz = "status"; $this->className = "OrderDetail"; $tjctkjkrs = "status"; $this->addRowAction(""); $vbvfygz = "statuses_array"; parent::__construct(); ${"GLOBALS"}["xeuytgig"] = "statuses"; ${$evgmwedmihr} = array(); ${${"GLOBALS"}["ynkpdchxy"]} = OrderState::getOrderStates((int) $this->context->language->id); foreach (${${"GLOBALS"}["xeuytgig"]} as ${$uabfcuorovz}) { ${$vbvfygz}[${$tjctkjkrs}["id_order_state"]] = ${${"GLOBALS"}["apjhrgl"]}["name"]; } $this->fields_list = array("id_order_detail" => array("title" => $this->l('ID'), "align" => "center", "width" => 50), "id_order" => array("title" => $this->l('Order ID'), "align" => "center", "width" => 50, "filter_key" => "a!id_order"), "id_owner" => array("title" => $this->l('Seller ID'), "align" => "center", "width" => 50), "seller" => array("title" => $this->l('Seller'), "havingFilter" => true), "product_name" => array("title" => $this->l('Product Name'), "width" => 180, "align" => "left"), "product_price" => array("title" => $this->l('Price'), "width" => 70, "align" => "right", "prefix" => "<b>", "suffix" => "</b>", "type" => "price", "currency" => true), "product_quantity" => array("title" => $this->l('Quantity'), "align" => "center", "havingFilter" => true), "osname" => array("title" => $this->l('Status'), "color" => "color", "width" => 280, "type" => "select", "list" => ${${"GLOBALS"}["inermslrwox"]}, "filter_key" => "os!id_order_state", "filter_type" => "int"), "date_add" => array("title" => $this->l('Date'), "width" => 130, "align" => "right", "type" => "datetime", "filter_key" => "o!date_add")); $this->_isSeller = intval($cookie->profile) == Configuration::get("AGILE_MS_PROFILE_ID"); $this->_join = $this->_join . "\n LEFT JOIN `" . _DB_PREFIX_ . "orders` o ON (a.`id_order`=o.id_order)\n LEFT JOIN `" . _DB_PREFIX_ . "order_owner` oo ON (a.`id_order`=oo.`id_order`)\n LEFT JOIN `" . _DB_PREFIX_ . "sellerinfo` s ON (oo.`id_owner`=s.`id_seller`)\n LEFT JOIN `" . _DB_PREFIX_ . "sellerinfo_lang` sl ON (sl.`id_sellerinfo`=s.`id_sellerinfo` AND sl.id_lang=" . $cookie->id_lang . ")\n\t \t LEFT JOIN `" . _DB_PREFIX_ . "order_history` oh ON (oh.`id_order` = a.`id_order`)\n\t\t LEFT JOIN `" . _DB_PREFIX_ . "order_state` os ON (os.`id_order_state` = oh.`id_order_state`)\n\t\t LEFT JOIN `" . _DB_PREFIX_ . "order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = " . (int) $cookie->id_lang . ")\n\t\t "; $this->_select = $this->_select . "\n o.date_add, oo.id_owner, o.id_currency as id_currency,a.product_name, sl.company as seller\n\t\t\t ,osl.`name` AS `osname`, os.`color`\n "; $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`)"; if ($this->_isSeller) { $this->_where = $this->_where . " AND oo.id_owner=" . intval($cookie->id_employee); } else { $this->fieldsDisplay["seller"] = array("title" => $this->l('Seller'), "filter_key" => "sl!company"); } if (isset($_GET["updateorder_detail"]) and isset($_GET["id_order_detail"]) and (int) $_GET["id_order_detail"] > 0) { $vpjipovr = "orderdetail"; ${${"GLOBALS"}["kwzmtwdwu"]} = Tools::getValue("id_order_detail"); $zcisptfo = "newtoekn"; $crgspgj = "newtoekn"; $gygsuy = "tabid"; $whumnqj = "id_order_detail"; ${$vpjipovr} = new OrderDetail(${$whumnqj}); ${$gygsuy} = Tab::getIdFromClassName("AdminOrders"); ${$crgspgj} = Tools::getAdminToken("AdminOrders" . intval(${${"GLOBALS"}["aaiesey"]}) . intval($cookie->id_employee)); ${${"GLOBALS"}["epfgdop"]} = "./index.php?controller=adminorders&id_order=" . $orderdetail->id_order . "&vieworder&token=" . ${$zcisptfo}; Tools::redirectAdmin(${${"GLOBALS"}["epfgdop"]}); } }
/** * Arma un valor para buscar en las muestras donde las ordenes estan confirmadas *@return FilterValue $filterValue */ public function sampleOrderStateConfirmed() { $filterValue = new FilterValue(); $searchCriteria = new ToOneRelationPropertyFilter(); $searchCriteria->setCriteriaAttribute('Order'); $criteriaProperty = LaboratorySystem::getInstance()->findSearchCriteriaByCode('ORST'); //ver fixture filter.yml $searchCriteria->setSearchCriteria($criteriaProperty); $filterType = $searchCriteria->getSearchFilterType(); $code = ""; $filterData = $filterType->newData($code); $state = OrderState::confirmed(); $arrayValue = array(); $arrayValue[0] = $state->getId(); $filterData->unserializeData($arrayValue, $filterType->getSearchDataType()); $filterValue->setSearchCriteria($searchCriteria); $filterValue->setFilterData($filterData); return $filterValue; }