public function hookAdminOrder($params) { if (Configuration::get('OSI_HOOK_ADMIN_ORDER') == 1) { global $cookie; $order = new Order($params['id_order']); $return = Db::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'opensi_order WHERE id_order = \'' . (int) $order->id . '\' LIMIT 1'); $html = ' <br /><br /> <fieldset style="width:400px"> <legend><img src="' . $this->_path . 'logo.gif" alt="" /> ' . $this->l('Sync with OpenSi') . '</legend> '; /* * Check if upgrade is available */ if (@ini_get('allow_url_fopen') and $update = GlobalConfig::checkOpenSiVersion($this->version)) { $html .= '<div class="warn">' . $this->l('New OpenSi version available') . '<br /><a style="text-decoration: underline;" href="' . $update['link'] . '">' . $this->l('Download') . ' ' . $update['name'] . '</a> !</div>'; } /* * Is the order synchronized with OpenSi ? */ if (isset($return[0]['id_order'])) { $html .= $this->l('Order synchronized with OpenSi the :') . ' ' . Tools::displayDate($return[0]['date_order_synchro'], (int) $cookie->id_lang, true); } else { $html .= $this->l('Order not synchronized with OpenSi.'); } /* Display links of OpenSi invoices if available */ $query = 'SELECT * FROM ' . _DB_PREFIX_ . 'opensi_invoice WHERE id_order = \'' . (int) $order->id . '\''; if ($links = Db::getInstance()->ExecuteS($query)) { $html .= '<br />'; $i = 0; foreach ($links as $link) { $html .= '<br /><img src="' . $this->_path . 'img/invoice.png" alt="" /> <a href="' . _PS_BASE_URL_ . __PS_BASE_URI__ . $this->_moduleUri . 'getInvoice.php?key=' . $link['url_key'] . '">'; if ($link['type'] == 'F') { $html .= $this->l('Invoice') . ' ' . $link['number_invoice'] . '.pdf'; } else { if ($link['type'] == 'A') { $html .= $this->l('Credit') . ' ' . $link['number_invoice'] . '.pdf'; } } $html .= '</a>'; $i++; } } $html .= '</fieldset>'; return $html; } }