disable synchro button in adm order

This commit is contained in:
Rodney Figaro 2017-03-16 12:08:00 +01:00
parent fac0185cd9
commit f6d0d7a1c2
2 changed files with 47 additions and 34 deletions

View File

@ -170,6 +170,7 @@
{l s='Partial refund'}
</a>
{/if}
{if $erp_enabled}
{if !$order->isSynchIntoErp()}
<a class="btn btn-default" href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;syncherp=1">
<i class="icon-upload"></i>
@ -181,6 +182,11 @@
{l s='Synchronisée'}
</span>
{/if}
{else}
<span class="span label label-inactive">
{l s='Synchronisation désactivée'}
</span>
{/if}
</div>
<!-- Tab nav -->
<ul class="nav nav-tabs" id="tabOrder">

View File

@ -1522,6 +1522,11 @@ class AdminOrdersControllerCore extends AdminController
}
} elseif (Tools::getValue('syncherp') == 1) {
if (!defined('ERP_ENABLED') || !ERP_ENABLED) {
$this->errors[] = Tools::displayError('La synchro avec Odoo est actuellement désactivée.');
}
else {
$id_order = Tools::getValue('id_order', false);
if ($id_order) {
$order = new Order((int)$id_order);
@ -1557,6 +1562,7 @@ class AdminOrdersControllerCore extends AdminController
}
}
}
}
parent::postProcess();
}
@ -1759,6 +1765,7 @@ class AdminOrdersControllerCore extends AdminController
// Smarty assign
$this->tpl_view_vars = array(
'erp_enabled' => (defined('ERP_ENABLED') && ERP_ENABLED)?true:false,
'order' => $order,
'cart' => new Cart($order->id_cart),
'customer' => $customer,