From fdac53bfca37b034a8decfb4f0e568cbc93a5b27 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 19 Nov 2014 18:53:33 +0100 Subject: [PATCH 01/26] Update objectline_create.tpl.php add label tags for product mode type --- htdocs/core/tpl/objectline_create.tpl.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a51a6505416..6e9b3251fbd 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -107,7 +107,9 @@ else { print ''; } else {*/ + echo ''; /* if (empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans("Type"); else if (! empty($forceall) || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))) echo $langs->trans("FreeLineOfType"); @@ -123,7 +125,7 @@ else { { echo '
'; echo ' '; - + echo ''; echo ' '; $filtertype=''; From 7a272afd120029ba06d00ff6d56d7a8e129cbb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 23 Nov 2014 16:03:49 +0100 Subject: [PATCH 02/26] Fixed [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state --- ChangeLog | 3 ++- htdocs/fichinter/fiche.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 99b29a81f56..34dd86aa02e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,8 @@ English Dolibarr ChangeLog - Fix: Civility & birthdate wasn't save into adherent module. - Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref - Fix: Chars - is no more allowed into value for code for extra fields. -( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache +- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache +- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 944dbae6b45..9be7d67115e 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -152,6 +152,11 @@ else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->fich else if ($action == 'add' && $user->rights->ficheinter->creer) { + // Fill array 'array_options' with data from add form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) $error ++; + $object->socid = $socid; $object->duree = GETPOST('duree','int'); $object->fk_project = GETPOST('projectid','int'); From 5dbba380d230e23adda0e6e074cf8e811dff5224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Nov 2014 20:54:38 +0100 Subject: [PATCH 03/26] Fix 1721 Missing translation on proposal creation --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1eeb5a7f443..13e9580e2b8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1139,6 +1139,7 @@ AddDeliveryAddressAbility=Add delivery date ability UseOptionLineIfNoQuantity=A line of product/service with a zero amount is considered as an option FreeLegalTextOnProposal=Free text on commercial proposals WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) +ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal ##### Orders ##### OrdersSetup=Order management setup OrdersNumberingModules=Orders numbering models From 655dc35628e7da518eac53f3c92344f1311550cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Nov 2014 20:57:26 +0100 Subject: [PATCH 04/26] Update propal.php --- htdocs/admin/propal.php | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 328866eb964..c92f2bac5ab 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -163,7 +163,22 @@ if ($action == 'setdefaultduration') } } -// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'set_ASK_PAYMENT_BANK_DURING_PROPOSAL') +{ + $res = dolibarr_set_const($db, "ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} ++// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) if ($action == 'setModuleOptions') { $post_size=count($_POST); @@ -582,6 +597,35 @@ print '' print "\n"; print ''; +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('ASK_PAYMENT_BANK_DURING_PROPOSAL'); + } + else + { + if (empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; +} +else +{ + $var=!$var; + print ''; + print $langs->trans("ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').''; +} + print ''; From 81f467661e9f941aa3ad8074df1ca8aff2c8b566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Nov 2014 20:58:46 +0100 Subject: [PATCH 05/26] Update propal.php --- htdocs/comm/propal.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 6d23d3a982d..b14c9516465 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1310,9 +1310,11 @@ if ($action == 'create') print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; + if (! empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } // What trigger creation print '' . $langs->trans('Source') . ''; @@ -1892,7 +1894,7 @@ if ($action == 'create') print ''; } - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) + if (! empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { // Bank Account print ''; From f5bc6dc6343f503019eb2a59ebba6343c3dee6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Nov 2014 21:01:55 +0100 Subject: [PATCH 06/26] Update propal.php --- htdocs/admin/propal.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index c92f2bac5ab..de935b3d0f0 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -178,7 +178,8 @@ if ($action == 'set_ASK_PAYMENT_BANK_DURING_PROPOSAL') setEventMessage($langs->trans("Error"),'errors'); } } -+// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) + +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) if ($action == 'setModuleOptions') { $post_size=count($_POST); From 9d813b25d96254c5b90e472790639ca15abd87a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 01:05:01 +0100 Subject: [PATCH 07/26] Fix Typo --- htdocs/core/boxes/box_graph_invoices_permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index b272f350717..9b2a5437b8a 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -215,9 +215,9 @@ class box_graph_invoices_permonth extends ModeleBoxes $stringtoshow.='
'; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; From 6163635d7cb77d781da8bacd61fae363c9849c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 01:06:04 +0100 Subject: [PATCH 08/26] Fix Typo --- htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index c882acd40c1..7c2aa53da97 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; From 9fb58e06f6585a008a675d033bff74aabbcf265f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 01:06:55 +0100 Subject: [PATCH 09/26] Fix Typo --- htdocs/core/boxes/box_graph_orders_permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 5084691d321..75f0f60660f 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -215,9 +215,9 @@ class box_graph_orders_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; From e4517ee0f4d96cc382bad3990ce2ed46eacb146d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 01:07:45 +0100 Subject: [PATCH 10/26] Fix Typo --- htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index f398ae9dcb1..70d62cac348 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; From 911f9c0913ec614e257c209a47a5fb80caa68d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 01:13:52 +0100 Subject: [PATCH 11/26] Fix Typo --- htdocs/core/boxes/box_graph_propales_permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 974ccaed446..fd866f5df89 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -218,9 +218,9 @@ class box_graph_propales_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; From 18406fc550d68bb5e851e242b6f928327bbe1a20 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 25 Nov 2014 14:26:45 +0100 Subject: [PATCH 12/26] Fix: Show sender Country on PDF docs Show sender Country on PDF docs when sender Country != receiver Country --- ChangeLog | 1 + htdocs/core/lib/functions.lib.php | 9 +++++---- htdocs/core/lib/pdf.lib.php | 5 ++++- .../core/modules/commande/doc/pdf_einstein.modules.php | 2 +- .../core/modules/commande/doc/pdf_proforma.modules.php | 2 +- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 2 +- .../core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../modules/supplier_invoice/pdf/pdf_canelle.modules.php | 2 +- .../modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- 14 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34dd86aa02e..05f46019350 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ English Dolibarr ChangeLog - Fix: Chars - is no more allowed into value for code for extra fields. - Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache - Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state +- Fix: Show sender Country on PDF docs when sender Country <> receiver Country ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d679882161f..f6f09dd1567 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -719,11 +719,12 @@ function dol_bc($var,$moreclass='') * @param Object $object A company or contact object * @param int $withcountry 1=Add country into address string * @param string $sep Separator to use to build string + * @param Tranlsate $outputlangs Object lang that contains language for text translation. * @return string Formated string */ -function dol_format_address($object,$withcountry=0,$sep="\n") +function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') { - global $conf; + global $conf,$langs; $ret=''; $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); @@ -768,8 +769,8 @@ function dol_format_address($object,$withcountry=0,$sep="\n") $ret.=", ".$object->state; } } - - if ($withcountry) $ret.=($object->country?$sep.$object->country:''); + if (! is_object($outputlangs)) $outputlangs=$langs; + if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); return $ret; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 17c1185e2e0..8b0091a6f6d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -309,7 +309,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if ($mode == 'source') { - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n"; + $withCountry = 0; + if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1; + + $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n"; if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index b3dd27a8a7a..2f569f1e47f 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1177,7 +1177,7 @@ class pdf_einstein extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 49e3c374752..cf5a562e2ef 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -1134,7 +1134,7 @@ class pdf_proforma extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 238f51e78cd..88645973f6c 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -520,7 +520,7 @@ class pdf_strato extends ModelePDFContract $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 14bc79bf935..cc9d884a831 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -516,7 +516,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetTextColor(0,0,0); // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); $pdf->SetFont('','', $default_font_size - 3); $pdf->SetXY($blSocX,$blSocY+4); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 37e3f8b911f..eedc4b91827 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -564,7 +564,7 @@ class pdf_rouget extends ModelePdfExpedition $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posx=$this->marge_gauche; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 6b66d9d2df3..e8ea460fb9b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1363,7 +1363,7 @@ class pdf_crabe extends ModelePDFFactures if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index c94cd154251..2c8214457e2 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -505,7 +505,7 @@ class pdf_soleil extends ModelePDFFicheinter $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 3aae0e5a18e..ba58279c8ec 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -749,7 +749,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 29fea0d9c1a..d7d4b3150cf 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1269,7 +1269,7 @@ class pdf_azur extends ModelePDFPropales $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index d3cf60295f6..4124d4745f6 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -961,7 +961,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 78a33f76a29..83d1aac952b 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1005,7 +1005,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; From fbdd8518751c34564ef4e6a389e16920e4377bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 25 Nov 2014 18:54:56 +0100 Subject: [PATCH 13/26] Fix remove not needed --- htdocs/compta/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index fc2943f05e0..2359d70d07b 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -678,7 +678,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $societestatic->name=$obj->name; $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); - print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).''; print ''.price($obj->total_ttc).''; print ''.price($obj->total_ttc-$obj->tot_fttc).''; @@ -777,7 +777,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $societestatic->name=$obj->name; $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); - print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total).''; print ''.price($obj->total_ttc).''; print ''.price($obj->am).''; From b1a4b8e7d0aa8ff376e5dbfcf89260eb6e189d62 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 25 Nov 2014 21:20:13 +0100 Subject: [PATCH 14/26] Fix: [ bug #1624 ] POS set buy price for margin Use lowest buying price for margin when selling with POS or external module. A POS user does not worry about suppliers. --- ChangeLog | 1 + htdocs/comm/propal/class/propal.class.php | 20 +++++++++++++++++-- htdocs/commande/class/commande.class.php | 20 +++++++++++++++++-- htdocs/compta/facture/class/facture.class.php | 18 ++++++++++++++++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05f46019350..bae7da7ce64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache - Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state - Fix: Show sender Country on PDF docs when sender Country <> receiver Country +- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 363776c7e6f..846bb5acb10 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -413,7 +413,15 @@ class Propal extends CommonObject // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // Mise en option de la ligne @@ -565,7 +573,15 @@ class Propal extends CommonObject $this->line->skip_update_total = $skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; $this->line->date_start=$date_start; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 001a4972dd7..8501f04e8b8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1214,7 +1214,15 @@ class Commande extends CommonOrder $this->line->date_end=$date_end; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // TODO Ne plus utiliser @@ -2421,7 +2429,15 @@ class Commande extends CommonOrder $this->line->skip_update_total=$skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + //by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // TODO deprecated diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6def5560deb..1df0696486c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2213,7 +2213,15 @@ class Facture extends CommonInvoice $this->line->skip_update_total = $skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // POS or external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; if (is_array($array_option) && count($array_option)>0) { @@ -3477,6 +3485,14 @@ class FactureLigne extends CommonInvoiceLine return -1; } } + + // POS or by external module, take lowest buying price + if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($this->fk_product); + $this->fk_fournprice = $productFournisseur->product_fourn_price_id; + } $this->db->begin(); From 5a97ee1f951f74df1275fd4881191fe653196a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 Nov 2014 16:48:37 +0100 Subject: [PATCH 15/26] Rearrange Help Block in left menu --- htdocs/main.inc.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cf01d5d0364..7fe13a97b91 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1629,8 +1629,11 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print "\n"; } - //Dolibarr version - $doliurl='http://www.dolibarr.org'; + print "\n"; + print "\n"; + print '
'."\n"; + //Dolibarr version + $doliurl='http://www.dolibarr.org'; //local communities if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr'; @@ -1650,11 +1653,11 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me else $appli.=" ".DOL_VERSION; } else $appli.=" ".DOL_VERSION; - print '
'; + print '
'; if ($doliurl) print ''; print $appli; if ($doliurl) print ''; - print '
'; + print '
'."\n"; // Link to Dolibarr wiki pages if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK)) @@ -1674,7 +1677,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me // Link to help pages if ($helpbaseurl && $helppage) { - print '\n"; + print "\n"; + print "\n"; - print "\n"; + print "
\n"; + print "\n"; + print "\n"; // Execute hook printLeftBlock $parameters=array(); From f36a30f9fe7986906cd5cee73234ba56d734582d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Nov 2014 23:25:29 +0100 Subject: [PATCH 16/26] Fixed: W3C. An id must be unique inside a page. --- htdocs/main.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7fe13a97b91..d248a8c19ff 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1632,9 +1632,9 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print "\n"; print "\n"; print '
'."\n"; + //Dolibarr version $doliurl='http://www.dolibarr.org'; - //local communities if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr'; if (preg_match('/es/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.es'; @@ -1653,7 +1653,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me else $appli.=" ".DOL_VERSION; } else $appli.=" ".DOL_VERSION; - print '
'; + print '
'; if ($doliurl) print ''; print $appli; if ($doliurl) print ''; @@ -1677,7 +1677,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me // Link to help pages if ($helpbaseurl && $helppage) { - print '
'; + print '\n"; From 6843bfcc15e043e1787a933162fb3972041efd57 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 00:01:59 +0100 Subject: [PATCH 17/26] Fix typo --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a4d491683b5..b70820463b0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2622,7 +2622,7 @@ class Form $i++; } print ""; - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } else { print $langs->trans("NoShippingMethodDefined"); } From dc1c98734eabb12e6edbe3426064b0a80c0bcda4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 00:21:52 +0100 Subject: [PATCH 18/26] Fixed: Option specific to a module should start with module name --- htdocs/admin/propal.php | 16 ++++++++-------- htdocs/comm/propal.php | 4 ++-- htdocs/langs/en_US/admin.lang | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index de935b3d0f0..aef978ec6ad 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -163,9 +163,9 @@ if ($action == 'setdefaultduration') } } -if ($action == 'set_ASK_PAYMENT_BANK_DURING_PROPOSAL') +if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') { - $res = dolibarr_set_const($db, "ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -602,20 +602,20 @@ if ($conf->banque->enabled) { $var=!$var; print ''; - print $langs->trans("ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('ASK_PAYMENT_BANK_DURING_PROPOSAL'); + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL'); } else { - if (empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL)) + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; @@ -624,7 +624,7 @@ else { $var=!$var; print ''; - print $langs->trans("ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').''; } print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b14c9516465..6e105acea6d 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1310,7 +1310,7 @@ if ($action == 'create') print ''; // Bank Account - if (! empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) { + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) { print '' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; @@ -1894,7 +1894,7 @@ if ($action == 'create') print ''; } - if (! empty($conf->global->ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { // Bank Account print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 13e9580e2b8..fec89ae5bcd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1139,7 +1139,7 @@ AddDeliveryAddressAbility=Add delivery date ability UseOptionLineIfNoQuantity=A line of product/service with a zero amount is considered as an option FreeLegalTextOnProposal=Free text on commercial proposals WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) -ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal +BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal ##### Orders ##### OrdersSetup=Order management setup OrdersNumberingModules=Orders numbering models From 232921a5061e0a723f8fbe065058fb73044e9b3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 00:34:03 +0100 Subject: [PATCH 19/26] Fixed: Add option on a not common new feature --- htdocs/commande/card.php | 46 +++++++++++++++++------------- htdocs/fourn/commande/card.php | 52 ++++++++++++++++++++-------------- 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4bf1eceb6dc..79a6797245a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1391,10 +1391,13 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) + { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } + // Delivery delay print '' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); @@ -1995,22 +1998,25 @@ if ($action == 'create' && $user->rights->commande->creer) { $rowspan ++; // Bank Account - print ''; - print ''; - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; - print ''; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print ''; - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) + { + print ''; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->commande->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print ''; + print ''; + } + // Total HT print '' . $langs->trans('AmountHT') . ''; print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0273dea94b9..3c7269c3e6f 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -136,9 +136,10 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) } // bank account -else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) { +else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) +{ $result=$object->setBankAccount(GETPOST('fk_account', 'int')); - } +} // date de livraison if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) @@ -1268,10 +1269,14 @@ if ($action=="create") print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled)) + { + $langs->load("bank"); + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } + print ''.$langs->trans('NotePublic').''; print ''; $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1539,22 +1544,25 @@ elseif (! empty($object->id)) print ''; // Bank Account - print ''; - print ''; - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; - print ''; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print ''; - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled)) + { + print ''; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print ''; + print ''; + } + // Delivery date planed print ''; print ' - - + + - + - - + + = 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) { + echo ''; + } + else + { + echo ''; + // Show type selector + if ($forceall >= 0) + { + echo $langs->trans("FreeLineOfType"); + echo ' '; + } } echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall); @@ -128,9 +131,8 @@ else { { if ($forceall >= 0) echo '
'; echo ''; - echo ' '; - echo ''; // Public diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 701efe742eb..3a3bba15653 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -782,16 +782,18 @@ else print '
'; print $langs->trans("ThirdPartyType").':     '; print '
'; - print ''; print ''; print '     '; + print ''; print ''; print "
\n"; }
'; From 38062177d328476eccbfcc64473a9b69f5268954 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 00:37:46 +0100 Subject: [PATCH 20/26] Doxygen --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cc06786e602..f2462b61723 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2905,7 +2905,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN) * @param int $alreadysqlnb Put 1 if you know that content is already universal format number - * @return string Amount with universal numeric format (Example: '99.99999') + * @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails. * * @see price Opposite function of price2num */ From 491aef72e06d8692008f4c9fc9e38401bec43909 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 00:56:21 +0100 Subject: [PATCH 21/26] More phpunit tests --- test/phpunit/FunctionsLibTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index f26718f1dd9..af5f3393672 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -824,4 +824,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(dol_nl2br($string, 1, 1), "a
a"); } + /** + * testDolPrice2Num + * + * @return boolean + */ + public function testDolPrice2Num() + { + $this->assertEquals(1000, price2num('1 000.0')); + $this->assertEquals(1000, price2num('1 000','MT')); + $this->assertEquals(1000, price2num('1 000','MU')); + + $this->assertEquals(1000.123456, price2num('1 000.123456')); + + // Round down + $this->assertEquals(1000.12, price2num('1 000.123452','MT')); + $this->assertEquals(1000.12345, price2num('1 000.123452','MU'),"Test MU"); + + // Round up + $this->assertEquals(1000.13, price2num('1 000.125456','MT')); + $this->assertEquals(1000.12546, price2num('1 000.125456','MU'),"Test MU"); + + // Text can't be converted + $this->assertEquals('12.4$',price2num('12.4$')); + $this->assertEquals('12r.4$',price2num('12r.4$')); + + return true; + } + } From 0a0e0e068cb49290bc882a7390d307f98bf8eb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 24 Nov 2014 12:45:46 +0100 Subject: [PATCH 22/26] Fixed [ bug #1691 ] Don't think the ID should be displayed in holiday module --- htdocs/holiday/define_holiday.php | 11 ++--------- htdocs/langs/en_US/holiday.lang | 1 - 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 217cb16bad1..fa3f745de81 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -144,17 +144,14 @@ if($cp_events == 1) print '
'; } -dol_fiche_head(); - print '
'."\n"; print ''; print ''; print ""; -print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print ''; foreach($listUsers as $users) @@ -163,7 +160,6 @@ foreach($listUsers as $users) $var=!$var; print ''; - print ''; print '
'.$langs->trans('ID').''.$langs->trans('Employee').''.$langs->trans('Employee').''.$langs->trans('Available').''.$langs->trans('Note').''.$langs->trans('UpdateButtonCP').'
'.$users['rowid'].''; $userstatic->id=$users['rowid']; $userstatic->lastname=$users['name']; @@ -183,9 +179,6 @@ foreach($listUsers as $users) print '
'; print '
'; -dol_fiche_end(); - - llxFooter(); $db->close(); diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 698d34eb539..f5b87fefb08 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -48,7 +48,6 @@ ConfirmDeleteCP=Confirm the deletion of this leave request? ErrorCantDeleteCP=Error you don't have the right to delete this leave request. CantCreateCP=You don't have the right to make leave requests. InvalidValidatorCP=You must choose an approbator to your leave request. -UpdateButtonCP=Update CantUpdate=You cannot update this leave request. NoDateDebut=You must select a start date. NoDateFin=You must select an end date. From 5cc015268e410f85620877bf69d248b8d87f92d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 24 Nov 2014 12:49:33 +0100 Subject: [PATCH 23/26] Fixed [ bug #1718 ] Mistakenly searching for text in amount field breaks --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 6affbae3045..4f0974abd10 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -123,7 +123,7 @@ if ($search_user) } if ($search_ttc) { - $sql .= " AND total_ttc = ".price2num($search_ttc); + $sql .= " AND total_ttc = '".$db->escape(price2num($search_ttc))."'"; } if ($sall) { From 79c8980493f60d84221063f7849b93233a1be967 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 01:13:57 +0100 Subject: [PATCH 24/26] Fix: function at wrong place --- htdocs/contrat/class/contrat.class.php | 35 -------------------------- 1 file changed, 35 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4abfb1f9c86..1399ae40215 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2385,39 +2385,4 @@ class ContratLigne extends CommonObject } } - /** - * Create a contract document on disk using template defined into CONTRACT_ADDON_PDF - * - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) - { - global $conf,$langs,$user,$hookmanager; - - $langs->load("contracts"); - - // Positionne modele sur le nom du modele de contrat a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->CONTRACT_ADDON_PDF)) - { - $modele = $conf->global->CONTRACT_ADDON_PDF; - } - else - { - $modele = 'strato'; - } - } - - $modelpath = "core/modules/contract/doc/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); - } } - - From 1c16a2e621558e1ce82c716e79f5d50cc7987253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 23 Nov 2014 13:14:54 +0100 Subject: [PATCH 25/26] Fixed [ bug #1642 ]: add a free line in contract --- htdocs/contrat/card.php | 6 ++--- .../contract/doc/pdf_strato.modules.php | 24 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 20fd6939f5d..dfdf0e95a87 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -536,10 +536,10 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'contract'); $keys=array_keys($tmp); $model=$keys[0]; } + $ret = $object->fetch($id); // Reload to get new records - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } unset($_POST ['prod_entry_mode']); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index bd4cc333743..4c609bc100c 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -53,6 +53,18 @@ class pdf_strato extends ModelePDFContract var $marge_haute; var $marge_basse; + /** + * Issuer + * @var Societe + */ + public $emetteur; + + /** + * Recipient + * @var Societe + */ + public $recipient; + /** * Constructor * @@ -581,17 +593,17 @@ class pdf_strato extends ModelePDFContract $result=$object->fetch_contact($arrayidcontact[0]); } + $this->recipient = $object->client; + // Recipient name - if (! empty($usecontact)) - { + if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->name; - $this->recipient->name=$outputlangs->convToOutputCharset($socname); + $this->recipient->name = $outputlangs->convToOutputCharset($socname); } - else - { - $this->recipient->name=$outputlangs->convToOutputCharset($object->client->name); + else { + $this->recipient->name = $outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); From 9ba5e9434d4a322fba1eed59d3ff20fb4e120507 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Nov 2014 02:05:40 +0100 Subject: [PATCH 26/26] Fix: W3C a label must be used if there is an "input" field only. Also it is recommanded to have the input inside the label tags, not outside. This solve bugs on some smatphone browsers. --- htdocs/core/tpl/objectline_create.tpl.php | 36 ++++++++++++----------- htdocs/projet/card.php | 10 +++++-- htdocs/societe/soc.php | 6 ++-- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a69ab60c254..543b0724de2 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -50,25 +50,23 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine'); ?>trans("FreeZone"); ?>
trans('VAT'); ?>trans('PriceUHT'); ?> trans('PriceUTTC'); ?> trans('Qty'); ?>trans('ReductionShort'); ?> '; if ($conf->global->MARGIN_TYPE == "1") echo $langs->trans('BuyingPrice'); else echo $langs->trans('CostPrice'); - echo ''; ?>
'.$langs->trans("ThirdParty").''; - $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1); + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + } + else print $text; print '