diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index ec86076ac22..a70e470e8a8 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -96,3 +96,4 @@ ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use payment icon on numpad CashDeskRefNumberingModules=Numbering module for cash desk CashDeskGenericMaskCodes6 =
{TN} tag is used to add the terminal number +TakeposGroupSameProduct=Group same products lines diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index acf44920aa9..106630d5b17 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -90,6 +90,7 @@ BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters TakeposNumpadUsePaymentIcon=Utilisation d'icônes sur les touches des modes de règlement du pavé numérique CashDeskRefNumberingModules=Modèles de numérotation des caisses CashDeskGenericMaskCodes6 =
La balise {TN} permet de rajouter le numéro du terminal +TakeposGroupSameProduct=Regrouper les mêmes lignes de produits PrintMethod=Print method ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. ByTerminal=By terminal diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 195e5bc306f..a7967169db8 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -304,6 +304,12 @@ $array = array('rowid' => 'ID', 'ref' => 'Ref', 'label' => 'Label', 'datec' => ' print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); print "\n"; +print ''; +print $langs->trans('TakeposGroupSameProduct'); +print ''; +print ajax_constantonoff("TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 799d32546c3..683b74edc4b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -326,7 +326,23 @@ if ($action == "addline") } } - $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + $idoflineadded = 0; + if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { + foreach ($invoice->lines as $line) { + if ($line->product_ref == $prod->ref) { + $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty+1, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + if ($result < 0) { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } else { + $idoflineadded = $line->id; + } + break; + } + } + } + if ($idoflineadded <= 0) { + $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + } $invoice->fetch($placeid); }