From 278b708e1729345b1d47f022ec2c55f3cd8651ad Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 11 Apr 2019 11:57:50 +0200 Subject: [PATCH 001/316] use subproducts costprice and pmp if empty on father --- htdocs/fourn/ajax/getSupplierPrices.php | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 85b0ed37155..57874e3a122 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,12 +86,46 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; + if (empty($price)) + { + // get costprice for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->cost_price; + } + } + } + $prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() if(!empty($conf->stock->enabled)) { // Add price for pmp $price=$producttmp->pmp; + if (empty($price)) + { + // get pmp for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->pmp; + } + } + } + $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } } From 30ad0e7e11260d089d30743f1536ab4248031fc8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 09:00:39 +0200 Subject: [PATCH 002/316] introduce PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY --- htdocs/fourn/ajax/getSupplierPrices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 57874e3a122..211734f1129 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,7 +86,7 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; - if (empty($price)) + if (empty($price) && ! empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) { // get costprice for subproducts if any $producttmp->get_sousproduits_arbo(); From ff178667a3ee966b865c6693e961866bdd043893 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Tue, 11 May 2021 12:33:35 +0200 Subject: [PATCH 003/316] add thirdparty customer code to substitutionarray --- htdocs/comm/mailing/card.php | 7 +++++++ htdocs/core/class/html.formmail.class.php | 2 ++ htdocs/langs/fr_FR/mails.lang | 2 ++ 3 files changed, 11 insertions(+) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 5148956163e..4bf304bc519 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -201,6 +201,13 @@ if (empty($reshook)) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray['__ID__'] = $obj->source_id; + if ($obj->source_type == "thirdparty") { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($obj->source_id); + + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + } $substitutionarray['__EMAIL__'] = $obj->email; $substitutionarray['__LASTNAME__'] = $obj->lastname; $substitutionarray['__FIRSTNAME__'] = $obj->firstname; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index c4723eacc57..5947ad8d810 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1502,6 +1502,8 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; + $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; + $tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 3788acb53c4..9adfc684b8d 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -116,6 +116,8 @@ ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les liste NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés IdRecord=ID enregistrement +CustomerCode = Code client +CustomerCodeWithoutPrefix = Code client sans préfix DeliveryReceipt=Accusé de réception YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation virgule pour spécifier plusieurs destinataires. TagCheckMail=Suivre l'ouverture de l'email From 4ce81ee53591f9b98088c2bada735c1c1c113204 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Tue, 11 May 2021 20:30:57 +0200 Subject: [PATCH 004/316] set new outside the loop, add fetch result check --- htdocs/comm/mailing/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 4bf304bc519..2aae9ef1d73 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -171,6 +171,7 @@ if (empty($reshook)) dol_print_error($db); } + $thirdpartystatic = new Societe($db); // Loop on each email and send it $i = 0; @@ -202,11 +203,12 @@ if (empty($reshook)) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray['__ID__'] = $obj->source_id; if ($obj->source_type == "thirdparty") { - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($obj->source_id); + $result = $thirdpartystatic->fetch($obj->source_id); - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + if ($result > 0) { + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + } } $substitutionarray['__EMAIL__'] = $obj->email; $substitutionarray['__LASTNAME__'] = $obj->lastname; From 09a694628106d1be9caae44a3f270571b0ed0588 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:34:58 +0200 Subject: [PATCH 005/316] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 5947ad8d810..a784521fcf9 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1503,7 +1503,7 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; - $tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; + //$tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; // Not yet working $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; From 40106ff7670afb1de4d887ee2f8cea08433278bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:35:29 +0200 Subject: [PATCH 006/316] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a784521fcf9..99b25d27fc4 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1503,7 +1503,6 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; - //$tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; // Not yet working $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; From a4f4cca895b7fcb3a4f1fd6c56f3f355d676fd45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:36:49 +0200 Subject: [PATCH 007/316] Prefix length may have different length and be at a different place so i remove this tag. Must be replaced by a generic method to substring a substitution variable. --- htdocs/comm/mailing/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2aae9ef1d73..f2b93ddbb80 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -207,7 +207,6 @@ if (empty($reshook)) if ($result > 0) { $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); } } $substitutionarray['__EMAIL__'] = $obj->email; From aa9642b86fd58299131565fe58a276f9280e0146 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:38:38 +0200 Subject: [PATCH 008/316] Update mails.lang --- htdocs/langs/fr_FR/mails.lang | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 9adfc684b8d..3788acb53c4 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -116,8 +116,6 @@ ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les liste NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés IdRecord=ID enregistrement -CustomerCode = Code client -CustomerCodeWithoutPrefix = Code client sans préfix DeliveryReceipt=Accusé de réception YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation virgule pour spécifier plusieurs destinataires. TagCheckMail=Suivre l'ouverture de l'email From 23249751d57ab712642544027d72908cd6d61080 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 17 Nov 2021 12:10:12 +0100 Subject: [PATCH 009/316] FIX : reorder all lines when delete document line everywhere --- htdocs/commande/card.php | 2 ++ htdocs/compta/facture/card.php | 2 ++ htdocs/fourn/commande/card.php | 2 ++ htdocs/fourn/facture/card.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b9900459006..21b8897a3e3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -216,6 +216,8 @@ if (empty($reshook)) $result = $object->deleteline($user, $lineid); if ($result > 0) { + // reorder lines + $object->line_order(true); // Define output language $outputlangs = $langs; $newlang = ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 86d3abedd2b..5a500eafe12 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -243,6 +243,8 @@ if (empty($reshook)) $result = $object->deleteline(GETPOST('lineid')); if ($result > 0) { + // reorder lines + $object->line_order(true); // Define output language $outputlangs = $langs; $newlang = ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f79f37d16e5..c85d1f56c29 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -805,6 +805,8 @@ if (empty($reshook)) $result = $object->deleteline($lineid); if ($result > 0) { + // reorder lines + $object->line_order(true); // Define output language $outputlangs = $langs; $newlang = ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 985c9a4cc62..d912f6917f7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -253,6 +253,8 @@ if (empty($reshook)) $result = $object->deleteline($lineid); if ($result > 0) { + // reorder lines + $object->line_order(true); // Define output language /*$outputlangs = $langs; $newlang = ''; From e43b95f05a191a1a541bf6918c862b66541fa534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina?= Date: Tue, 30 Nov 2021 15:41:46 +0100 Subject: [PATCH 010/316] Show reference product --- htdocs/takepos/index.php | 20 +++++++++++++++++--- htdocs/takepos/invoice.php | 6 +++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8bd1c4dbca9..ad123ccd5e7 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -335,7 +335,11 @@ function LoadProducts(position, issubcat) { var titlestring = ; global->TAKEPOS_HIDE_PRODUCT_IMAGES) { echo '$("#prodivdesc"+ishow).show();'; - echo '$("#prodesc"+ishow).text(data[parseInt(idata)][\'label\']);'; + if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { + echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);'; + } else { + echo '$("#prodesc"+ishow).text(data[parseInt(idata)][\'label\']);'; + } echo '$("#proimg"+ishow).attr("title", titlestring);'; echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);'; } else { @@ -401,7 +405,12 @@ function MoreProducts(moreorless) { else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodivdesc"+ishow).show(); - $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { ?> + $("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold() + ' - ' + data[parseInt(idata)]['label']); + + $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + $("#probutton"+ishow).text(data[parseInt(idata)]['label']); $("#probutton"+ishow).show(); if (data[parseInt(idata)]['price_formated']) { @@ -579,7 +588,12 @@ function Search2(keyCodeForEnter) { $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']"; ?> var titlestring = ; - $("#prodesc" + i).text(data[i]['label']); + global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { ?> + $("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']); + + $("#prodesc" + i).text(data[i]['label']); + $("#prodivdesc" + i).show(); $("#probutton" + i).text(data[i]['label']); $("#probutton" + i).show(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 2a951a505ae..01599cae4b6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1447,7 +1447,11 @@ if ($placeid > 0) { $tooltiptext .= $line->desc; } } - $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); + if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { + $htmlforlines .= $form->textwithpicto($line->product_label ? '' . $line->product_ref . ' - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); + } else { + $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); + } } else { if ($line->product_label) { $htmlforlines .= $line->product_label; From 7c3b2f1e9bed3f2b45438810a89d2bba6c266dda Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 30 Nov 2021 15:07:59 +0000 Subject: [PATCH 011/316] Fixing style errors. --- htdocs/takepos/index.php | 2 +- htdocs/takepos/invoice.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index ad123ccd5e7..bf5428f81d0 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -589,7 +589,7 @@ function Search2(keyCodeForEnter) { ?> var titlestring = ; global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { ?> + if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { ?> $("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']); $("#prodesc" + i).text(data[i]['label']); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 01599cae4b6..2f857e7a3ce 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1447,9 +1447,9 @@ if ($placeid > 0) { $tooltiptext .= $line->desc; } } - if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { + if ($conf->global->TAKEPOS_SHOW_PRODUCT_REFERENCE == 1) { $htmlforlines .= $form->textwithpicto($line->product_label ? '' . $line->product_ref . ' - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); - } else { + } else { $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } } else { From 16ab6ce800a10887e31890d772a6356b34759f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina?= Date: Wed, 1 Dec 2021 10:26:24 +0100 Subject: [PATCH 012/316] No Category --- htdocs/takepos/index.php | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8bd1c4dbca9..59205c638a6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1186,13 +1186,22 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
+ } ?>" + global->TAKEPOS_NO_CATEGORY == 1) { + print ''; + } + ?>> -
- global->TAKEPOS_NO_CATEGORY == 1) { + print '