mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Adding the PDF option displaying the product's barcode number (#26345)
* Add a PDF option to show barcode number of product * Add space before and after IF keyword * fix error phpcs * add barcode label before barcode number * Use outputlangs and not langs --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
636f9eaced
commit
08ef416958
|
|
@ -132,6 +132,10 @@ if ($action == 'update') {
|
|||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE')) {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) {
|
||||
dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
|
@ -532,6 +536,18 @@ if ($conf->use_javascript_ajax) {
|
|||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Barcode
|
||||
|
||||
if (isModEnabled('barcode')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProductBarcodeOnPDF").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Desc
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
|
|
|
|||
|
|
@ -2286,7 +2286,7 @@ class Facture extends CommonInvoice
|
|||
$sql .= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||
$sql .= ' l.fk_unit,';
|
||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc, p.barcode as product_barcode';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql .= ' WHERE l.fk_facture = '.((int) $this->id);
|
||||
|
|
@ -2312,6 +2312,7 @@ class Facture extends CommonInvoice
|
|||
$line->product_ref = $objp->product_ref; // Ref product
|
||||
$line->libelle = $objp->product_label; // deprecated
|
||||
$line->product_label = $objp->product_label; // Label product
|
||||
$line->product_barcode = $objp->product_barcode; // Barcode number product
|
||||
$line->product_desc = $objp->product_desc; // Description product
|
||||
$line->fk_product_type = $objp->fk_product_type; // Type of product
|
||||
$line->qty = $objp->qty;
|
||||
|
|
|
|||
|
|
@ -1459,6 +1459,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
|||
|
||||
$idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
|
||||
$label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : ''));
|
||||
$product_barcode = (!empty($object->lines[$i]->product_barcode) ? $object->lines[$i]->product_barcode : "");
|
||||
$desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : ''));
|
||||
$ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
|
||||
$note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
|
||||
|
|
@ -1546,6 +1547,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
|||
}
|
||||
}
|
||||
|
||||
if (isModEnabled('barcode') && getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE') && !empty($product_barcode)) {
|
||||
$libelleproduitservice = dol_concatdesc($libelleproduitservice, $outputlangs->trans("BarCode")." ".$product_barcode);
|
||||
}
|
||||
|
||||
// Description long of product line
|
||||
if (!empty($desc) && ($desc != $label)) {
|
||||
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
|
||||
|
|
|
|||
|
|
@ -1561,7 +1561,7 @@ class Expedition extends CommonObject
|
|||
$sql .= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
|
||||
$sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||
$sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||
$sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type, p.barcode as product_barcode";
|
||||
$sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
|
||||
|
|
@ -1623,6 +1623,7 @@ class Expedition extends CommonObject
|
|||
$line->product_ref = $obj->product_ref;
|
||||
$line->product_label = $obj->product_label;
|
||||
$line->libelle = $obj->product_label; // TODO deprecated
|
||||
$line->product_barcode = $obj->product_barcode; // Barcode number product
|
||||
$line->product_tosell = $obj->product_tosell;
|
||||
$line->product_tobuy = $obj->product_tobuy;
|
||||
$line->product_tobatch = $obj->product_tobatch;
|
||||
|
|
|
|||
|
|
@ -1025,7 +1025,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx';
|
||||
$sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn, f.fk_remise_except';
|
||||
$sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
|
||||
$sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
|
||||
$sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.barcode as product_barcode, p.description as product_desc';
|
||||
$sql .= ', f.fk_code_ventilation, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
||||
|
|
@ -1054,6 +1054,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$line->ref_supplier = $obj->ref_supplier;
|
||||
$line->libelle = $obj->label;
|
||||
$line->label = $obj->label;
|
||||
$line->product_barcode = $obj->product_barcode;
|
||||
$line->product_desc = $obj->product_desc;
|
||||
$line->subprice = $obj->pu_ht;
|
||||
$line->pu_ht = $obj->pu_ht;
|
||||
|
|
|
|||
|
|
@ -417,6 +417,7 @@ PDFLocaltax=Rules for %s
|
|||
HideLocalTaxOnPDF=Hide %s rate in column Sale Tax / VAT
|
||||
HideDescOnPDF=Hide products description
|
||||
HideRefOnPDF=Hide products ref.
|
||||
ShowProductBarcodeOnPDF=Display the barcode number of the products
|
||||
HideDetailsOnPDF=Hide product lines details
|
||||
PlaceCustomerAddressToIsoLocation=Use french standard position (La Poste) for customer address position
|
||||
Library=Library
|
||||
|
|
|
|||
|
|
@ -417,6 +417,7 @@ PDFLocaltax=Règles pour %s
|
|||
HideLocalTaxOnPDF=Cacher le taux de %s dans la colonne Taxe
|
||||
HideDescOnPDF=Cacher la description des produits
|
||||
HideRefOnPDF=Cacher la référence des produits
|
||||
ShowProductBarcodeOnPDF=Affiche le numéro de code-barre des produits
|
||||
HideDetailsOnPDF=Cacher les détails des prix sur lignes de produits
|
||||
PlaceCustomerAddressToIsoLocation=Utiliser la position standard française (La Poste) pour la position de l'adresse client
|
||||
Library=Bibliothèque
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user