enable or disable the erporder in defines.inc.php - disabled here

This commit is contained in:
Rodney Figaro 2017-02-08 15:37:01 +01:00
parent 1286c72a02
commit 71db3fc055
2 changed files with 42 additions and 16 deletions

View File

@ -26,7 +26,7 @@
/* Debug only */
if (!defined('_PS_MODE_DEV_')) {
if (in_array($_SERVER['REMOTE_ADDR'], array('88.163.22.99'))) {
if (in_array($_SERVER['REMOTE_ADDR'], array('88.163.22.99', '127.0.0.1'))) {
define('_PS_MODE_DEV_', false);
}
else {
@ -230,15 +230,32 @@ if (!defined('_PS_JQUERY_VERSION_')) {
define('_PS_JQUERY_VERSION_', '1.11.0');
}
define('TEST_DISABLE_ERP', true);
// if ($_SERVER['REMOTE_ADDR'] != '88.163.22.99') {
// define('ERP_URL', 'http://roykin.erp-odoo.fr:8069');
define('ERP_URL', 'http://137.74.168.224:8069');
define('ERP_DB', 'roykin');
// } else {
// define('ERP_DB', 'roykin_test');
// }
if (defined('TEST_DISABLE_ERP') && TEST_DISABLE_ERP) {
// if ($_SERVER['REMOTE_ADDR'] != '88.163.22.99') {
// define('ERP_URL', 'http://roykin.erp-odoo.fr:8069');
define('ERP_URL', '');
define('ERP_DB', '');
// } else {
// define('ERP_DB', 'roykin_test');
// }
define('ERP_USERNAME', 'admin');
define('ERP_PASSWORD', 'AdmiROYkin2016');
define('ERP_SCRIPT_TOKEN', 'Wq56lnviuXAQCMFHV9YHJnGk3RXMLMTkz0xhIu6U');
define('ERP_USERNAME', '');
define('ERP_PASSWORD', '');
define('ERP_SCRIPT_TOKEN', 'Wq56lnviuXAQCMFHV9YHJnGk3RXMLMTkz0xhIu6U');
}
else {
// if ($_SERVER['REMOTE_ADDR'] != '88.163.22.99') {
// define('ERP_URL', 'http://roykin.erp-odoo.fr:8069');
define('ERP_URL', 'http://137.74.168.224:8069');
define('ERP_DB', 'roykin');
// } else {
// define('ERP_DB', 'roykin_test');
// }
define('ERP_USERNAME', 'admin');
define('ERP_PASSWORD', 'AdmiROYkin2016');
define('ERP_SCRIPT_TOKEN', 'Wq56lnviuXAQCMFHV9YHJnGk3RXMLMTkz0xhIu6U');
}

View File

@ -45,12 +45,14 @@ class Erporder extends Module
$this->displayName = $this->l('Erp order');
$this->description = $this->l('Sync order in Odoo');
$this->common = ripcord::client(ERP_URL.'/xmlrpc/2/common');
$this->common->version();
$this->uid = $this->common->authenticate(ERP_DB, ERP_USERNAME, ERP_PASSWORD, array());
if (defined('TEST_DISABLE_ERP') && !TEST_DISABLE_ERP) {
$this->common = ripcord::client(ERP_URL.'/xmlrpc/2/common');
$this->common->version();
$this->uid = $this->common->authenticate(ERP_DB, ERP_USERNAME, ERP_PASSWORD, array());
$this->model = ripcord::client(ERP_URL.'/xmlrpc/2/object');
$this->report = ripcord::client(ERP_URL.'/xmlrpc/2/report');
$this->model = ripcord::client(ERP_URL.'/xmlrpc/2/object');
$this->report = ripcord::client(ERP_URL.'/xmlrpc/2/report');
}
}
public function install()
@ -63,6 +65,9 @@ class Erporder extends Module
public function hookActionOrderStatusPostUpdate($params)
{
if (defined('TEST_DISABLE_ERP') && TEST_DISABLE_ERP) {
return;
}
$order = new Order($params['id_order']);
@ -268,6 +273,10 @@ class Erporder extends Module
public function hookActionPDFInvoiceRender($params)
{
if (defined('TEST_DISABLE_ERP') && TEST_DISABLE_ERP) {
return;
}
if (!Tools::getValue('id_order')) {
die(Tools::displayError('Order was not found.'));
}