From cc21257e3ef5f52f31a448e1b3ddd65117da7686 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 7 Oct 2021 09:51:55 +0200 Subject: [PATCH 1/4] NEW print without details --- htdocs/langs/en_US/cashdesk.lang | 3 + htdocs/langs/fr_FR/cashdesk.lang | 3 + htdocs/takepos/admin/receipt.php | 15 +++++ htdocs/takepos/invoice.php | 10 ++- htdocs/takepos/printbox.php | 102 +++++++++++++++++++++++++++++++ htdocs/takepos/receipt.php | 64 +++++++++++-------- 6 files changed, 171 insertions(+), 26 deletions(-) create mode 100644 htdocs/takepos/printbox.php diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 52dc71d140c..22d5afed2fc 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -130,3 +130,6 @@ ShowPriceHT = Display the column with the price excluding tax (on screen) ShowPriceHTOnReceipt = Display the column with the price excluding tax (on the receipt) CustomerDisplay=Customer display SplitSale=Split sale +PrintWithoutDetailsButton=Add "Print without details" button +PrintWithoutDetailsLabelDefault=Line label by default on printing without details +PrintWithoutDetails=Print without details diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 1a2381584ed..45679973a66 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -129,3 +129,6 @@ WeighingScale=échelle de poids ShowPriceHT = Afficher la colonne du prix HT (à l'écran) ShowPriceHTOnReceipt = Afficher la colonne avec le prix hors taxes (sur le ticket de caisse) CustomerDisplay=Customer display +PrintWithoutDetailsButton=Ajouter un bouton "Imprimer sans détail" +PrintWithoutDetailsLabelDefault=Libellé de la ligne par défaut sur l'impression sans détail +PrintWithoutDetails=Imprimer sans détail diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 1fe95ff57d8..7da8436fab8 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -51,6 +51,7 @@ if (GETPOST('action', 'alpha') == 'set') { $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_PAYMENT_METHOD", GETPOST('TAKEPOS_PRINT_PAYMENT_METHOD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', GETPOST('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', 'alphanohtml'), 'chaine', 0, '', $conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -262,6 +263,20 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($con print "\n"; } +// Print without details +print ''; +print $langs->trans('PrintWithoutDetailsButton'); +print ''; +print ajax_constantonoff('TAKEPOS_PRINT_WITHOUT_DETAILS', array(), $conf->entity, 0, 0, 1, 0); +print "\n"; +if (!empty($conf->global->TAKEPOS_PRINT_WITHOUT_DETAILS)) { + print ''; + print $langs->trans('PrintWithoutDetailsLabelDefault'); + print ''; + print ''; + print "\n"; +} + print ''; print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 8b2e5ca78b7..8a6bdcfd2bd 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -158,7 +158,7 @@ if ($ret > 0) { $placeid = $invoice->id; } -$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); $soc = new Societe($db); if ($invoice->socid > 0) { @@ -877,6 +877,9 @@ if ($action == "valid" || $action == "history" || $action == 'creditnote') { $sectionwithinvoicelink .= ' '; } else { $sectionwithinvoicelink .= ' '; + if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) { + $sectionwithinvoicelink .= ' '; + } if (getDolGlobalString('TAKEPOS_GIFT_RECEIPT')) { $sectionwithinvoicelink .= ' '; } @@ -1017,6 +1020,11 @@ function SendTicket(id) $.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:'trans("SendTicket")); ?>'}); } +function PrintBox(id, action) { + console.log("Open box before printing"); + $.colorbox({href:"printbox.php?facid="+id+"&action="+action, width:"80%", height:"200px", transition:"none", iframe:"true", title:"trans("PrintWithoutDetails"); ?>"}); +} + function Print(id, gift){ console.log("Call Print() to generate the receipt."); $.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:'trans("PrintTicket")); ?>'}); diff --git a/htdocs/takepos/printbox.php b/htdocs/takepos/printbox.php new file mode 100644 index 00000000000..cc5f5b305d1 --- /dev/null +++ b/htdocs/takepos/printbox.php @@ -0,0 +1,102 @@ + + * Copyright (C) 2020 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/printbox.php + * \ingroup takepos + * \brief Popup to enter details before printing + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} + +require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; + +global $langs, $db; + +$langs->loadLangs(array("bills", "cashdesk")); + +$facid = GETPOST('facid', 'int'); + +$action = GETPOST('action', 'aZ09'); + +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + +/* + * View + */ + +$arrayofcss = array('/takepos/css/pos.css.php'); +$arrayofjs = array('/takepos/js/jquery.colorbox-min.js'); + +$head = ''; +top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); +?> + + + +
+
+trans('Label') . '">'; + print ''; + } +?> + +
+ + + diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 627a6c99565..df0b55bc64e 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -54,6 +54,7 @@ $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is $facid = GETPOST('facid', 'int'); +$action = GETPOST('action', 'aZ09'); $gift = GETPOST('gift', 'int'); if (empty($user->rights->takepos->run)) { @@ -169,33 +170,46 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) { lines as $line) { - ?> - - - product_label)) { - echo $line->product_label; - } else { - echo $line->description; - } ?> - - qty; ?> - total_ttc / $line->qty, 'MT'), 1); - } ?> - global->TAKEPOS_SHOW_HT_RECEIPT)) { ?> - total_ht, 1); - } ?> + if ($action == 'without_details') { + $qty = GETPOST('qty', 'int') > 0 ? GETPOST('qty', 'int') : 1; + print ''; + print '' . GETPOST('label', 'alphanohtml') . ''; + print '' . $qty . ''; + print '' . price(price2num($object->total_ttc / $qty, 'MU'), 1) . ''; + if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { + print '' . price($object->total_ht, 1) . ''; + } + print '' . price($object->total_ttc, 1) . ''; + print ''; + } else { + foreach ($object->lines as $line) { + ?> + + + product_label)) { + echo $line->product_label; + } else { + echo $line->description; + } ?> + + qty; ?> + total_ttc / $line->qty, 'MT'), 1); + } ?> + global->TAKEPOS_SHOW_HT_RECEIPT)) { ?> + total_ht, 1); + } ?> + + total_ttc, 1); + } ?> + - total_ttc, 1); - } ?> - - From da52ee55a4e9adaaa2e51806ceaecc168d3c57b2 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 7 Oct 2021 10:13:30 +0200 Subject: [PATCH 2/4] FIX sickler-ci errors --- htdocs/takepos/printbox.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/printbox.php b/htdocs/takepos/printbox.php index cc5f5b305d1..5d612fd19f2 100644 --- a/htdocs/takepos/printbox.php +++ b/htdocs/takepos/printbox.php @@ -87,13 +87,13 @@ top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
trans('Label') . '">'; - print ''; - } + print ''; + print ''; +} ?>
From 592fff1cfa5cfac2b50ae300351fe3cb206e002d Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Fri, 8 Oct 2021 13:07:38 +0200 Subject: [PATCH 3/4] Allow exporting supplier order validation date + validation user --- htdocs/core/modules/modFournisseur.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 6efebe9a82b..8e0fd6ea126 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modFournisseur extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * @@ -430,8 +429,8 @@ class modFournisseur extends DolibarrModules 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"OrderId", 'f.ref'=>"Ref", 'f.ref_supplier'=>"RefSupplier", 'f.date_creation'=>"DateCreation", 'f.date_commande'=>"OrderDate", 'f.date_livraison'=>"DateDeliveryPlanned", - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.fk_statut'=>'Status', 'f.date_approve'=>'DateApprove', 'f.date_approve2'=>'DateApprove2', - 'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", + 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.fk_statut'=>'Status', 'f.date_valid'=>'DateValidation', 'f.date_approve'=>'DateApprove', 'f.date_approve2'=>'DateApprove2', + 'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'uv.login'=>'UserValidation', 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT", 'fd.total_ttc'=>"LineTotalTTC", 'fd.total_tva'=>"LineTotalVAT", 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' @@ -451,13 +450,13 @@ class modFournisseur extends DolibarrModules 's.rowid'=>"company", 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.cp'=>'Text', 's.ville'=>'Text', 'c.code'=>'Text', 's.tel'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", 'f.date_creation'=>"Date", 'f.date_commande'=>"Date", 'f.date_livraison'=>"Date", 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", - 'f.fk_statut'=>'Status', 'f.date_approve'=>'Date', 'f.date_approve2'=>'Date', 'f.note_public'=>"Text", 'f.note_private'=>"Text", 'fd.description'=>"Text", + 'f.fk_statut'=>'Status', 'f.date_valid'=>'Date', 'f.date_approve'=>'Date', 'f.date_approve2'=>'Date', 'f.note_public'=>"Text", 'f.note_private'=>"Text", 'fd.description'=>"Text", 'fd.tva_tx'=>"Numeric", 'fd.qty'=>"Numeric", 'fd.remise_percent'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.product_type'=>'Numeric', 'fd.ref'=>'Text', 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text' ); $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', - 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.tva_intra'=>'company', 'ua1.login'=>'user', + 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.tva_intra'=>'company', 'uv.login'=>'user', 'ua1.login'=>'user', 'ua2.login'=>'user', 'fd.rowid'=>'order_line', 'fd.description'=>"order_line", 'fd.tva_tx'=>"order_line", 'fd.qty'=>"order_line", 'fd.remise_percent'=>"order_line", 'fd.total_ht'=>"order_line", 'fd.total_ttc'=>"order_line", 'fd.total_tva'=>"order_line", 'fd.product_type'=>'order_line', 'fd.ref'=>'order_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project' @@ -484,6 +483,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande_fournisseur as f'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON uv.rowid = f.fk_user_valid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,'; From 6553defc14898e2151395947bf67634c4ac01880 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Fri, 8 Oct 2021 13:06:24 +0200 Subject: [PATCH 4/4] Reload page if RELOAD_PAGE_ON_SUPPLIER_CHANGE is not empty --- htdocs/supplier_proposal/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index cf1ac2cfdd9..f8b5f5d64ca 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1148,6 +1148,18 @@ if ($action == 'create') { } else { print ''; print img_picto('', 'company').$form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + // reload page to retrieve customer informations + if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { + print ''; + } print ' '; print ''; }