bebeboutik/modules/labelgenerate/AdminLabelGenerate.php
2017-04-13 14:10:43 +02:00

611 lines
35 KiB
PHP

<?php
if(!defined('_PS_VERSION_')) {
exit;
}
require_once dirname(__FILE__).'/../privatesales/Sale.php';
require_once dirname(__FILE__).'/models/generatebarcode.php';
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
class AdminLabelGenerate extends AdminTab {
public $_html = '';
public function display() {
global $cookie;
$rack = Tools::getValue('rack');
$current_sale = Tools::getValue('id_sale');
if ($rack) {
// button commenté en fin de page
$barcode = new GenerateBarcode();
$barcode->createRackFolder();
$rackCodes = array();
for ($i=0;$i<21;$i++) {
for ($j=1;$j<6;$j++) {
$name = $i.$j;
$barcode->generateRack($name);
$rackCodes[] = $name;
}
}
$barcode->printRackPDF($rackCodes);
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/rack/rack.pdf')) {
$this->displaySucess('Rack générés : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/rack/rack.pdf">Télécharger le PDF rack</a>');
}
} elseif ($current_sale && Tools::getValue('generateRef')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
$products_generate = array();
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$combination['id_product'] .'
AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].'
AND o.valid != 0'
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
}
}
} else {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.valid != 0'
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
}
}
}
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/reference.pdf')) {
$this->displayWarning('Les références ont déjà été générées<br>Dernières ref générées : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/reference.pdf">Télécharger le PDF</a>');
} else {
if($barcode->printPDF($big_label, 'reference')) {
$this->displaySucess('Génération terminée : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/reference.pdf">Télécharger le PDF</a>');
} else {
$this->_html .= $this->displayError('Pas de produit à générer !');
}
}
}
} elseif ($current_sale && Tools::getValue('deleteEAN')) {
$sale = new Sale((int)$current_sale);
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
if (!empty($combination['ean13'])) {
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product_attribute`
SET `ean13` = ""
WHERE `id_product` = ' . (int)$product->id .'
AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = ""
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
}
}
} else {
if (!empty($product->ean13)) {
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product`
SET `ean13` = ""
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = ""
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = 0
');
}
}
}
$this->_html .= $this->displaySuccess('Suppression terminée');
}
} elseif ($current_sale && Tools::getValue('generateALLEAN')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
$ean_generate = '';
$products_generate = array();
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
$count = 0;
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
$quantity = 0;
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$combination['id_product'] .'
AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].'
AND o.`valid` != 0'
);
foreach ($result_quantities as $od) {
$quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']);
}
if($quantity>0){
$count++;
if (empty($combination['ean13'])) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product_attribute`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
} else {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference, $combination['ean13']);
}
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
}
}
} else {
$quantity = 0;
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0'
);
foreach ($result_quantities as $od) {
$quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']);
}
if($quantity>0){
$count++;
if (empty($product->ean13)) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = 0
');
} else {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference, $product->ean13);
}
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
}
}
}
if (!empty($ean_generate)) {
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf');
}
if($barcode->printPDF($big_label,'barcode_all')) {
$this->_html .= $this->displaySuccess('Génération terminée :<br><a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf">Télécharger le PDF</a>');
} else {
$this->_html .= $this->displayError('Pas de produit à générer !');
}
} else {
$message = 'Aucun ean trouvé ou généré !';
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
$message .= '<br>Dernières étiquettes générées : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf">Télécharger le PDF</a>';
}
$this->_html .= $this->displayWarning($message);
}
}
} elseif ($current_sale && Tools::getValue('generateALLEAN_initial')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
$ean_generate = '';
$products_generate = array();
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
$quantity = (int)$combination['quantity'];
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$combination['id_product'] .'
AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].'
AND o.`valid` != 0'
);
foreach ($result_quantities as $od) {
$quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']);
}
if (empty($combination['ean13'])) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product_attribute`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
} else {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference, $combination['ean13']);
}
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
}
} else {
$quantity = $product->quantity;
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0'
);
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if (empty($product->ean13)) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = 0
');
} else {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference, $product->ean13);
}
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
}
}
if (!empty($ean_generate)) {
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf');
}
if($barcode->printPDF($big_label,'barcode_all_initial')) {
$this->_html .= $this->displaySuccess('Génération terminée :<br><a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf">Télécharger le PDF</a>');
} else {
$this->_html .= $this->displayError('Pas de produit à générer !');
}
} else {
$message = 'Aucun ean trouvé ou généré !';
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
$message .= '<br>Dernières étiquettes générées : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf">Télécharger le PDF</a>';
}
$this->_html .= $this->displayWarning($message);
}
}
} elseif ($current_sale && Tools::getValue('generateEAN')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
$ean_generate = '';
$products_generate = array();
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
if (empty($combination['ean13'])) {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$combination['id_product'] .'
AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].'
AND o.`valid` != 0'
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product_attribute`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
}
}
}
} else {
if (empty($product->ean13)) {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0'
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
Db::getInstance()->execute('
UPDATE
`'._DB_PREFIX_.'product`
SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
UPDATE
`'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
AND `product_attribute_id` = 0
');
}
}
}
}
if (!empty($ean_generate)) {
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf');
}
if($barcode->printPDF($big_label)) {
$this->_html .= $this->displaySuccess('Génération terminée :<br><a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf">Télécharger le PDF</a>');
} else {
$this->_html .= $this->displayError('Pas de produit à générer !');
}
} else {
$message = 'Tous les produits de la vente ont déjà des EANS';
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
$message .= '<br>Dernières étiquettes générées : <a class="btn btn-primary btn-xs" target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf">Télécharger le PDF</a>';
}
$this->_html .= $this->displayWarning($message);
}
}
}
$helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true;
$helperForm->_inputSwitch = true;
$id_sale_options = array();
foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) {
$id_sale_options[(int)$sale->id] = array(
'label' => $sale->id.' - '.$sale->title[(int) $cookie->id_lang],
'value' => (int) $sale->id
);
if($sale->id == $current_sale) {
$id_sale_options[(int)$sale->id]['selected'] = true;
}
}
$this->_html .= $helperForm->renderStyle();
$this->_html .= '<div class="panel">
<div class="panel-title">
<h2><span class="anticon anticon-barcode"></span> '.$this->l('Génération EAN').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<div class="col-md-5 col-md-offset-3">';
$input = array(
'type' => 'select2',
'label' => $this->l('Select a sale:'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'id_sale',
'id' => 'id_sale',
'options' => $id_sale_options,
);
$this->_html .= $helperForm->generateInput($input);
$input = array(
'type' => 'switch',
'label' => '',
'label-class' => 'col-md-4',
'input-class' => 'col-md-6',
'class-group' => 'switch',
'name' => 'big_label',
'title' => $this->l('Big labels ?'),
);
$this->_html .= $helperForm->generateInput($input).'
<div class="clearfix"></div>
</div>
<div class="col-md-3 col-md-offset-1 lateral-solid-l">
<p class="hidden"><button class="btn btn-primary" id="generateRef" data-toggle="tooltip" data-placement="left" title="Produits vendus">Générer Refs</button></p>
<p><button class="btn btn-primary" id="generateEAN" data-toggle="tooltip" data-placement="left" title="EAN manquants des quantités vendus">Générer EANs (manquants)</button></p>
<p><button class="btn btn-primary" id="generateALLEAN" data-toggle="tooltip" data-placement="left" title="Tous les EAN et génère les manquants des quantités vendus">Générer EANs (qté vendus)</button></p>
<p><button class="btn btn-primary" id="generateALLEAN_initial" data-toggle="tooltip" data-placement="left" title="Tous les EAN et génère les manquants des quantités initiales">Générer EANs (qté initiales)</button></p>
<p><button class="btn btn-default" id="deleteEAN" data-toggle="tooltip" data-placement="left" title="Supprimer tous les EAN de la vente">Supprimer les EANs</button></p>
<p class="hidden"><button class="hidden btn btn-default" id="generateRack">Générer Rack</button></p>
</div>
<div class="clear"></div>
</div>
</div>';
$helperForm->_js .='<script type="text/javascript">
$(function() {
var big_label = 0;
$(\'[data-toggle="tooltip"]\').tooltip();
$(\'.js-switch\').change(function(){
if($(this).is(\':checked\')) {
big_label = 1;
}
});
$("#generateEAN").click(function(){
if ($("#id_sale").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateEAN=1&big_label=\'+ big_label +\'&id_sale=\' + $("#id_sale").val();
}
});
$("#generateRef").click(function(){
if ($("#id_sale").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateRef=1&big_label=\'+ big_label +\'&id_sale=\' + $("#id_sale").val();
}
});
$("#generateALLEAN").click(function(){
if ($("#id_sale").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateALLEAN=1&big_label=\'+ big_label +\'&id_sale=\' + $("#id_sale").val();
}
});
$("#generateALLEAN_initial").click(function(){
if ($("#id_sale").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateALLEAN_initial=1&big_label=\'+ big_label +\'&id_sale=\' + $("#id_sale").val();
}
});
$("#deleteEAN").click(function(){
ok = confirm("Êtes vous sur de vouloir supprimer les eans de cette vente ?")
if (ok == true){
if ($("#id_sale").val() != 999999) {
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&deleteEAN=1&id_sale=\' + $("#id_sale").val();
}
}
});
$("#generateRack").click(function(){
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&rack=1\';
});
});
</script>';
$this->_html .= $helperForm->renderScript();
echo $this->_html;
}
public function displaySuccess($message){
return '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-ok" style="margin-bottom: 10px;">
<i class="glyphicon glyphicon-ok"></i> <span class="text-alert">'.$message.'</span>
</div>';
}
public function displayWarning($message){
return '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-warning" style="margin-bottom: 10px;">
<i class="anticon anticon-notification"></i> <span class="text-alert">'.$message.'</span>
</div>';
}
public function displayError($message){
return '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-error" style="margin-bottom: 10px;">
<i class="glyphicon glyphicon-remove"></i> <span class="text-alert">'.$message.'</span>
</div>';
}
}