Merge remote-tracking branch 'origin/ticket/r15862-label_refbbb'
This commit is contained in:
commit
f2462e6bc3
@ -505,7 +505,6 @@ class AdminLabelGenerate extends AdminTab
|
||||
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
|
||||
}
|
||||
if ($quantity > 0) {
|
||||
$barcode->generateIdentification($combination['id_product'], $combination['id_product_attribute'], $product->reference, $combination['attribute_name']);
|
||||
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
|
||||
}
|
||||
}
|
||||
@ -523,9 +522,7 @@ class AdminLabelGenerate extends AdminTab
|
||||
foreach ($result_quantities as $od) {
|
||||
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
|
||||
}
|
||||
|
||||
if ($quantity > 0) {
|
||||
$barcode->generateIdentification($product->id, null, $product->reference);
|
||||
$barcode->assocProduct($product->id, null, $quantity, $product->reference);
|
||||
}
|
||||
}
|
||||
@ -659,7 +656,7 @@ class AdminLabelGenerate extends AdminTab
|
||||
});
|
||||
|
||||
$("#generateIdentification").click(function(){
|
||||
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateIdentification=1&id_sale=\'+$("#id_sale").val();
|
||||
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateIdentification=1&big_label=\'+ big_label +\'&id_sale=\'+$("#id_sale").val();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
@ -116,32 +116,6 @@ class GenerateBarcode
|
||||
|
||||
return $ean;
|
||||
}
|
||||
|
||||
public function generateIdentification($id_product, $id_product_attribute = null, $reference = null, $attribute_ref = null, $big_label = false)
|
||||
{
|
||||
$width = 320;
|
||||
$height = 80;
|
||||
$font = dirname(__FILE__).'/arial.ttf';
|
||||
|
||||
preg_match('/.*-(.*)-.*/', $reference, $matches);
|
||||
$ref = $matches[1];
|
||||
|
||||
$im = imagecreatetruecolor($width, $height);
|
||||
$black = ImageColorAllocate($im, 0x00, 0x00, 0x00);
|
||||
$white = ImageColorAllocate($im, 0xff, 0xff, 0xff);
|
||||
imagefilledrectangle($im, 0, 0, $width, $height, $white);
|
||||
|
||||
imagettftext($im, 40, 0, 10, 40, $black, $font, $ref);
|
||||
|
||||
if ($id_product_attribute === null) {
|
||||
$result = imagegif($im, $this->directory.'/id-'.$id_product.'-0.gif');
|
||||
} else {
|
||||
imagettftext($im, 12, 0, 110, 40 , $black, $font, $attribute_ref);
|
||||
$result = imagegif($im, $this->directory.'/id-'.$id_product.'-'.$id_product_attribute.'.gif');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function _getEanNumber()
|
||||
{
|
||||
@ -296,7 +270,7 @@ class GenerateBarcode
|
||||
if (empty($product)) {
|
||||
$pdf->Cell($width, $height_text, '', 0,0, 'C');
|
||||
} else {
|
||||
$this->_printLabel($pdf, $product['ref'], 1,$width,$height_text, $font_size_ref);
|
||||
$this->_printLabel($pdf, $product['ref'], 1, $width, $height_text, $font_size_ref);
|
||||
}
|
||||
}
|
||||
$pdf->Ln(($ln_text));
|
||||
@ -306,7 +280,7 @@ class GenerateBarcode
|
||||
if (empty($product)) {
|
||||
$pdf->Cell($width, $height_text, '', 0,0, 'C');
|
||||
} else {
|
||||
$this->_printLabel($pdf, $product['label'], 1,$width,$height_text, $font_size);
|
||||
$this->_printLabel($pdf, $product['label'], 1, $width, $height_text, $font_size);
|
||||
}
|
||||
}
|
||||
$pdf->Ln(($ln_text));
|
||||
@ -335,6 +309,8 @@ class GenerateBarcode
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$big_label = true;
|
||||
|
||||
if ($big_label) {
|
||||
// 52*30
|
||||
$width = 51.5;
|
||||
@ -389,12 +365,26 @@ class GenerateBarcode
|
||||
$nb_per_page = 0;
|
||||
}
|
||||
|
||||
foreach ($product_per_line as $key => $product) {
|
||||
if (empty($product)) {
|
||||
$pdf->Cell($width, $height_label, '', 0, 0, 'C');
|
||||
}
|
||||
// Mark in ref
|
||||
else {
|
||||
preg_match('/.*-(.*)-.*/', $product['ref'], $matches);
|
||||
$ref = $matches[1];
|
||||
$this->_printIdMark($pdf, $ref, 1, $width, $height_label, 30);
|
||||
}
|
||||
}
|
||||
$pdf->Ln($ln_text+$ln_text);
|
||||
|
||||
foreach ($product_per_line as $key => $product) {
|
||||
if (empty($product)) {
|
||||
$pdf->Cell($width, $height_label, '', 0, 0, 'C');
|
||||
} else {
|
||||
$image = $this->directory.'/id-'.$product['key'].'.gif';
|
||||
$this->_printEAN($pdf, $image, 1, $width, $height_label);
|
||||
}
|
||||
// Attribute name
|
||||
else {
|
||||
$this->_printIdMark($pdf, $product['label'], 1, $width, $height_label, 9);
|
||||
}
|
||||
}
|
||||
$pdf->Ln($ln_label);
|
||||
@ -424,6 +414,14 @@ class GenerateBarcode
|
||||
$pdf->Cell($width, $height, $pdf->Image($ean_image, $pdf->GetX(), $pdf->GetY(),($width-2), $height), 0,0, 'C');
|
||||
}
|
||||
}
|
||||
|
||||
private function _printIdMark($pdf, $label, $limit = 1, $width = 48, $height = 4, $font_size = 5)
|
||||
{
|
||||
$pdf->SetFont('Arial', '', $font_size);
|
||||
for ($i=0; $i < $limit; $i++) {
|
||||
$pdf->Cell($width, $height, substr(utf8_decode($label), 0, 30), 0, 0, 'C');
|
||||
}
|
||||
}
|
||||
|
||||
private function _multiSortProduct($products = array())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user