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;
    }
Example #2
0
    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;
    }
Example #3
0
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 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 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 __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();
 }
Example #7
0
    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 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;
 }
Example #9
0
 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 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');
 }
Example #12
0
 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 __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"]});
     }
 }
    public function initFormByStatus()
    {
        $this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'icon' => 'icon-time'), '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'), 'hint' => $this->l('You can also export orders which have not been charged yet.'))), 'submit' => array('title' => $this->l('Generate PDF file by status'), 'id' => 'submitPrint2', 'icon' => 'process-icon-download-alt'));
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT COUNT( o.id_order ) AS nbOrders, o.current_state as 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 o.current_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 getFormConfigurationController()
 {
     // get all status
     $advanced_order_status = Configuration::get(self::getControllerStatusName('AdminAdvancedOrder'));
     $fields_form = array();
     // configure stock gap
     $fields_form[2]['form'] = array('legend' => array('title' => $this->l('General settings'), 'image' => '../img/admin/cog.gif'), 'input' => array(array('type' => 'radio', 'label' => $this->l('Disable original menus of PrestaShop'), 'name' => 'erp_disable_original_menus', 'required' => true, 'br' => true, 'class' => 't', 'default_value' => '1', 'values' => array(array('id' => 'erp_disable_original_menus' . _PS_SMARTY_NO_COMPILE_, 'value' => '1', 'label' => $this->l('Yes')), array('id' => 'erp_disable_original_menus' . _PS_SMARTY_CHECK_COMPILE_, 'value' => '0', 'label' => $this->l('No'))), 'desc' => $this->l('This option allows you to disable the menus :  orders, supply order and supplier'))), 'submit' => array('title' => $this->l('Save'), 'class' => $this->is_1_6 ? null : 'button', 'name' => 'submitGeneralSettings'));
     // Get activate module table
     $features = ErpFeature::getFeaturesWithToken($this->context->language->iso_code);
     //Display controller parameters if activ and good state
     foreach ($features as $feature) {
         //INVENTORY
         if ($feature['active'] && $feature['controller'] == 'AdminInventory' && Configuration::get(self::getControllerStatusName('AdminInventory'))) {
             // configure stock gap
             $fields_form[3]['form'] = array('legend' => array('title' => sprintf($this->l('%s settings'), $feature['name']), 'image' => '../modules/erpillicopresta/img/features/inventory.png'), 'input' => array(array('type' => 'text', 'label' => $this->l('Maximum authorized stock gap'), 'name' => 'erp_gap_stock', 'size' => 20, 'required' => true, 'desc' => $this->l('If the difference between the found quantity and the expected quantity is greater than this value, an alert will be generated. (0 to disable)'))), 'submit' => array('title' => $this->l('Save'), 'class' => $this->is_1_6 ? null : 'button', 'name' => 'submitInventorySettings'));
         }
         //ORDER
         if ($feature['active'] && $feature['controller'] == 'AdminAdvancedOrder' && $advanced_order_status != STATUS0 && $advanced_order_status != STATUS1) {
             // Get default Language
             $states = OrderState::getOrderStates((int) Configuration::get('PS_LANG_DEFAULT'));
             $fields_form[4]['form'] = array('legend' => array('title' => sprintf($this->l('%s settings'), $feature['name']), 'image' => '../modules/erpillicopresta/img/features/order.png'), 'input' => array(array('type' => 'text', 'label' => $this->l('Stock level - ALERT'), 'name' => 'erp_level_stock_alert', 'desc' => $this->l('Please indicate the stock quantity above which an alert will notify you : from 1 to [X]'), 'size' => 4), array('type' => 'text', 'label' => $this->l('Stock level - NORMAL'), 'name' => 'erp_level_stock_normal', 'desc' => $this->l('Please indicate the stock quantity corresponding to a normal stock level : from ALERT to [X]'), 'size' => 4), array('type' => 'checkbox', 'label' => $this->l('Order status to notify'), 'name' => 'erp_status_warning_stock', 'required' => true, 'values' => array('query' => $states, 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('Select all status which are concerned by stock warnings'))), 'submit' => array('title' => $this->l('Save'), 'class' => $this->is_1_6 ? null : 'button', 'name' => 'submitAdvancedOrderSettings'));
         }
         //SUPPLIER ORDER
         if ($feature['active'] && $feature['controller'] == 'AdminAdvancedSupplyOrder') {
             $fields_form[5]['form'] = array('legend' => array('title' => sprintf($this->l('%s settings'), $feature['name']), 'image' => '../modules/erpillicopresta/img/features/supply_order.png'), 'input' => array(array('type' => 'text', 'label' => $this->l('References prefix'), 'name' => 'erp_prefix_reference', 'desc' => $this->l('References prefixes for the supplier order: maximum of two characters. Default prefix is SO.'), 'size' => 2, 'maxlength' => 2, 'required' => true), array('type' => 'radio', 'label' => $this->l('Activate email sending to suppliers'), 'name' => 'erp_enable_sending_mail_supplier', 'required' => true, 'br' => true, 'class' => 't', 'default_value' => '0', 'values' => array(array('id' => 'erp_enable_sending_mail_supplier' . _PS_SMARTY_NO_COMPILE_, 'value' => '1', 'label' => $this->l('Yes')), array('id' => 'erp_enable_sending_mail_supplier' . _PS_SMARTY_CHECK_COMPILE_, 'value' => '0', 'label' => $this->l('No'))), 'desc' => $this->l('If you select this option, please define the default status to be considered.')), array('type' => 'select', 'label' => $this->l('Status of supplier orders that activates an email sending'), 'name' => 'erp_so_state_to_send_mail', 'desc' => $this->l('In the selected status, an email will be sent to the supplier. Default : 2 - Order validated.'), 'required' => true, 'options' => array('query' => SupplyOrderState::getStates(), 'id' => 'id_supply_order_state', 'name' => 'name'))), 'submit' => array('title' => $this->l('Save'), 'class' => $this->is_1_6 ? null : 'button', 'name' => 'submitAdvancedSupplyOrderSettings'));
             if (Configuration::get(self::getControllerStatusName('AdminAdvancedSupplyOrder'))) {
                 // configure stock gap
                 $fields_form[5]['form']['input'][] = array('type' => 'select', 'label' => $this->l('Status of customer orders that generates supplier orders'), 'name' => 'erp_generate_order_state', 'desc' => $this->l('Please choose here the status of customer orders that will generate an automatic supplier order.'), 'required' => true, 'options' => array('query' => OrderState::getOrderStates((int) $this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'));
                 $fields_form[5]['form']['input'][] = array('type' => 'select', 'label' => $this->l('Status of customer orders after generation of supplier orders'), 'name' => 'erp_generate_order_state_to', 'desc' => $this->l('Select the state to apply to customer orders after the automatic generation of supplier orders occured.'), 'required' => true, 'options' => array('query' => OrderState::getOrderStates((int) $this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'));
                 // configure stock gap
                 $fields_form[5]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Number of rolling months'), 'name' => 'erp_rolling_months_nb_so', 'size' => 20, 'required' => true, 'desc' => $this->l('Used to display the quantities sold for x rolling months.'));
                 $fields_form[5]['form']['input'][] = array('type' => 'select', 'label' => $this->l('Status of customer orders that count for the product sales statistic'), 'name' => 'erp_so_state_to_product_sales', 'desc' => $this->l('In the selected status, the products of the order will be counted in the product sales statistic.'), 'required' => true, 'options' => array('query' => OrderState::getOrderStates((int) $this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'));
                 $fields_form[5]['form']['input'][] = array('type' => 'radio', 'label' => $this->l('Sales forecast type'), 'name' => 'erp_sales_forecast_choice', 'br' => true, 'class' => 't', 'values' => array(array('id' => 'none', 'value' => 0, 'label' => $this->l('No projected sales')), array('id' => 'forecast_six_last_month', 'value' => 1, 'label' => $this->l('Weighted average sales on the six last rolling months')), array('id' => 'forecast_period', 'value' => 2, 'label' => $this->l('Sales forecast by period'))), 'desc' => $this->l('Sales forecast will be calculated during supplier orders.') . '</br>' . $this->l('The "Sales forecast by period" method calculates ') . $this->l('the sales growth factor based on the comparison between ') . $this->l('x rolling months of the current year ') . $this->l('and the same x rolling months of the previous year at the same date. ') . $this->l('Sales for the choosen projection period are then estimated by multiplying ') . $this->l('this sales growth factor by the sales performed during that period on the previous year.'));
                 $fields_form[5]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Weighting coefficients'), 'name' => 'erp_coefficients', 'desc' => $this->l('Coefficients that will be used to calculate the "Weighted average sales on the six last rolling months". Positive numbers expected.') . '<br/>' . $this->l('Syntax : M-1;M-2;M-3;M-4;M-5;M-6 (coefficient of the month M-1; etc.)'), 'size' => 20);
                 $fields_form[5]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Projection period'), 'name' => 'erp_projected_period', 'suffix' => $this->l('days'), 'desc' => $this->l('The "Sales forecast by period" method will return the total sales estimation for the filled out period.'), 'size' => 20);
                 $fields_form[5]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Comparison period for the growth factor calculation'), 'name' => 'erp_comparison_period', 'suffix' => $this->l('month'), 'desc' => $this->l('Number of months preceding the current date that will be used to calculate the sales growth factor in the "Sales forecast by period" method.'), 'size' => 20);
                 $fields_form[5]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Exceptional sales threshold'), 'name' => 'erp_exceptional_order_limit', 'desc' => $this->l('Above this value, a sale will be considered exceptional and will not be taken into account in forecasts. 0 if non applicable.'), 'size' => 20, 'required' => true);
             }
         }
     }
     return $fields_form;
 }
Example #16
0
    public function postProcess()
    {
        global $currentIndex, $cookie, $smarty;
        $statuses = OrderState::getOrderStates($cookie->id_lang);
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT COUNT(*) as nbOrders, (
			SELECT oh.id_order_state
			FROM ' . _DB_PREFIX_ . 'order_history oh
			WHERE oh.id_order = o.id_order
			ORDER BY oh.date_add DESC, oh.id_order_history DESC
			LIMIT 1
		) id_order_state
		FROM ' . _DB_PREFIX_ . 'orders o
		GROUP BY id_order_state');
        $statusStats = array();
        foreach ($result as $row) {
            $statusStats[$row['id_order_state']] = $row['nbOrders'];
        }
        $smarty->assign('statusStats', $statusStats);
        $smarty->assign('statuses', $statuses);
    }
    public function __construct()
    {
        $this->table = 'order';
        $this->className = 'Order';
        $this->lang = false;
        $this->bootstrap = true;
        $this->deleted = false;
        $this->explicitSelect = true;
        $this->context = Context::getContext();
        $this->list_no_link = true;
        // so you can't click on rows. Ignore Prestashop docs.
        $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,
			country_lang.name as cname,
			IF(a.valid, 1, 0) badge_success';
        $this->_join = '
			LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
			INNER JOIN `' . _DB_PREFIX_ . 'address` address ON address.id_address = a.id_address_delivery
			INNER JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country
			INNER JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ')
			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->_orderBy = 'id_order';
        $this->_orderWay = 'DESC';
        $statuses = OrderState::getOrderStates((int) $this->context->language->id);
        foreach ($statuses as $status) {
            $this->statuses_array[$status['id_order_state']] = $status['name'];
        }
        $this->_where = ' AND (a.id_carrier=' . (int) Configuration::get('CHRONOPOST_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONORELAIS_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONOEXPRESS_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONO10_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONO18_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONOCLASSIC_CARRIER_ID') . ') ';
        parent::__construct();
        // fields_lists *HAS* to be initiated in constructor, not later
        $this->fields_list = array('id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), 'osname' => array('title' => $this->l('Status'), 'type' => 'select', 'color' => 'color', 'list' => $this->statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'order_key' => 'osname'), 'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'), 'id_pdf' => array('title' => $this->l('Waybills'), 'align' => 'text-center', 'callback' => 'nbWaybillsInput', 'orderby' => false, 'search' => false));
        $this->bulk_actions = array('csoexport' => array('text' => $this->l('CSO export '), 'icon' => 'icon-save'), 'cssexport' => array('text' => $this->l('CSS export '), 'icon' => 'icon-save'), 'waybills' => array('text' => $this->l('Print all waybills'), 'icon' => 'icon-print'));
        $this->displayInformation($this->l('For an export, select orders, then in the "Bulk Actions" menu, select the type of export wanted.'));
        $this->displayWarning($this->l('Careful, Chrono Relais waybills can\'t be edited in Chronoship Office (CSO) by file importation'));
    }
    public function __construct()
    {
        $this->table = 'order';
        $this->className = 'Order';
        $this->lang = false;
        $this->bootstrap = true;
        $this->deleted = false;
        $this->context = Context::getContext();
        $this->list_no_link = true;
        // so you can't click on rows. Ignore Prestashop docs.
        $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,
			country_lang.name as cname,
			IF(a.valid, 1, 0) badge_success';
        $this->_join = '
			LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
			INNER JOIN `' . _DB_PREFIX_ . 'address` address ON address.id_address = a.id_address_delivery
			INNER JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country
			INNER JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ')
			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->_orderBy = 'id_order';
        $this->_orderWay = 'DESC';
        $statuses = OrderState::getOrderStates((int) $this->context->language->id);
        foreach ($statuses as $status) {
            $this->statuses_array[$status['id_order_state']] = $status['name'];
        }
        $this->_where = ' AND (a.id_carrier=' . (int) Configuration::get('CHRONOPOST_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONORELAIS_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONOEXPRESS_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONO10_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONO18_CARRIER_ID') . ' OR a.id_carrier=' . (int) Configuration::get('CHRONOCLASSIC_CARRIER_ID') . ') ';
        parent::__construct();
        // fields_lists *HAS* to be initiated in constructor, not later
        $this->fields_list = array('id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), 'osname' => array('title' => $this->l('Status'), 'type' => 'select', 'color' => 'color', 'list' => $this->statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'order_key' => 'osname'), 'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'));
        $this->bulk_actions = array('docket' => array('text' => $this->l('Edition of the daily docket'), 'icon' => 'icon-print'));
        $this->displayInformation($this->l('Print the daily docket in duplicate, one for schedules pickup, the other is to be retained. Both must be signed.'));
    }
 public function renderForm()
 {
     $this->display = 'edit';
     $this->initToolbar();
     if (!$this->loadObject(true)) {
         return;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Payment Systems'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'switch', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Short description:'), 'name' => 'description_short', 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Displayed in payment selection page.')), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('%total% will be replaced with total amount.')), array('type' => 'textarea', 'label' => $this->l('Description success:'), 'name' => 'description_success', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('%order_number% will be replaced with order reference, %order_number% - order id, %total% - total amount')), array('type' => 'file', 'label' => $this->l('Image:'), 'name' => 'logo', 'display_image' => true, 'desc' => $this->l('Upload payment logo from your computer')), array('type' => 'select', 'label' => $this->l('Order state:'), 'name' => 'id_order_state', 'desc' => $this->l('Order state after create.'), 'options' => array('query' => OrderState::getOrderStates($this->context->language->id), 'name' => 'name', 'id' => 'id_order_state')), array('type' => 'checkbox', 'label' => $this->l('Carriers:'), 'name' => 'carrierBox', 'values' => array('query' => Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS), 'id' => 'id_carrier', 'name' => 'name'), 'desc' => $this->l('The carriers in which this paysystem is to be used')), array('type' => 'group', 'label' => $this->l('Groups:'), 'name' => 'groupBox', 'values' => Group::getGroups($this->context->language->id), 'desc' => $this->l('The customer groups in which this paysystem is to be used'))), 'submit' => array('title' => $this->l('Save')));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     // Added values of object Group
     $universalpay_system_carrier_ids = $obj->getCarriers();
     $carriers = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $carrier) {
         $this->fields_value['carrierBox_' . $carrier['id_carrier']] = Tools::getValue('carrierBox_' . $carrier['id_carrier'], in_array($carrier['id_carrier'], $universalpay_system_carrier_ids));
     }
     $universalpay_system_group_ids = $obj->getGroups();
     $groups = Group::getGroups($this->context->language->id);
     foreach ($groups as $group) {
         $this->fields_value['groupBox_' . $group['id_group']] = Tools::getValue('groupBox_' . $group['id_group'], in_array($group['id_group'], $universalpay_system_group_ids));
     }
     return parent::renderForm();
 }
 public function getContent()
 {
     $this->html = '';
     if (Tools::isSubmit('submitNetEven')) {
         if (Tools::getValue('NETEVEN_LOGIN') && Tools::getValue('NETEVEN_PASSWORD')) {
             Gateway::updateConfig('NETEVEN_LOGIN', Tools::getValue('NETEVEN_LOGIN'));
             Gateway::updateConfig('NETEVEN_PASSWORD', Tools::getValue('NETEVEN_PASSWORD'));
             Gateway::updateConfig('COMMENT', Tools::getValue('COMMENT'));
             Gateway::updateConfig('DEFAULT_BRAND', Tools::getValue('DEFAULT_BRAND'));
             Gateway::updateConfig('IMAGE_TYPE_NAME', Tools::getValue('IMAGE_TYPE_NAME'));
             Gateway::updateConfig('SYNCHRONISATION_ORDER', (int) Tools::getValue('SYNCHRONISATION_ORDER'));
             Gateway::updateConfig('SYNCHRONISATION_PRODUCT', (int) Tools::getValue('SYNCHRONISATION_PRODUCT'));
             Gateway::updateConfig('TYPE_SKU', (string) Tools::getValue('TYPE_SKU'));
             $this->html .= $this->displayConfirmation($this->l('Les paramètres ont bien été mis à jour'));
         } else {
             $this->html .= $this->displayError($this->l('Les login et mot de passe NetEven sont obligatoire'));
         }
     } elseif (Tools::isSubmit('submitNetEvenShipping')) {
         Gateway::updateConfig('SHIPPING_DELAY', Tools::getValue('SHIPPING_DELAY'));
         Gateway::updateConfig('SHIPPING_PRICE_LOCAL', Tools::getValue('SHIPPING_PRICE_LOCAL'));
         Gateway::updateConfig('SHIPPING_PRICE_INTERNATIONAL', Tools::getValue('SHIPPING_PRICE_INTERNATIONAL'));
         Gateway::updateConfig('SHIPPING_BY_PRODUCT', (int) Tools::getValue('SHIPPING_BY_PRODUCT'));
         Gateway::updateConfig('SHIPPING_BY_PRODUCT_FIELDNAME', Tools::getValue('SHIPPING_BY_PRODUCT_FIELDNAME'));
         Gateway::updateConfig('SHIPPING_CARRIER_FRANCE', Tools::getValue('SHIPPING_CARRIER_FRANCE'));
         Gateway::updateConfig('SHIPPING_ZONE_FRANCE', Tools::getValue('SHIPPING_ZONE_FRANCE'));
         Gateway::updateConfig('SHIPPING_CARRIER_INTERNATIONAL', Tools::getValue('SHIPPING_CARRIER_INTERNATIONAL'));
         Gateway::updateConfig('SHIPPING_ZONE_INTERNATIONAL', Tools::getValue('SHIPPING_ZONE_INTERNATIONAL'));
         $this->html .= $this->displayConfirmation($this->l('Les paramètres de livraison ont bien été mis à jour'));
     } elseif (Tools::isSubmit('submitDev')) {
         Gateway::updateConfig('NETEVEN_URL', Tools::getValue('NETEVEN_URL'));
         Gateway::updateConfig('NETEVEN_NS', Tools::getValue('NETEVEN_NS'));
         Gateway::updateConfig('MAIL_LIST_ALERT', Tools::getValue('MAIL_LIST_ALERT'));
         Gateway::updateConfig('DEBUG', (int) Tools::getValue('DEBUG'));
         Gateway::updateConfig('SEND_REQUEST_BY_EMAIL', (int) Tools::getValue('SEND_REQUEST_BY_EMAIL'));
         $this->html .= $this->displayConfirmation($this->l('Les paramètres de maintenance ont bien été mis à jour'));
     } elseif (Tools::isSubmit('submitCustomizableFeilds')) {
         $customizable_field_name = Tools::getValue('customizable_field_name');
         $customizable_field_value = Tools::getValue('customizable_field_value');
         $customizable_string = '';
         foreach ($customizable_field_name as $key => $value) {
             if (!$customizable_field_name[$key] || !$customizable_field_value[$key]) {
                 continue;
             }
             if ($customizable_string) {
                 $customizable_string .= '¤';
             }
             $customizable_string .= $customizable_field_name[$key] . '|' . $customizable_field_value[$key];
         }
         Gateway::updateConfig('CUSTOMIZABLE_FIELDS', $customizable_string);
     }
     // Lists of order status
     $order_states = OrderState::getOrderStates((int) $this->context->cookie->id_lang);
     // Lists of features
     $features = Feature::getFeatures((int) $this->context->cookie->id_lang);
     // Lists of attribute groups
     $attribute_groups = AttributeGroup::getAttributesGroups((int) $this->context->cookie->id_lang);
     $neteven_features = Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'orders_gateway_feature`');
     $neteven_feature_categories = array();
     foreach ($neteven_features as $neteven_feature) {
         if (!isset($neteven_feature_categories[$neteven_feature['category']])) {
             $neteven_feature_categories[$neteven_feature['category']] = array();
         }
         $neteven_feature_categories[$neteven_feature['category']][] = $neteven_feature;
     }
     if ($this->getSOAP()) {
         $this->html .= $this->displayForm($order_states, $features, $attribute_groups, $neteven_feature_categories);
     } else {
         $this->html .= $this->displayError($this->l('This module requires the SOAP extension to run'));
     }
     return $this->html;
 }
    public function getContent()
    {
        $html = '';
        if (Tools::isSubmit('submitModule')) {
            Configuration::updateValue('AUTHORIZE_AIM_LOGIN_ID', Tools::getvalue('authorizeaim_login_id'));
            Configuration::updateValue('AUTHORIZE_AIM_KEY', Tools::getvalue('authorizeaim_key'));
            Configuration::updateValue('AUTHORIZE_AIM_DEMO', Tools::getvalue('authorizeaim_demo_mode'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_VISA', Tools::getvalue('authorizeaim_card_visa'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_MASTERCARD', Tools::getvalue('authorizeaim_card_mastercard'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_DISCOVER', Tools::getvalue('authorizeaim_card_discover'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_AX', Tools::getvalue('authorizeaim_card_ax'));
            Configuration::updateValue('AUTHORIZE_AIM_HOLD_REVIEW_OS', Tools::getvalue('authorizeaim_hold_review_os'));
            $html .= $this->displayConfirmation($this->l('Configuration updated'));
        }
        // For Hold for Review
        $orderStates = OrderState::getOrderStates((int) $this->context->cookie->id_lang);
        $html .= '<h2>' . $this->displayName . '</h2>
		<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" alt="" /> ' . $this->l('Help') . '</legend>
			<a href="http://api.prestashop.com/partner/authorize.net/" target="_blank" style="float: right;"><img src="../modules/' . $this->name . '/logo_authorize.png" alt="" /></a>
			<h3>' . $this->l('In your PrestaShop admin panel') . '</h3>
			- ' . $this->l('Fill the  Login ID  provided by Authorize.net') . '<br />
			- ' . $this->l('Fill the key field with the transaction key provided by Authorize.net') . '<br />
			<span style="color: red;" >- ' . $this->l('Warning: Your website must possess a SSL certificate to use the Authorize.net AIM payment system. You are responsible for the safety of your customers\' bank information. PrestaShop cannot be blamed for any security issue on your website.') . '</span><br />
			<br />
		</fieldset><br />
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">
				<legend><img src="../img/admin/contact.gif" alt="" />' . $this->l('Settings') . '</legend>
				<label for="authorizeaim_login_id">' . $this->l('Login ID') . '</label>
				<div class="margin-form"><input type="text" size="20" id="authorizeaim_login_id" name="authorizeaim_login_id" value="' . Configuration::get('AUTHORIZE_AIM_LOGIN_ID') . '" /></div>
				<label for="authorizeaim_key">' . $this->l('Key') . '</label>
				<div class="margin-form"><input type="text" size="20" id="authorizeaim_login_id" name="authorizeaim_key" value="' . Configuration::get('AUTHORIZE_AIM_KEY') . '" /></div>
				<label for="authorizeaim_demo_mode">' . $this->l('Mode:') . '</label>
				<div class="margin-form" id="authorizeaim_demo">
					<input type="radio" name="authorizeaim_demo_mode" value="0" style="vertical-align: middle;" ' . (!Tools::getValue('authorizeaim_demo_mode', Configuration::get('AUTHORIZE_AIM_DEMO')) ? 'checked="checked"' : '') . ' />
					<span style="color: #080;">' . $this->l('Production') . '</span>
					<input type="radio" name="authorizeaim_demo_mode" value="1" style="vertical-align: middle;" ' . (Tools::getValue('authorizeaim_demo_mode', Configuration::get('AUTHORIZE_AIM_DEMO')) ? 'checked="checked"' : '') . ' />
					<span style="color: #900;">' . $this->l('Test') . '</span>
				</div>
				<label for="authorizeaim_cards">' . $this->l('Cards:') . '</label>
				<div class="margin-form" id="authorizeaim_cards">
					<input type="checkbox" name="authorizeaim_card_visa" ' . (Configuration::get('AUTHORIZE_AIM_CARD_VISA') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/visa.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_mastercard" ' . (Configuration::get('AUTHORIZE_AIM_CARD_MASTERCARD') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/mastercard.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_discover" ' . (Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/discover.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_ax" ' . (Configuration::get('AUTHORIZE_AIM_CARD_AX') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/ax.gif" alt="visa" />
				</div>

				<label for="authorizeaim_hold_review_os">' . $this->l('Order status:  "Hold for Review" ') . '</label>
				<div class="margin-form">
								<select id="authorizeaim_hold_review_os" name="authorizeaim_hold_review_os">';
        // Hold for Review order state selection
        foreach ($orderStates as $os) {
            $html .= '
				<option value="' . (int) $os['id_order_state'] . '"' . ((int) $os['id_order_state'] == (int) Configuration::get('AUTHORIZE_AIM_HOLD_REVIEW_OS') ? ' selected' : '') . '>' . Tools::stripslashes($os['name']) . '</option>' . "\n";
        }
        return $html . '</select></div>
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>';
    }
Example #22
0
    public function getContent()
    {
        global $cookie;
        $this->instanceDefaultStates();
        $this->_postProcess();
        $order_states = OrderState::getOrderStates($cookie->id_lang);
        $currency = new Currency(intval(Configuration::get('PS_CURRENCY_DEFAULT')));
        $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
        $languages = Language::getLanguages();
        $languageIds = 'voucher_details¤default_loyalty_state¤none_award_loyalty_state¤convert_loyalty_state¤validation_loyalty_state¤cancel_loyalty_state';
        $html = '
		<script type="text/javascript">
			id_language = Number(' . $defaultLanguage . ');
		</script>
		<h2>' . $this->l('Loyalty Program') . '</h2>
		<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
			<fieldset>
				<legend>' . $this->l('Settings') . '</legend>
				
				<label>' . $this->l('Ratio') . '</label>
				<div class="margin-form">
					<input type="text" size="2" id="point_rate" name="point_rate" value="' . floatval(Configuration::get('PS_LOYALTY_POINT_RATE')) . '" /> ' . $currency->sign . '
					<label for="point_rate" class="t"> = ' . $this->l('1 reward point') . '.</label>
					<br />
					<label for="point_value" class="t">' . $this->l('1 point = ') . '</label>
					<input type="text" size="2" name="point_value" id="point_value" value="' . floatval(Configuration::get('PS_LOYALTY_POINT_VALUE')) . '" /> ' . $currency->sign . '
					<label for="point_value" class="t">' . $this->l('for the discount') . '.</label>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Voucher details') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="voucher_details_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="voucher_details_' . $language['id_lang'] . '" value="' . Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', intval($language['id_lang'])) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'voucher_details', true);
        $html .= '	</div>
				<div class="clear" style="margin-top: 20px"></div>
				<label>' . $this->l('Allow discounts') . ' </label>
				<div class="margin-form">
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_on" value="1" ' . (Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Yes') . '" /></label>
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_off" value="0" ' . (!Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('No') . '" /></label>
					</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are awarded when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_validation" name="id_order_state_validation">';
        foreach ($order_states as $order_state) {
            $html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if (intval($this->loyaltyStateValidation->id_order_state) == $order_state['id_order_state']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . $order_state['name'] . '</option>';
        }
        $html .= '</select>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are canceled when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_cancel" name="id_order_state_cancel">';
        foreach ($order_states as $order_state) {
            $html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if (intval($this->loyaltyStateCancel->id_order_state) == $order_state['id_order_state']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . $order_state['name'] . '</option>';
        }
        $html .= '</select>
				</div>
				<div class="clear"></div>
				<h3 style="margin-top:20px">' . $this->l('Loyalty points progression') . '</h3>
				<label>' . $this->l('Initial') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="default_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="default_loyalty_state_' . $language['id_lang'] . '" value="' . $this->loyaltyStateDefault->name[intval($language['id_lang'])] . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'default_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Unavailable') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="none_award_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="none_award_loyalty_state_' . $language['id_lang'] . '" value="' . $this->loyaltyStateNoneAward->name[intval($language['id_lang'])] . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'none_award_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Converted') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="convert_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="convert_loyalty_state_' . $language['id_lang'] . '" value="' . $this->loyaltyStateConvert->name[intval($language['id_lang'])] . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'convert_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Validation') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="validation_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="validation_loyalty_state_' . $language['id_lang'] . '" value="' . $this->loyaltyStateValidation->name[intval($language['id_lang'])] . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'validation_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Canceled') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="cancel_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="cancel_loyalty_state_' . $language['id_lang'] . '" value="' . $this->loyaltyStateCancel->name[intval($language['id_lang'])] . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'cancel_loyalty_state', true);
        $html .= '	</div>
				<div class="clear center">
					<input type="submit" style="margin-top:20px" name="submitLoyalty" id="submitLoyalty" value="' . $this->l('   Save   ') . '" class="button" />
				</div>
			</fieldset>
		</form>';
        return $html;
    }
Example #23
0
    public function getContent()
    {
        $this->instanceDefaultStates();
        $this->_postProcess();
        $order_states = OrderState::getOrderStates($this->context->language->id);
        $currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
        $id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
        $languages = Language::getLanguages(false);
        $languageIds = 'voucher_details¤default_loyalty_state¤none_award_loyalty_state¤convert_loyalty_state¤validation_loyalty_state¤cancel_loyalty_state';
        $this->html .= '
		<script type="text/javascript">
			id_language = Number(' . $id_lang_default . ');
		</script>
		<h2>' . $this->l('Loyalty Program') . '</h2>
		<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>
				<legend>' . $this->l('Settings') . '</legend>
				
				<label>' . $this->l('Ratio') . '</label>
				<div class="margin-form">
					<input type="text" size="2" id="point_rate" name="point_rate" value="' . (double) Configuration::get('PS_LOYALTY_POINT_RATE') . '" /> ' . $currency->sign . '
					<label for="point_rate" class="t"> = ' . $this->l('1 reward point') . '.</label>
					<br />
					<label for="point_value" class="t">' . $this->l('1 point = ') . '</label>
					<input type="text" size="2" name="point_value" id="point_value" value="' . (double) Configuration::get('PS_LOYALTY_POINT_VALUE') . '" /> ' . $currency->sign . '
					<label for="point_value" class="t">' . $this->l('for the discount') . '.</label>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Voucher details') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="voucher_details_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="voucher_details_' . $language['id_lang'] . '" value="' . Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int) $language['id_lang']) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'voucher_details', true);
        $this->html .= '	</div>
				<div class="clear" style="margin-top: 20px"></div>
				<label>' . $this->l('Minimum amount in which the voucher can be used') . '</label>
				<div class="margin-form">
					<input type="text" size="2" name="minimal" value="' . (double) Configuration::get('PS_LOYALTY_MINIMAL') . '" /> ' . $currency->sign . '
				</div>
				<div class="clear" style="margin-top: 20px"></div>
				<label>' . $this->l('Give points on discounted products') . ' </label>
				<div class="margin-form">
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_on" value="1" ' . (Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Yes') . '" /></label>
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_off" value="0" ' . (!Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('No') . '" /></label>
					</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are awarded when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_validation" name="id_order_state_validation">';
        foreach ($order_states as $order_state) {
            $this->html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if ((int) $this->loyaltyStateValidation->id_order_state == $order_state['id_order_state']) {
                $this->html .= ' selected="selected"';
            }
            $this->html .= '>' . $order_state['name'] . '</option>';
        }
        $this->html .= '</select>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are cancelled when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_cancel" name="id_order_state_cancel">';
        foreach ($order_states as $order_state) {
            $this->html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if ((int) $this->loyaltyStateCancel->id_order_state == $order_state['id_order_state']) {
                $this->html .= ' selected="selected"';
            }
            $this->html .= '>' . $order_state['name'] . '</option>';
        }
        $this->html .= '</select>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Vouchers created by the loyalty system can be used in the following categories :') . '</label>';
        $index = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
        $indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : $index;
        $helper = new Helper();
        $this->html .= '<div class="margin-form">' . $helper->renderCategoryTree(null, $indexedCategories) . '</div>';
        $this->html .= '
				<p style="padding-left:200px;">' . $this->l('Mark the box(es) of categories in which loyalty vouchers are usable.') . '</p>
				<div class="clear"></div>
				<h3 style="margin-top:20px">' . $this->l('Loyalty points progression') . '</h3>
				<label>' . $this->l('Initial') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="default_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="default_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateDefault->name[(int) $language['id_lang']]) ? $this->loyaltyStateDefault->name[(int) $language['id_lang']] : $this->loyaltyStateDefault->name[(int) $id_lang_default]) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'default_loyalty_state', true);
        $this->html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Unavailable') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="none_award_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="none_award_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateNoneAward->name[(int) $language['id_lang']]) ? $this->loyaltyStateNoneAward->name[(int) $language['id_lang']] : $this->loyaltyStateNoneAward->name[(int) $id_lang_default]) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'none_award_loyalty_state', true);
        $this->html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Converted') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="convert_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="convert_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateConvert->name[(int) $language['id_lang']]) ? $this->loyaltyStateConvert->name[(int) $language['id_lang']] : $this->loyaltyStateConvert->name[(int) $id_lang_default]) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'convert_loyalty_state', true);
        $this->html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Validation') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="validation_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="validation_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateValidation->name[(int) $language['id_lang']]) ? $this->loyaltyStateValidation->name[(int) $language['id_lang']] : $this->loyaltyStateValidation->name[(int) $id_lang_default]) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'validation_loyalty_state', true);
        $this->html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Cancelled') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $this->html .= '
					<div id="cancel_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="cancel_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateCancel->name[(int) $language['id_lang']]) ? $this->loyaltyStateCancel->name[(int) $language['id_lang']] : $this->loyaltyStateCancel->name[(int) $id_lang_default]) . '" />
					</div>';
        }
        $this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'cancel_loyalty_state', true);
        $this->html .= '	</div>
				<div class="clear center">
					<input type="submit" style="margin-top:20px" name="submitLoyalty" id="submitLoyalty" value="' . $this->l('   Save   ') . '" class="button" />
				</div>
			</fieldset>
		</form>';
        return $this->html;
    }
 private function _getOrderStateCanceledSelect($configuration)
 {
     $html = '<select name="SHOPPING_FLUX_CANCELED">';
     foreach (OrderState::getOrderStates($configuration['PS_LANG_DEFAULT']) as $orderState) {
         $selected = (int) $configuration['SHOPPING_FLUX_CANCELED'] === (int) $orderState['id_order_state'] ? 'selected = "selected"' : '';
         $html .= '<option value="' . $orderState['id_order_state'] . '" ' . $selected . '>' . Tools::safeOutput($orderState['name']) . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        $statuses = OrderState::getOrderStates($cookie->id_lang);
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT COUNT(*) as nbOrders, (
			SELECT oh.id_order_state
			FROM ' . _DB_PREFIX_ . 'order_history oh
			WHERE oh.id_order = o.id_order
			ORDER BY oh.date_add DESC, oh.id_order_history DESC
			LIMIT 1
		) id_order_state
		FROM ' . _DB_PREFIX_ . 'orders o
		GROUP BY id_order_state');
        $statusStats = array();
        foreach ($result as $row) {
            $statusStats[$row['id_order_state']] = $row['nbOrders'];
        }
        echo '
		<h2>' . $this->l('Print PDF invoices') . '</h2>
		<fieldset style="float:left;width:300px"><legend><img src="../img/admin/pdf.gif" alt="" /> ' . $this->l('By date') . '</legend>
			<form action="' . $currentIndex . '&token=' . $this->token . '" method="post">
				<label style="width:90px">' . $this->l('From:') . ' </label>
				<div class="margin-form" style="padding-left:100px">
					<input type="text" size="4" maxlength="10" name="date_from" value="' . date('Y-m-d') . '" style="width: 120px;" /> <sup>*</sup>
					<p class="clear">' . $this->l('Format: 2007-12-31 (inclusive)') . '</p>
				</div>
				<label style="width:90px">' . $this->l('To:') . ' </label>
				<div class="margin-form" style="padding-left:100px">
					<input type="text" size="4" maxlength="10" name="date_to" value="' . date('Y-m-d') . '" style="width: 120px;" /> <sup>*</sup>
					<p class="clear">' . $this->l('Format: 2008-12-31 (inclusive)') . '</p>
				</div>
				<div class="margin-form" style="padding-left:100px">
					<input type="submit" value="' . $this->l('Generate PDF file') . '" name="submitPrint" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required fields') . '</div>
			</form>
		</fieldset>
		<fieldset style="float:left;width: 500px;margin-left:10px"><legend><img src="../img/admin/pdf.gif" alt="" /> ' . $this->l('By statuses') . '</legend>
			<form action="' . $currentIndex . '&token=' . $this->token . '" method="post">
				<label style="width:90px">' . $this->l('Statuses') . ' :</label>
				<div class="margin-form" style="padding-left:100px">
					<ul>';
        foreach ($statuses as $status) {
            echo '		<li style="list-style: none;">
							<input type="checkbox" name="id_order_state[]" value="' . (int) $status['id_order_state'] . '" id="id_order_state_' . (int) $status['id_order_state'] . '">
							<label for="id_order_state_' . (int) $status['id_order_state'] . '" style="float:none;' . ((isset($statusStats[$status['id_order_state']]) and $statusStats[$status['id_order_state']]) ? '' : 'font-weight:normal;') . 'padding:0;text-align:left;width:100%;color:#000">
								<img src="../img/admin/charged_' . ($status['invoice'] ? 'ok' : 'ko') . '.gif" alt="" />
								' . $status['name'] . ' (' . ((isset($statusStats[$status['id_order_state']]) and $statusStats[$status['id_order_state']]) ? $statusStats[$status['id_order_state']] : '0') . ')
							</label>
						</li>';
        }
        echo '		</ul>
					<p class="clear">' . $this->l('You can also export orders which have not been charged yet.') . '(<img src="../img/admin/charged_ko.gif" alt="" />)</p>
				</div>
				<div class="margin-form">
					<input type="submit" value="' . $this->l('Generate PDF file') . '" name="submitPrint2" class="button" />
				</div>
			</form>
		</fieldset>
		<div class="clear">&nbsp;</div>';
        return parent::displayForm();
    }
Example #26
0
    public function getContent()
    {
        $post_action = NULL;
        if (!empty($_POST)) {
            $this->_postValidation();
            if (!sizeof($this->_postErrors)) {
                $post_action = $this->_postProcess();
            }
        }
        $carriers_list = Db::getInstance()->executeS('
			SELECT m.*
			FROM `' . _DB_PREFIX_ . 'mr_method` m
			LEFT JOIN `' . _DB_PREFIX_ . 'carrier` c
			ON (c.`id_carrier` = m.`id_carrier`)
			LEFT JOIN `' . _DB_PREFIX_ . 'mr_method_shop` ms
			ON ms.`id_mr_method` = m.`id_mr_method`
			WHERE c.`deleted` = 0 AND ms.`id_shop` = ' . (int) $this->account_shop['id_shop']);
        $controller = _PS_VERSION_ < '1.5' ? 'AdminContact' : 'AdminStores';
        // TODO : Fill an array with admi controller name
        $this->context->smarty->assign(array('MR_token_admin_performance' => Tools::getAdminToken('AdminPerformance' . (int) Tab::getIdFromClassName('AdminPerformance') . (int) $this->context->cookie->id_employee), 'MR_token_admin_carriers' => Tools::getAdminToken('AdminCarriers' . (int) Tab::getIdFromClassName('AdminCarriers') . (int) $this->context->employee->id), 'MR_token_admin_contact' => array('controller_name' => $controller, 'token' => Tools::getAdminToken($controller . (int) Tab::getIdFromClassName($controller) . (int) $this->context->employee->id)), 'MR_token_admin_mondialrelay' => Tools::getAdminToken('AdminMondialRelay' . (int) Tab::getIdFromClassName('AdminMondialRelay') . (int) $this->context->employee->id), 'MR_token_admin_module' => Tools::getAdminToken('AdminModules' . (int) Tab::getIdFromClassName('AdminModules') . (int) $this->context->employee->id), 'MR_enseigne_webservice' => Tools::getValue('MR_enseigne_webservice') ? Tools::getValue('MR_enseigne_webservice') : $this->account_shop['MR_ENSEIGNE_WEBSERVICE'], 'MR_code_marque' => Tools::getValue('MR_code_marque') ? Tools::getValue('MR_code_marque') : $this->account_shop['MR_CODE_MARQUE'], 'MR_webservice_key' => Tools::getValue('MR_webservice_key') ? Tools::getValue('MR_webservice_key') : $this->account_shop['MR_KEY_WEBSERVICE'], 'MR_available_languages' => Language::getLanguages(), 'MR_selected_language' => $this->account_shop['MR_LANGUAGE'], 'MR_weight_coefficient' => Tools::getValue('MR_weight_coefficient') ? Tools::getValue('MR_weight_coefficient') : $this->account_shop['MR_WEIGHT_COEFFICIENT'], 'MR_PS_WEIGHT_UNIT' => Configuration::get('PS_WEIGHT_UNIT'), 'MR_order_states_list' => OrderState::getOrderStates($this->context->language->id), 'MR_MONDIAL_RELAY_ORDER_STATE' => Configuration::get('MONDIAL_RELAY_ORDER_STATE'), 'MR_CRON_URL' => Tools::getHttpHost(true, true) . _MODULE_DIR_ . $this->name . '/cron.php?secure_key=' . Configuration::get('MONDIAL_RELAY_SECURE_KEY'), 'MR_name' => Tools::getValue('MR_name') ? Tools::getValue('MR_name') : '', 'MR_carriers_list' => $carriers_list, 'MR_error_list' => $this->_postErrors, 'MR_form_action' => $post_action, 'MR_PS_ADMIN_IMG_' => _PS_ADMIN_IMG_, 'MR_tab_selected' => Tools::getValue('MR_tab_name') ? Tools::getValue('MR_tab_name') : (MondialRelay::isAccountSet() ? 'account_form' : 'info_form'), 'MR_delay' => Tools::getValue('MR_delay') ? Tools::getValue('MR_delay') : '', 'MR_local_path' => MondialRelay::$modulePath, 'MR_upgrade_detail' => $this->upgrade_detail, 'MR_unit_weight_used' => Configuration::get('PS_WEIGHT_UNIT'), 'MR_account_set' => MondialRelay::isAccountSet(), 'MR_base_dir' => MondialRelay::$moduleURL));
        return $this->fetchTemplate('/tpl/', 'configuration');
    }
 private function _displayFormOld()
 {
     $order_states = array();
     foreach (OrderState::getOrderStates($this->context->cookie->id_lang) as $state) {
         array_push($order_states, array('id_option' => $state['id_order_state'], 'name' => $state['name']));
     }
     $this->context->smarty->assign(array('form_url' => Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']), 'api_version' => htmlentities(Configuration::get('VT_API_VERSION'), ENT_COMPAT, 'UTF-8'), 'api_versions' => array(1 => 'v1', 2 => 'v2'), 'client_key' => htmlentities(Configuration::get('VT_CLIENT_KEY'), ENT_COMPAT, 'UTF-8'), 'server_key' => htmlentities(Configuration::get('VT_SERVER_KEY'), ENT_COMPAT, 'UTF-8'), 'environments' => array(false => 'Development', true => 'Production'), 'environment' => htmlentities(Configuration::get('VT_ENVIRONMENT'), ENT_COMPAT, 'UTF-8'), 'enable_3d_secure' => htmlentities(Configuration::get('VT_3D_SECURE'), ENT_COMPAT, 'UTF-8'), 'enable_sanitized' => htmlentities(Configuration::get('VT_SANITIZED'), ENT_COMPAT, 'UTF-8'), 'enabled_cimb' => htmlentities(Configuration::get('ENABLED_CIMB'), ENT_COMPAT, 'UTF-8'), 'enabled_mandiri' => htmlentities(Configuration::get('ENABLED_MANDIRI'), ENT_COMPAT, 'UTF-8'), 'enabled_permatava' => htmlentities(Configuration::get('ENABLED_PERMATAVA'), ENT_COMPAT, 'UTF-8'), 'enabled_indomaret' => htmlentities(Configuration::get('ENABLED_INDOMARET'), ENT_COMPAT, 'UTF-8'), 'enabled_indosat_dompetku' => htmlentities(Configuration::get('ENABLED_INDOSAT_DOMPETKU'), ENT_COMPAT, 'UTF-8'), 'enabled_mandiri_ecash' => htmlentities(Configuration::get('ENABLED_MANDIRI_ECASH'), ENT_COMPAT, 'UTF-8'), 'statuses' => $order_states, 'payment_success_status_map' => htmlentities(Configuration::get('VT_PAYMENT_SUCCESS_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'payment_challenge_status_map' => htmlentities(Configuration::get('VT_PAYMENT_CHALLENGE_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'payment_failure_status_map' => htmlentities(Configuration::get('VT_PAYMENT_FAILURE_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'kurs' => htmlentities(Configuration::get('VT_KURS', $this->veritrans_kurs), ENT_COMPAT, 'UTF-8'), 'convenience_fee' => htmlentities(Configuration::get('VT_CONVENIENCE_FEE', $this->veritrans_convenience_fee), ENT_COMPAT, 'UTF-8'), 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/'));
     $output = $this->context->smarty->fetch(__DIR__ . '/views/templates/hook/admin_retro.tpl');
     $this->_html .= $output;
 }
}
$useLangFromCookie = false;
$languages = Language::getLanguages();
if ($allowEmployeeFormLang) {
    foreach ($languages as $lang) {
        if ($cookie->employee_form_lang == $lang['id_lang']) {
            $useLangFromCookie = true;
        }
    }
}
if (!$useLangFromCookie) {
    $language = intval(Configuration::get('PS_LANG_DEFAULT'));
} else {
    $language = intval($cookie->employee_form_lang);
}
$orderStates = OrderState::getOrderStates(intval($language));
$merchantId = array_key_exists('ECARD_MERCHANTID', $conf) ? $conf['ECARD_MERCHANTID'] : '';
$pass = array_key_exists('ECARD_PASS', $conf) ? $conf['ECARD_PASS'] : '';
$newOrderState = array_key_exists('ECARD_PENDING', $conf) ? $conf['ECARD_PENDING'] : '';
$status_closed = array_key_exists('ECARD_CLOSED', $conf) ? $conf['ECARD_CLOSED'] : '';
$status_declined = array_key_exists('ECARD_DECLINED', $conf) ? $conf['ECARD_DECLINED'] : '';
$status_undefined = array_key_exists('ECARD_UNDEFINED', $conf) ? $conf['ECARD_UNDEFINED'] : '';
//$serverletHs    = array_key_exists('ECARD_SERVERLETHS', $conf) ? $conf['ECARD_SERVERLETHS'] : '';
//$serverletPs    = array_key_exists('ECARD_SERVERLETPS', $conf) ? $conf['ECARD_SERVERLETPS'] : '';
$this->_html .= '<form action="' . $_SERVER['REQUEST_URI'] . '" method="POST" style="clear: both">
    <p>
    <fieldset>
        <legend> <img src="' . _MODULE_DIR_ . $this->name . '/logo.gif" />' . $this->l('Settings') . '</legend>
        <label> ' . $this->l('Merchant ID') . '</label>
        <div class="margin-form">
            <input type="text" size="33" name="ecard_merchantid" value="' . htmlentities($merchantId, ENT_COMPAT, 'UTF-8') . '" />
Example #29
0
 public function renderView()
 {
     $order = new Order(Tools::getValue('id_order'));
     if (!Validate::isLoadedObject($order)) {
         $this->errors[] = Tools::displayError('The order cannot be found within your database.');
     }
     $customer = new Customer($order->id_customer);
     $carrier = new Carrier($order->id_carrier);
     $products = $this->getProducts($order);
     $currency = new Currency((int) $order->id_currency);
     // Carrier module call
     $carrier_module_call = null;
     if ($carrier->is_module) {
         $module = Module::getInstanceByName($carrier->external_module_name);
         if (method_exists($module, 'displayInfoByCart')) {
             $carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
         }
     }
     // Retrieve addresses information
     $addressInvoice = new Address($order->id_address_invoice, $this->context->language->id);
     if (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state) {
         $invoiceState = new State((int) $addressInvoice->id_state);
     }
     if ($order->id_address_invoice == $order->id_address_delivery) {
         $addressDelivery = $addressInvoice;
         if (isset($invoiceState)) {
             $deliveryState = $invoiceState;
         }
     } else {
         $addressDelivery = new Address($order->id_address_delivery, $this->context->language->id);
         if (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) {
             $deliveryState = new State((int) $addressDelivery->id_state);
         }
     }
     $this->toolbar_title = sprintf($this->l('Order #%1$d (%2$s) - %3$s %4$s'), $order->id, $order->reference, $customer->firstname, $customer->lastname);
     if (Shop::isFeatureActive()) {
         $shop = new Shop((int) $order->id_shop);
         $this->toolbar_title .= ' - ' . sprintf($this->l('Shop: %s'), $shop->name);
     }
     // gets warehouses to ship products, if and only if advanced stock management is activated
     $warehouse_list = null;
     $order_details = $order->getOrderDetailList();
     foreach ($order_details as $order_detail) {
         $product = new Product($order_detail['product_id']);
         if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management) {
             $warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
             foreach ($warehouses as $warehouse) {
                 if (!isset($warehouse_list[$warehouse['id_warehouse']])) {
                     $warehouse_list[$warehouse['id_warehouse']] = $warehouse;
                 }
             }
         }
     }
     $payment_methods = array();
     foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
         $module = Module::getInstanceByName($payment['name']);
         if (Validate::isLoadedObject($module) && $module->active) {
             $payment_methods[] = $module->displayName;
         }
     }
     // display warning if there are products out of stock
     $display_out_of_stock_warning = false;
     $current_order_state = $order->getCurrentOrderState();
     if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
         $display_out_of_stock_warning = true;
     }
     // products current stock (from stock_available)
     foreach ($products as &$product) {
         $product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
         $resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
         $product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
         $product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
         $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
         $product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
         $product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
         // if the current stock requires a warning
         if ($product['current_stock'] == 0 && $display_out_of_stock_warning) {
             $this->displayWarning($this->l('This product is out of stock: ') . ' ' . $product['product_name']);
         }
         if ($product['id_warehouse'] != 0) {
             $warehouse = new Warehouse((int) $product['id_warehouse']);
             $product['warehouse_name'] = $warehouse->name;
         } else {
             $product['warehouse_name'] = '--';
         }
     }
     $gender = new Gender((int) $customer->id_gender, $this->context->language->id);
     $history = $order->getHistory($this->context->language->id);
     foreach ($history as &$order_state) {
         $order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
     }
     // Smarty assign
     $this->tpl_view_vars = array('order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'));
     return parent::renderView();
 }
    public function ajaxGetOrdersWithSameProduct()
    {
        if (Tools::isSubmit('id_order')) {
            $action_type = Tools::isSubmit('type') ? Tools::getValue('type') : 'customer';
            require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/order/ErpOrder.php';
            /*Get list of active states */
            $status_actifs = array();
            $order_states = OrderState::getOrderStates((int) $this->context->language->id);
            foreach ($order_states as $state) {
                if (Configuration::get('ERP_STATUS_WARNING_STOCK_' . $state['id_order_state']) == 'on') {
                    $status_actifs[] = $state['id_order_state'];
                }
            }
            $objOrder = new ErpOrder((int) Tools::getValue('id_order'));
            $produits = $objOrder->getListOfProducts($action_type);
            $message = '<table id=\'erp_commande_pastille_orange_table\'>
						<tr id="entete_pastille_orange">
                                                    <th align="center">' . $this->l('Order id') . '</th>
                                                    <th align="center">' . $this->l('Order reference') . '</th>
                                                    <th align="center">' . $this->l('Date') . '</th>
                                                    <th align="center">' . $this->l('Total te') . '</th>
                                                    <th align="center">' . $this->l('Details') . '</th>
						</tr>';
            $tabOrdersDejaPasses = array();
            foreach ($produits as &$prod) {
                /*Check if not order elsewhere*/
                $tabOrders = ErpOrder::getOrdersByProductAndAttribute($prod['product_id'], $prod['product_attribute_id']);
                foreach ($tabOrders as &$order) {
                    $objOrderCorespondant = new ErpOrder($order['id_order']);
                    if (array_search($objOrderCorespondant->current_state, $status_actifs) !== false && $order['id_order'] != Tools::getValue('id_order') && array_search($order['id_order'], $tabOrdersDejaPasses) === false) {
                        $order_token = Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $this->context->employee->id);
                        $advanced_order_token = Tools::getAdminToken('AdminAdvancedOrder' . (int) Tab::getIdFromClassName('AdminAdvancedOrder') . (int) $this->context->employee->id);
                        $message .= '<tr>';
                        $message .= '<td align="center" class="row_pastille_orange">' . (int) $objOrderCorespondant->id . '</td>';
                        $message .= '<td align="center" class="row_pastille_orange"><a target="_blank" href=\'?controller=AdminOrders&id_order=' . (int) $objOrderCorespondant->id . '&vieworder&token=' . $order_token . '\' target=\'_blank\'>' . $objOrderCorespondant->reference . '</td>';
                        $message .= '<td align="center" class="row_pastille_orange">' . Tools::displayDate($objOrderCorespondant->date_add) . '</td>';
                        $message .= '<td align="center" class="row_pastille_orange">' . Tools::displayPrice($objOrderCorespondant->total_paid) . '</td>';
                        $message .= '<td align="center" class="row_pastille_orange">
										<a class="pointer" id="details_detailsAjax_' . (int) $objOrderCorespondant->id . '" title="Details"
											href="javascript:void(0)" onclick="display_action_details(
													\'' . (int) $objOrderCorespondant->id . '\',
													\'AdminAdvancedOrder\',
													\'' . $advanced_order_token . '\',
													\'detailsAjax\',
													{
														&quot;action&quot;:&quot;detailsAjax&quot;
													});
													return false">
											<img src="../img/admin/more.png" alt="Details" />
										</a>
									</td>';
                        $message .= '</tr>';
                        $tabOrdersDejaPasses[] = $order['id_order'];
                    }
                }
            }
            $message .= '</table>';
            print $message;
        }
    }