From b5690142aa97c5cfa9894034444cabeb06ed0504 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Mar 2015 16:26:31 +0200 Subject: [PATCH 01/19] Prepare 3.6.3 --- build/debian/changelog | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 4a711c9868c..75f4734ea3c 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,20 +1,6 @@ -dolibarr (3.6.2-3) unstable; urgency=low +dolibarr (3.6.3-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Sat, 27 dec 2014 12:00:00 +0100 - -dolibarr (3.6.1-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 23 Sep 2014 12:00:00 +0100 - -dolibarr (3.6.0-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 15 July 2014 12:00:00 +0100 + -- Laurent Destailleur (eldy) Sun, 21 March 2015 12:00:00 +0100 \ No newline at end of file From fd8d09c8c084a13ec6af0868670038573933d285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Mar 2015 17:53:05 +0200 Subject: [PATCH 02/19] Fix avoid warning --- htdocs/admin/index.php | 1 + htdocs/core/class/hookmanager.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index bbedab346d1..9e6d316c9ee 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -100,6 +100,7 @@ print '
'; print '
'; // Add hook to add information +$parameters=array(); $reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; if (empty($reshook)) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 906c1e6c4ae..6b50cc68cbd 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -184,7 +184,7 @@ class HookManager }*/ } - if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); + if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; } // Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) From 65ec02bae1da37df751ab0c5c91df9f02962a1b1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 30 Mar 2015 19:13:55 +0200 Subject: [PATCH 03/19] FIX : [ bug #1913 ] [EXPORT] [PGSQL] Bug when filtering export on a specific year --- htdocs/exports/class/export.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fda062952d1..7ab55fd4e53 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -328,7 +328,7 @@ class Export function conditionDate($Field, $Value, $Sens) { // TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN - if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." ".$Value; + if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'"; elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'"; else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value; return $Condition; From 092dd38851e582580de4f8adf5e7863356183173 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 3 Apr 2015 15:33:41 +0200 Subject: [PATCH 04/19] =?UTF-8?q?FIX=20:=20[=20bug=20#1916=20]=20probl?= =?UTF-8?q?=C3=A8me=20d'icone=20pour=20l'=C3=A9tat=20"clos"=20sur=20les=20?= =?UTF-8?q?projets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/theme/bureau2crea/img/statut4.png | Bin 1640 -> 567 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/htdocs/theme/bureau2crea/img/statut4.png b/htdocs/theme/bureau2crea/img/statut4.png index b12bc0d000ccf86ca62574d00783a7a26d3869f7..75f9155a6d2b2bc97bf73cc16531855d5e773917 100644 GIT binary patch delta 542 zcmV+(0^$AW47UW3B!32COGiWi{{a60|De66lK=n!32;bRa{vGf6951U69E94oEQKA z00(qQO+^Ra1Op8qE{OxTN&o->#7RU!R5;6(lQC-(VHkj)_q+ElX;TDUM8UxffIsICnF2=+Ed-^l!Kdy44a~Z0JxZNb3n!js%6E$$#Z8m+$U#NPhzz%>;9-d_*wr^Iin>)2S7b;5>&iy7E zG4uw#OYaX_*A72^S_^zOM0g?fb?#>wZy&APSYW1rnK{Atl*P&rBP=N3`bkX2S2CC4iFc|r zOJW1Q_XmjJ)EMaYgz!ra_?!!8_z{oublREQGUvs)v3~<#nD)+r%;XtBM3|e2BgQ$B zG_`YW5fReV;v9)FhE^DMu{Our;=i)B1=i+-VHaa)8CABTD5lvwL1fY+Xa6h$&E^SF z6r;+P0=ud-_V+v6olf6Ws~0Jk6@WC0@r>eY8E~YjB@DYnQCz690qn}`Ia^DkDE@uU g#;~XQ>ld7V0v;^A?)HM;RsaA107*qoM6N<$f~-aQLjV8( literal 1640 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%s|1+P|wiV z#N6CmN5ROz&_Lh7NZ-&%*U;R`*vQJjKmiJrfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8EkR}&8R-I5=oVMzl_XZ^<`pZ$OmImpPAEg{v+u2}(t{7puX=A(aKG z`a!A1`K3k4z=%sz23b{L-^Aq1JP;qO z-q+X4Gq1QLF)umQ)5TT^Xo6m5W(qJg%}vbA91YE#%`FWLUEG`;U5uO^Ei9dkES)V3 zjm=?tUGkGlb5rw5V0u#!dW~@E1to>t0-((}MPV=C8 zQ*gV*0H+)@tD;XG=?s&R5hE&|D znS3`}BwXTH{qr+t-sPCh-=t{PyCiReqk)-XmGY8M{iPvQSG%`~=!@*>_`&|gUZX=| zkH8+m{I{VZqFkXIO(vJ3qI0$Lj?T!Ld{^bS;pUk$=l0JtR#R-Mcre%Ux$XPUbDq!n zUVHS3C;s-?`Ip?E&%c;@?jlPM%!y+`4mW z@$(5zmvT(Y|9*OMao%$Mf3_<<&aG}vYYF<0DNykL$VKIv&qqBs&D1GebMThSFLA9+ zvaA*J*2i#~zq|AF+Fo{zN#}bGIi}g^@%7C6`;EnrZ*4-a!m7Qgc>xQfa)aLd^Ex|S zQg-W)-CGWvS`|Fu)w#*S$;~HxMD?|VH#t?ewVLp3b8gKn=Qn&kH{8srFZ_96REPS`+OJe5~p=-07F1_y9>ecvh z-suN^0hu}%KAh5;|M<mRA;uehcYr{^W5w=!zw)mNSGr9-Y4iM-M5t1sbQ zUej}bp2VBCR=z8Y4E`619hXeWwRM*`B{F&0^s~QbwYe&Y@A&s2dy&eM&&=X4GW<8? zKae;-t!|O%{$obEOMJE+jAltXeKGNQ;Su>WcK_!6dzZLx_O3-8zW;R2Cq3`k&Xp~! zyhLjU?|JUvX)d}|R=+i_=70LVI{M4^cY#;KQ*YM#s7+2@ZBe@BSjL*VBkoHt?b;Q- zr* z>9nl#6`}tnGp}#d;l6AVG_|;x+opcsx@&U;XWzAuZHtkSIdeK`BmZr`Y99Rp!zD^4 zZ@( Date: Sat, 4 Apr 2015 17:28:24 +0200 Subject: [PATCH 05/19] Closes #2543: Untranslated "Contract" origin string when creating an invoice from a contract --- ChangeLog | 1 + htdocs/commande/fiche.php | 22 ++++++++++++++++++---- htdocs/compta/facture.php | 24 +++++++++++++++++------- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..9982226def4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 02e6c74c13c..9a844b0a5d5 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -1599,9 +1599,23 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; - $newclassname = $classname; - if ($newclassname == 'Propal') - $newclassname = 'CommercialProposal'; + switch ($classname) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . ''; print '' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . ''; print '' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . ""; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a3403e0d9dd..d5c11cf5b63 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -10,6 +10,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García * * 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 @@ -2294,13 +2295,22 @@ if ($action == 'create') print ''; print ''; - $newclassname = $classname; - if ($newclassname == 'Propal') - $newclassname = 'CommercialProposal'; - elseif ($newclassname == 'Commande') - $newclassname = 'Order'; - elseif ($newclassname == 'Expedition') - $newclassname = 'Sending'; + switch ($classname) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . ''; print '' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . ''; From 611406b75e049623ca4640f7545dc3ec66aa6acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:34:06 +0200 Subject: [PATCH 06/19] Closes #2540 Bug: Incorrect HTML in "Bank account" tab of a Thirdparty --- htdocs/societe/rib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index ea64135bd43..d57a6e75443 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine + * Copyright (C) 2015 Marcos García * * 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 @@ -382,7 +383,7 @@ if ($socid && $action != 'edit' && $action != "create") } if (count($rib_list) == 0) { - print ''.$langs->trans("NoBANRecord").''; + print ''.$langs->trans("NoBANRecord").''; } print ''; From 50091dfe8bbada8fde2e5bc318e6570eaa13b15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:44:52 +0200 Subject: [PATCH 07/19] Closes #2534 SQL error when editing a supplier invoice line --- ChangeLog | 1 + htdocs/fourn/facture/fiche.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..66ee1ebe57a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e06ebfa73ca..54299b0beb8 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -7,6 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * 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 @@ -521,6 +522,10 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); + if (empty($remise_percent)) { + $remise_percent = 0; + } + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { From 5c8e92d52a8269de43753c60c080f29a797a53db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:52:05 +0200 Subject: [PATCH 08/19] Closes #2535 Bug: Untranslated string in "Linked objects" page of a project --- ChangeLog | 1 + htdocs/projet/element.php | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..5b4440b8567 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5a499007fae..80a12964792 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 @@ -415,8 +416,31 @@ foreach ($listofreferent as $key => $value) } } + switch ($classname) { + case 'FactureFournisseur': + $newclassname = 'SupplierInvoice'; + break; + case 'Facture': + $newclassname = 'Bill'; + break; + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + print ''; - print ''.$classname.''; + print ''.$langs->trans($newclassname).''; print ''.$i.''; print ''.price($total_ht).''; print ''.price($total_ttc).''; From 7a2942684cffef8e02bc8994cec776b108c5d655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Apr 2015 12:45:25 +0200 Subject: [PATCH 09/19] Fix #2559 Bug: Untranslated "Total" in Bank module --- htdocs/compta/bank/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index c9b70e94257..c74c5509139 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -130,7 +130,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ''; From 06c749942a8ec344bb6c66483d19ebcb1e04b081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Apr 2015 18:40:19 +0200 Subject: [PATCH 10/19] Update index.php --- htdocs/compta/bank/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index c74c5509139..553979f51c3 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -179,7 +179,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ''; @@ -238,7 +238,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ""; From 345b609ff05bb0edf8a943fdebdb479fc35418fe Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 18:41:40 +0200 Subject: [PATCH 11/19] Closes #2545 Bug: Missing object_margin.png in Amarok theme --- ChangeLog | 1 + htdocs/theme/amarok/img/object_margin.png | Bin 0 -> 579 bytes 2 files changed, 1 insertion(+) create mode 100644 htdocs/theme/amarok/img/object_margin.png diff --git a/ChangeLog b/ChangeLog index 34c26a04e18..bc57dfce49b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project +- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/theme/amarok/img/object_margin.png b/htdocs/theme/amarok/img/object_margin.png new file mode 100644 index 0000000000000000000000000000000000000000..13e4b92c9ce2e0a3698d31fcfc2b82704653f7a0 GIT binary patch literal 579 zcmV-J0=)f+P)AcnU72+nI~k7O&wbPhKp(25S7yLez;ORgKES18>^qZMxkS#t4;4mP!Tkxe+YuKR~p# z$@oMS%NT}+&HxFcfQVpOE|z7b`l*-e*o5sSUdH9q`!{4z zY}=+hGKO=k6tl2Go9vMSK*{xkcH6fG93;^_SAQs`< z{(cHnFI|}=th_KaaqN?Qc zCjh-}k1uO$6!RW|XLIq=Wef@DrfbBaWOD(c3Aube1@!k|XJ_aB{QRpKpjs>h)nXxF zV!T4J5a9bh)6?g%EknKjAqAw@>R4{yeRvJ19-WzA_asS(wl*I>ee~caz)y}P@RPTh R<>vqZ002ovPDHLkV1h?{2Q~lz literal 0 HcmV?d00001 From 35a6ed90a04ff841aad672e47b8bd303cecedbbd Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:02:12 +0200 Subject: [PATCH 12/19] Solves #2542 Bug: Contracts store localtax preferences --- ChangeLog | 1 + htdocs/compta/facture.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc57dfce49b..a69eab23790 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme +- Fix: [ bug #2542 ] Contracts store localtax preferences ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d5c11cf5b63..4a2b13b0069 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry @@ -991,8 +991,12 @@ if (empty($reshook)) { $lines [$i]->fetch_optionals($lines [$i]->rowid); $array_option = $lines [$i]->array_options; } + + // View third's localtaxes for now + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); - $result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $lines [$i]->localtax1_tx, $lines [$i]->localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $date_start, $date_end, 0, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $object->origin, $lines [$i]->rowid, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $date_start, $date_end, 0, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $object->origin, $lines [$i]->rowid, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option); if ($result > 0) { $lineid = $result; From 9d8cb459f1c935ee82ee315da5f505ed0e3ad23c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:28:45 +0200 Subject: [PATCH 13/19] Fix: Bad permission assignments for stock movements actions --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/product/stock/mouvement.php | 3 ++- htdocs/product/stock/product.php | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a69eab23790..a55e95630d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences +- Fix: Bad permission assignments for stock movements actions ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index cf05e461e35..89c37098f2a 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -102,8 +102,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b42fc258c6d..273ea7f6336 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2013 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -1000,8 +1000,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1498b12a033..8794b00137d 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -387,7 +388,7 @@ if ($resql) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 400c3c1f006..0241c0d4dcf 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014 Cédric Gross * * This program is free software; you can redistribute it and/or modify @@ -543,7 +543,7 @@ if (empty($action) && $product->id) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } From 914b324a674b014aace9f7e802a7346422450340 Mon Sep 17 00:00:00 2001 From: braito4 Date: Thu, 9 Apr 2015 10:37:54 +0200 Subject: [PATCH 14/19] minor bug drag and drop total line in tasks list --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a564a312ac2..20b7bb1ec83 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -416,7 +416,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0) { - print ''; + print ''; print ''.$langs->trans("Total").''; if ($showproject) print ''; print ''; From 1f5ca497d34e77a5c443e61f3c545fcbb5989fec Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 9 Apr 2015 20:50:19 +0200 Subject: [PATCH 15/19] Bug: Untranslated table header in /compta/bank/search.php --- htdocs/langs/en_US/banks.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 05156a723ad..dee1f219614 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -158,3 +158,5 @@ LabelRIB=BAN Label NoBANRecord=No BAN record DeleteARib=Delete BAN record ConfirmDeleteRib=Are you sure you want to delete this BAN record ? +StartDate=Start date +EndDate=End date From 6889162d7a3b5a406c662e76c9d08057f7f01105 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Apr 2015 22:51:53 +0200 Subject: [PATCH 16/19] Fix: management of vat type 2, 4 and 6 is now ok. Works for canada and ivory cost. --- htdocs/admin/company.php | 10 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/price.lib.php | 116 ++++++++++-------- htdocs/install/mysql/data/llx_c_tva.sql | 4 + .../install/mysql/migration/3.6.0-3.7.0.sql | 5 + htdocs/langs/en_US/admin.lang | 10 +- test/phpunit/PricesTest.php | 28 ++++- 7 files changed, 111 insertions(+), 64 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 96dff7755af..da63d507e2b 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -605,8 +605,9 @@ if ($action == 'edit' || $action == 'updateedit') } print ''; + $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); + print ''.$langs->trans("CalcLocaltax").': '; - $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); print ''; print ""; @@ -649,7 +650,6 @@ if ($action == 'edit' || $action == 'updateedit') print ''; } print ': '; - $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); print ''; print ""; @@ -1061,15 +1061,15 @@ else print ''.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) { - print $langs->transcountry("CalcLocaltax1",$mysoc->country_code); + print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); } else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1) { - print $langs->transcountry("CalcLocaltax2",$mysoc->country_code); + print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); } else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2) { - print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); + print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); } print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de5ddc560b2..92b626cde4a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3185,7 +3185,7 @@ function get_localtax_by_third($local) /** * Get type and rate of localtaxes for a particular vat rate/country fo thirdparty * TODO - * This function is called to retrieve type for building PDF. Such call of function must be removed. + * This function is also called to retrieve type for building PDF. Such call of function must be removed. * Instead this function must be called when adding a line to get (array of localtax and type) and * provide it to the function calcul_price_total. * diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 00144db74e5..1d635875f71 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -27,13 +27,12 @@ /** * Calculate totals (net, vat, ...) of a line. * Value for localtaxX_type are '0' : local tax not applied - * '1' : local tax apply on products and services without vat (vat is not applied for local tax calculation) - * '2' : local tax apply on products and services before vat (vat is calculated on amount + localtax) - * '3' : local tax apply on products without vat (vat is not applied for local tax calculation) - * '4' : local tax apply on products before vat (vat is calculated on amount + localtax) - * '5' : local tax apply on services without vat (vat is not applied for local tax calculation) - * '6' : local tax apply on services before vat (vat is calculated on amount + localtax) - * '7' : local tax is a fix amount applied on global invoice + * '1' : local tax apply on products and services without vat (localtax is calculated on amount without tax) + * '2' : local tax apply on products and services including vat (localtax is calculated on amount + tax) + * '3' : local tax apply on products without vat (localtax is calculated on amount without tax) + * '4' : local tax apply on products including vat (localtax is calculated on amount + tax) + * '5' : local tax apply on services without vat (localtax is calculated on amount without tax) + * '6' : local tax apply on services including vat (localtax is calculated on amount + tax) * * @param int $qty Quantity * @param float $pu Unit price (HT or TTC selon price_base_type) @@ -42,27 +41,27 @@ * @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply, -1=autodetect according to seller * @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply, -1=autodetect according to seller * @param float $remise_percent_global 0 - * @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC + * @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC * @param int $info_bits Miscellaneous informations on line * @param int $type 0/1=Product/service * @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. - * @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function). + * @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @return result[ 0=total_ht, - * 1=total_vat, - * 2=total_ttc, + * 1=total_vat, (main vat only) + * 2=total_ttc, (total_ht + main vat + local taxes) * 3=pu_ht, - * 4=pu_tva, + * 4=pu_vat, (main vat only) * 5=pu_ttc, * 6=total_ht_without_discount, - * 7=total_vat_without_discount, - * 8=total_ttc_without_discount, - * 9=amount tax1 for total_ht, - * 10=amount tax2 for total_ht, - * 11=amount tax1 for pu_ht, - * 12=amount tax2 for pu_ht, - * 13=not used???, - * 14=amount tax1 for total_ht_without_discount, - * 15=amount tax2 for total_ht_without_discount] + * 7=total_vat_without_discount, (main vat only) + * 8=total_ttc_without_discount, (total_ht + main vat + local taxes) + * 9=total_tax1 for total_ht, + * 10=total_tax2 for total_ht, + * 11=pu_tax1 for pu_ht, !! should not be used + * 12=pu_tax2 for pu_ht, !! should not be used + * 13=!! should not be used + * 14=total_tax1 for total_ht_without_discount, + * 15=total_tax2 for total_ht_without_discount] */ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '',$localtaxes_array='') { @@ -94,7 +93,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj; if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj; - // Now we search localtaxes information ourself (rates and types). + // Now we search localtaxes information ourself (rates and types). $localtax1_type=0; $localtax2_type=0; @@ -131,12 +130,29 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $tot_sans_remise = $pu * $qty; $tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100)); $tot_avec_remise = $tot_avec_remise_ligne * (1 - ($remise_percent_global / 100)); - - // initialize result + + // initialize result array for ($i=0; $i <= 15; $i++) $result[$i] = 0; // if there's some localtax including vat, we calculate localtaxes (we will add later) - $localtaxes = array(0,0,0); + + //If input unit price is 'HT', we need to have the totals with main VAT for a correct calculation + if ($price_base_type != 'TTC') + { + $tot_sans_remise_wt = price2num($tot_sans_remise * (1 + ($txtva / 100)),'MU'); + $tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)),'MU'); + $pu_wt = price2num($pu * (1 + ($txtva / 100)),'MU'); + } + else + { + $tot_sans_remise_wt = $tot_sans_remise; + $tot_avec_remise_wt = $tot_avec_remise; + $pu_wt = $pu; + } + + //print 'rr'.$price_base_type.'-'.$txtva.'-'.$tot_sans_remise_wt."-".$pu_wt."-".$uselocaltax1_rate."-".$localtax1_rate."-".$localtax1_type."\n"; + + $localtaxes = array(0,0,0); $apply_tax = false; switch($localtax1_type) { case '2': // localtax on product or service @@ -150,13 +166,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt break; } if ($uselocaltax1_rate && $apply_tax) { - $result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT'); + $result[14] = price2num(($tot_sans_remise_wt * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise_wt, 'MT'); $localtaxes[0] += $result[14]; - $result[9] = price2num(($tot_avec_remise * (1 + ( $localtax1_rate / 100))) - $tot_avec_remise, 'MT'); + $result[9] = price2num(($tot_avec_remise_wt * (1 + ( $localtax1_rate / 100))) - $tot_avec_remise_wt, 'MT'); $localtaxes[1] += $result[9]; - $result[11] = price2num(($pu * (1 + ( $localtax1_rate / 100))) - $pu, 'MU'); + $result[11] = price2num(($pu_wt * (1 + ( $localtax1_rate / 100))) - $pu_wt, 'MU'); $localtaxes[2] += $result[11]; } @@ -173,13 +189,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt break; } if ($uselocaltax2_rate && $apply_tax) { - $result[15] = price2num(($tot_sans_remise * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise, 'MT'); + $result[15] = price2num(($tot_sans_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise_wt, 'MT'); $localtaxes[0] += $result[15]; - $result[10] = price2num(($tot_avec_remise * (1 + ( $localtax2_rate / 100))) - $tot_avec_remise, 'MT'); + $result[10] = price2num(($tot_avec_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_avec_remise_wt, 'MT'); $localtaxes[1] += $result[10]; - $result[12] = price2num(($pu * (1 + ( $localtax2_rate / 100))) - $pu, 'MU'); + $result[12] = price2num(($pu_wt * (1 + ( $localtax2_rate / 100))) - $pu_wt, 'MU'); $localtaxes[2] += $result[12]; } @@ -188,43 +204,43 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt { // We work to define prices using the price without tax $result[6] = price2num($tot_sans_remise, 'MT'); - $result[8] = price2num(($tot_sans_remise + $localtaxes[0]) * (1 + ( (($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non - $result8bis= price2num(($tot_sans_remise + $localtaxes[0]) * (1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) + $result[8] = price2num($tot_sans_remise * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[0], 'MT'); // Selon TVA NPR ou non + $result8bis= price2num($tot_sans_remise * (1 + ( $txtva / 100)) + $localtaxes[0], 'MT'); // Si TVA consideree normale (non NPR) $result[7] = price2num($result8bis - ($result[6] + $localtaxes[0]), 'MT'); $result[0] = price2num($tot_avec_remise, 'MT'); - $result[2] = price2num(($tot_avec_remise + $localtaxes[1]) * (1 + ( (($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non - $result2bis= price2num(($tot_avec_remise + $localtaxes[1]) * (1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) + $result[2] = price2num($tot_avec_remise * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[1], 'MT'); // Selon TVA NPR ou non + $result2bis= price2num($tot_avec_remise * (1 + ( $txtva / 100)) + $localtaxes[1], 'MT'); // Si TVA consideree normale (non NPR) $result[1] = price2num($result2bis - ($result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) - + $result[3] = price2num($pu, 'MU'); - $result[5] = price2num(($pu + $localtaxes[2]) * (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non - $result5bis= price2num(($pu + $localtaxes[2]) * (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR) + $result[5] = price2num($pu * (1 + ( (($info_bits & 1)?0:$txtva) / 100)) + $localtaxes[2], 'MU'); // Selon TVA NPR ou non + $result5bis= price2num($pu * (1 + ($txtva / 100)) + $localtaxes[2], 'MU'); // Si TVA consideree normale (non NPR) $result[4] = price2num($result5bis - ($result[3] + $localtaxes[2]), 'MU'); } else { // We work to define prices using the price with tax $result[8] = price2num($tot_sans_remise + $localtaxes[0], 'MT'); - $result[6] = price2num(($tot_sans_remise + $localtaxes[0]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non - $result6bis= price2num(($tot_sans_remise + $localtaxes[0]) / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) + $result[6] = price2num($tot_sans_remise / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non + $result6bis= price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) $result[7] = price2num($result[8] - ($result6bis + $localtaxes[0]), 'MT'); $result[2] = price2num($tot_avec_remise + $localtaxes[1], 'MT'); - $result[0] = price2num(($tot_avec_remise + $localtaxes[1]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non - $result0bis= price2num(($tot_avec_remise + $localtaxes[1]) / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) - $result[1] = price2num($result[2] - ($result0bis + $localtaxes[1]), 'MT'); // Total VAT = TTC - HT + $result[0] = price2num($tot_avec_remise / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non + $result0bis= price2num($tot_avec_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR) + $result[1] = price2num($result[2] - ($result0bis + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) - $result[5] = price2num(($pu + $localtaxes[2]), 'MU'); - $result[3] = price2num(($pu + $localtaxes[2]) / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non - $result3bis= price2num(($pu + $localtaxes[2]) / (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR) + $result[5] = price2num($pu + $localtaxes[2], 'MU'); + $result[3] = price2num($pu / (1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non + $result3bis= price2num($pu / (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR) $result[4] = price2num($result[5] - ($result3bis + $localtaxes[2]), 'MU'); } // if there's some localtax without vat, we calculate localtaxes (we will add them at end) - //If price is 'TTC' we need to have the totals without VAT for a correct calculation - if ($price_base_type=='TTC') + //If input unit price is 'TTC', we need to have the totals without main VAT for a correct calculation + if ($price_base_type == 'TTC') { $tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU'); $tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU'); @@ -244,7 +260,6 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt break; } if ($uselocaltax1_rate && $apply_tax) { - $result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax1 for total_ht_without_discount $result[8] += $result[14]; // total_ttc_without_discount + tax1 @@ -299,6 +314,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt } } + // initialize result array + //for ($i=0; $i <= 15; $i++) $result[$i] = (float) $result[$i]; + dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.$conf->global->MAIN_ROUNDING_RULE_TOT.' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]); return $result; diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index a6a86657b95..f1a86a18e6b 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -139,6 +139,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (83 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (84, 8, '9','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (85, 8, '4.8','0','VAT reduced rate',1); +-- IVORY COST (id country=21) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1); + -- JAPAN (id country=123) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1231, 123, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1232, 123, '5','0','VAT Rate 5',1); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 7a432a1109e..985c508b5d8 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1165,3 +1165,8 @@ UPDATE llx_bank_url set url = REPLACE( url, 'fiche.php', 'card.php'); -- Add id commandefourndet in llx_commande_fournisseur_dispatch to correct /fourn/commande/dispatch.php display when several times same product in supplier order ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_commandefourndet INTEGER NOT NULL DEFAULT 0 AFTER fk_product; + + +-- IVORY COST (id country=21) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b70f9fa8a84..d4c2ec48e48 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -386,7 +386,7 @@ ExtrafieldParamHelpradio=Parameters list have to be like key,value

for e ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' -LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
1 : local tax apply on products and services without vat (vat is not applied on local tax)
2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
3 : local tax apply on products without vat (vat is not applied on local tax)
4 : local tax apply on products before vat (vat is calculated on amount + localtax)
5 : local tax apply on services without vat (vat is not applied on local tax)
6 : local tax apply on services before vat (vat is calculated on amount + localtax) +LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
1 : local tax apply on products and services without vat (localtax is calculated on amount without tax)
2 : local tax apply on products and services including vat (localtax is calculated on amount + main tax)
3 : local tax apply on products without vat (localtax is calculated on amount without tax)
4 : local tax apply on products including vat (vat is calculated on amount + main vat)
5 : local tax apply on services without vat (localtax is calculated on amount without tax)
6 : local tax apply on services including vat (localtax is calculated on amount + tax) SMS=SMS LinkToTestClickToDial=Enter a phone number to call to show a link to test the ClickToDial url for user %s RefreshPhoneLink=Refresh link @@ -818,12 +818,12 @@ LocalTax2IsUsedDescES= The RE rate by default when creating prospects, invoices, LocalTax2IsNotUsedDescES= By default the proposed IRPF is 0. End of rule. LocalTax2IsUsedExampleES= In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules. LocalTax2IsNotUsedExampleES= In Spain they are bussines not subject to tax system of modules. -CalcLocaltax=Reports -CalcLocaltax1ES=Sales - Purchases +CalcLocaltax=Reports on local taxes +CalcLocaltax1=Sales - Purchases CalcLocaltax1Desc=Local Taxes reports are calculated with the difference between localtaxes sales and localtaxes purchases -CalcLocaltax2ES=Purchases +CalcLocaltax2=Purchases CalcLocaltax2Desc=Local Taxes reports are the total of localtaxes purchases -CalcLocaltax3ES=Sales +CalcLocaltax3=Sales CalcLocaltax3Desc=Local Taxes reports are the total of localtaxes sales LabelUsedByDefault=Label used by default if no translation can be found for code LabelOnDocuments=Label on documents diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 87ffd9c6066..5f0b503d911 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -133,7 +133,7 @@ class PricesTest extends PHPUnit_Framework_TestCase global $mysoc; $mysoc=new Societe($db); - // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' + // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value) $mysoc->country_code='FR'; $mysoc->country_id=1; $result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0); @@ -157,7 +157,7 @@ class PricesTest extends PHPUnit_Framework_TestCase $mysoc->localtax2_assuj=0; $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); print __METHOD__." result2=".join(', ',$result2)."\n"; - $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result2,'Test3'); + $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result2,'Test3 ES'); // 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, nor localtax2 (method we provide value) $mysoc->country_code='ES'; @@ -168,7 +168,6 @@ class PricesTest extends PHPUnit_Framework_TestCase print __METHOD__." result3=".join(', ',$result3)."\n"; // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0),$result3,'Test4'); - //$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result3); // 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, nor localtax2 (other method autodetect) $mysoc->country_code='ES'; @@ -179,8 +178,29 @@ class PricesTest extends PHPUnit_Framework_TestCase print __METHOD__." result3=".join(', ',$result3)."\n"; // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0),$result3,'Test5'); - //$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result3); + // 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (method we provide value) + $mysoc->country_code='CI'; + $mysoc->country_id=21; + $mysoc->localtax1_assuj=1; + $mysoc->localtax2_assuj=0; + //$localtaxes=getLocalTaxesFromRate(18, 0, null, $mysoc); + //var_dump($locataxes); + $result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2 + print __METHOD__." result3=".join(', ',$result3)."\n"; + // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) + $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0),$result3,'Test6 CI'); + + // 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect) + $mysoc->country_code='CI'; + $mysoc->country_id=21; + $mysoc->localtax1_assuj=1; + $mysoc->localtax2_assuj=0; + $result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2 + print __METHOD__." result3=".join(', ',$result3)."\n"; + // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) + $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0),$result3,'Test7 CI'); + return true; } From 1bf95b48c1baa664c1237dc5ddf3a17cef6b32e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Apr 2015 11:45:50 +0200 Subject: [PATCH 17/19] Fix remove warning when posting a vote --- htdocs/opensurvey/public/studs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index 1b39391b67c..d2571c7f096 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -114,8 +114,8 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout // Check if vote already exists $sql = 'SELECT id_users, nom as name'; - $sql.= ' FROM '.MAIN_DB_PREFIX."opensurvey_user_studs'; - $sql.= ' WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; + $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; + $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; $resql = $db->query($sql); $num_rows = $db->num_rows($resql); if ($num_rows > 0) From 584ca971b03367b1037f3b156f6f044fc056369f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Apr 2015 01:32:53 +0200 Subject: [PATCH 18/19] Fix #2600 --- htdocs/comm/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 427b2201d52..bda5c6598f7 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -65,7 +65,7 @@ if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db); llxHeader(); -print_fiche_titre($langs->trans("CustomerArea")); +print_fiche_titre($langs->trans("CommercialArea")); print '
'; From 44f10ebec250eb636feb14f3fd20109336340a21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Apr 2015 13:01:23 +0200 Subject: [PATCH 19/19] Fix: do not add new value --- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 493634c84a5..c6377b926cb 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -99,7 +99,7 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ
- + textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?>