From 9aaafde6d56d499443991d9e81c58bdf033ed2b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Jan 2014 18:48:57 +0100 Subject: [PATCH 01/14] Fix: Pb with cache files for graphical boxes: Missing year into cache id. User with restrcited permission on thirdparty must not share same cache files that "see all" users. --- htdocs/comm/list.php | 4 ++-- .../core/boxes/box_graph_invoices_permonth.php | 18 ++++++++++++------ .../box_graph_invoices_supplier_permonth.php | 10 ++++++++-- .../core/boxes/box_graph_orders_permonth.php | 18 ++++++++++++------ .../box_graph_orders_supplier_permonth.php | 18 ++++++++++++------ .../core/boxes/box_graph_propales_permonth.php | 18 ++++++++++++------ 6 files changed, 58 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 4e6ac38c810..1d2f792ab2f 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -196,8 +196,8 @@ if ($result) print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); - print ' '; + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); + print ' '; $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index c8fc4a917f2..f87cf169757 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -81,6 +81,12 @@ class box_graph_invoices_permonth extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); + $dir=''; // We don't need a path because image file will not be saved into disk + $prefix=''; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + if ($user->rights->facture->lire) { $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -119,9 +125,9 @@ class box_graph_invoices_permonth extends ModeleBoxes { $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/invoicesnbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); @@ -157,9 +163,9 @@ class box_graph_invoices_permonth extends ModeleBoxes { $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/invoicesamountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 45f3be02933..e732270c044 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -80,6 +80,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); + $dir=''; // We don't need a path because image file will not be saved into disk + $prefix=''; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + if ($user->rights->fournisseur->facture->lire) { $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -118,7 +124,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes { $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/invoicessuppliernbinyear-".$year.".png"; + $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png'; @@ -156,7 +162,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes { $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/invoicessupplieramountinyear-".$year.".png"; + $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png'; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 17fc0215fef..704117834c4 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -81,6 +81,12 @@ class box_graph_orders_permonth extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); + $dir=''; // We don't need a path because image file will not be saved into disk + $prefix=''; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + if ($user->rights->commande->lire) { $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -119,9 +125,9 @@ class box_graph_orders_permonth extends ModeleBoxes { $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/ordersnbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); @@ -157,9 +163,9 @@ class box_graph_orders_permonth extends ModeleBoxes { $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/ordersamountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 61cc4f8fe87..5267bf3ffb5 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -80,6 +80,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); + $dir=''; // We don't need a path because image file will not be saved into disk + $prefix=''; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + if ($user->rights->fournisseur->commande->lire) { $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -118,9 +124,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/orderssuppliernbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssuppliernbinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); @@ -156,9 +162,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); - $filenamenb = $dir."/orderssupplieramountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 8fd42d525fd..58d00ce97fe 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -81,6 +81,12 @@ class box_graph_propales_permonth extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); + $dir=''; // We don't need a path because image file will not be saved into disk + $prefix=''; + $socid=0; + if ($user->societe_id) $socid=$user->societe_id; + if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + if ($user->rights->propal->lire) { $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -120,9 +126,9 @@ class box_graph_propales_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action')==$refreshaction?-1:(3600*24))); $datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars'); - $filenamenb = $dir."/propalsnbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsnbinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); @@ -161,9 +167,9 @@ class box_graph_propales_permonth extends ModeleBoxes $datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars'); //$datatype2 = array('lines','bars'); - $filenamenb = $dir."/propalsamountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$year.'.png'; + $filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png"; + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); From 9166dc2d8ceeffb02419880641e01ca69244e2f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Feb 2014 16:57:45 +0100 Subject: [PATCH 02/14] Fix: priority is a field smallint. --- htdocs/comm/action/class/actioncomm.class.php | 8 ++++---- htdocs/comm/action/fiche.php | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2f2b65cb6ac..10082062d06 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -58,7 +58,7 @@ class ActionComm extends CommonObject var $percentage; // Percentage var $location; // Location var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) - var $priority; // Free text ('' By default) + var $priority; // Small int (0 By default) var $note; // Description var $usertodo; // Object user that must do action @@ -116,7 +116,7 @@ class ActionComm extends CommonObject $this->location=dol_trunc(trim($this->location),128); $this->note=dol_htmlcleanlastbr(trim($this->note)); if (empty($this->percentage)) $this->percentage = 0; - if (empty($this->priority)) $this->priority = 0; + if (empty($this->priority) || ! is_numeric($this->priority)) $this->priority = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->punctual)) $this->punctual = 0; if (empty($this->transparency)) $this->transparency = 0; @@ -438,7 +438,7 @@ class ActionComm extends CommonObject $this->label=trim($this->label); $this->note=trim($this->note); if (empty($this->percentage)) $this->percentage = 0; - if (empty($this->priority)) $this->priority = 0; + if (empty($this->priority) || ! is_numeric($this->priority)) $this->priority = 0; if (empty($this->transparency)) $this->transparency = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; if ($this->percentage > 100) $this->percentage = 100; @@ -1064,7 +1064,7 @@ class ActionComm extends CommonObject $this->percentage=0; $this->location='Location'; $this->transparency=0; - $this->priority='Priority X'; + $this->priority=1; $this->note = 'Note'; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 18bf3ecc7ed..d0c6a213c77 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -167,8 +167,7 @@ if ($action == 'add_action') $actioncomm->datep = $datep; $actioncomm->datef = $datef; $actioncomm->percentage = $percentage; - $actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * -60; + $actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $usertodo=new User($db); if ($_POST["affectedto"] > 0) From 9e06f185c52be3987a8275e867a33551891ac6af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Feb 2014 18:19:49 +0100 Subject: [PATCH 03/14] Fix: Fix problem of invalid paypal link with \n. --- htdocs/compta/facture.php | 5 ++++- htdocs/core/class/html.formmail.class.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 044cc203cf8..69c24341f9c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3917,7 +3917,10 @@ else if ($id > 0 || ! empty($ref)) $formmail->frommail = $user->email; $formmail->withfrom=1; $liste=array(); - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) + { + $liste[$key]=$value; + } $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index e5dc008fc2e..66fd945c01d 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -566,12 +566,12 @@ class FormMail if ($this->param["models"]=='order_send') { $url=getPaypalPaymentUrl(0,'order',$this->substit['__ORDERREF__']); - $this->substit['__PERSONALIZED__']=$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url); + $this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url)); } if ($this->param["models"]=='facture_send') { $url=getPaypalPaymentUrl(0,'invoice',$this->substit['__FACREF__']); - $this->substit['__PERSONALIZED__']=$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url); + $this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url)); } } From 56a36ba9c49741ef7c796f3bdf8215b186ff4c62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 00:36:38 +0100 Subject: [PATCH 04/14] Fix: bad translation of date format for pt_BR --- htdocs/langs/pt_BR/main.lang | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/pt_BR/main.lang b/htdocs/langs/pt_BR/main.lang index 8686afedf81..e33b22f9ef9 100644 --- a/htdocs/langs/pt_BR/main.lang +++ b/htdocs/langs/pt_BR/main.lang @@ -8,12 +8,12 @@ FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=None -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=mm/dd/aaaa -FormatDateShortJavaInput=mm/dd/aaaa -FormatDateShortJQuery=mm/dd/aa -FormatDateShortJQueryInput=mm/dd/aa +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/mm/yyyy +FormatDateShortJavaInput=dd/mm/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y From b714347b6b0a8704286cde023a5065bf80dd1c23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 01:01:31 +0100 Subject: [PATCH 05/14] Fix: Substition of extra field was ko for order. --- htdocs/core/class/extrafields.class.php | 8 ++++---- .../commande/doc/doc_generic_order_odt.modules.php | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 277ee0c5ccd..8227bfbc0e7 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -516,7 +516,7 @@ class ExtraFields /** * Load array this->attribute_label * - * @param string $elementtype Type of element + * @param string $elementtype Type of element ('adherent', 'commande', societe', 'facture', 'propal', 'product', ...) * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @return array Array of attributes for all extra fields */ @@ -941,18 +941,18 @@ class ExtraFields } $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; //$sql.= ' AND entity = '.$conf->entity; - + dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql); $resql = $this->db->query($sql); if ($resql) { $value=''; // value was used, so now we reste it to use it to build final output - + $obj = $this->db->fetch_object($resql); // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|',$InfoFieldList[1]); - + if(is_array($fields_label)) { foreach ($fields_label as $field_toshow) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1195722e29e..e3ca8814a70 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -140,6 +140,16 @@ class doc_generic_order_odt extends ModelePDFCommandes $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; } + // Retrieve extrafields + if(is_array($object->array_options) && count($object->array_options)) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('commande',true); + $object->fetch_optionals($object->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key='object',$outputlangs); + } return $resarray; } From 319b13dafb9b883dfe98ef7893b2fabcd8c057a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 01:02:09 +0100 Subject: [PATCH 06/14] Fix: Field nature is not correctly filled. --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d627cd85b4b..6a615ce01c2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -338,7 +338,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".((empty($this->finished) || $this->finished < 0)?'null':$this->finished); + $sql.= ", ".((! isset($this->finished) || $this->finished < 0)?'null':$this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); @@ -474,7 +474,7 @@ class Product extends CommonObject $sql.= ", tosell = " . $this->status; $sql.= ", tobuy = " . $this->status_buy; - $sql.= ", finished = " . ((empty($this->finished) || $this->finished < 0) ? "null" : $this->finished); + $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); @@ -1351,7 +1351,7 @@ class Product extends CommonObject // We should not load stock at each fetch. If someone need stock, he must call load_stock after fetch. //$res=$this->load_stock(); //return $res; - + return 1; } else From abc8649e02c6c0ae020334a6b96c2d4969134c74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 01:16:20 +0100 Subject: [PATCH 07/14] Fix: Bug of import of agenda when using https link --- htdocs/admin/agenda_extsites.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index e7ca2216bf3..4bb3cb8c4f3 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -67,7 +67,7 @@ if ($actionsave) $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); if ($color=='-1') $color=''; - if (! empty($src) && ! preg_match('/^(http\s*|ftp\s*):/', $src)) + if (! empty($src) && ! dol_is_url($src)) { setEventMessage($langs->trans("ErrorParamMustBeAnUrl"),'errors'); $error++; From b750e98d40037a620ae22b02055b054120792212 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 02:02:01 +0100 Subject: [PATCH 08/14] Fix: Pb of file upload and download. --- ChangeLog | 14 +++ htdocs/comm/action/document.php | 99 ++++++++++--------- .../core/class/commondocgenerator.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 1 + htdocs/core/lib/files.lib.php | 15 +++ .../tpl/document_actions_post_headers.tpl.php | 2 +- .../tpl/document_actions_pre_headers.tpl.php | 1 + htdocs/document.php | 2 +- 8 files changed, 85 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 965ff2b3443..80383795325 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,20 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 3.5.1 compared to 3.5.0 ***** +Fix: Bug of import of agenda when using https link +Fix: Field nature not saved correctly +Fix: Substituion of extra field was ko for order +Fix: Bad translation of date format for pt_BR. +Fix: priority field of agenda record is smallint. +Fix: Missing loading of lang in some pages. +Fix: Write note in invoice when using pos module. +Fix: Link to paypal was invalid into email text. +Fix: ref and date of supplier invoice. +Fix: Check on bank account. +Fix: Problem with file upload and download. + ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: - New: Add hidden option BANK_DISABLE_DIRECT_INPUT. diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 848c8057b6d..9ca99f8634b 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -55,16 +55,16 @@ if ($user->societe_id > 0) } $result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); -$act = new ActionComm($db); +$object = new ActionComm($db); if ($objectid > 0) { - $ret = $act->fetch($objectid); + $ret = $object->fetch($objectid); if ($ret > 0) { $company=new Societe($db); - $company->fetch($act->societe->id); - $act->societe=$company; // For backward compatibility - $act->thirdparty=$company; + $company->fetch($object->societe->id); + $object->societe=$company; // For backward compatibility + $object->thirdparty=$company; } } @@ -79,6 +79,9 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; +$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); +$modulepart='contract'; + /* * Actions @@ -96,17 +99,15 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -if ($act->id > 0) +if ($object->id > 0) { - $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); - $author=new User($db); - $author->fetch($act->author->id); - $act->author=$author; + $author->fetch($object->author->id); + $object->author=$author; - if ($act->contact->id) $act->fetch_contact($act->contact->id); + if ($object->contact->id) $object->fetch_contact($object->contact->id); - $head=actions_prepare_head($act); + $head=actions_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); // Affichage fiche action en mode visu @@ -116,53 +117,53 @@ if ($act->id > 0) // Ref print ''.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); print ''; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''.$langs->trans("Type").''.$act->type.''; + print ''.$langs->trans("Type").''.$object->type.''; } // Title - print ''.$langs->trans("Title").''.$act->label.''; + print ''.$langs->trans("Title").''.$object->label.''; // Full day event - print ''.$langs->trans("EventOnFullDay").''.yn($act->fulldayevent).''; + print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).''; // Date start print ''.$langs->trans("DateActionStart").''; - if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour'); - else print dol_print_date($act->datep,'day'); - if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); + if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); + else print dol_print_date($object->datep,'day'); + if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''; print ''."\n"; print '
'; print ''; print ''; - print ''; - print ''; - print ''; - //print ''; + print ''; + print ''; + print ''; + //print ''; print img_picto($langs->trans("ViewCal"),'object_calendar').' '; print '
'."\n"; print '
'; print ''; print ''; - print ''; - print ''; - print ''; - //print ''; + print ''; + print ''; + print ''; + //print ''; print img_picto($langs->trans("ViewCal"),'object_calendarweek').' '; print '
'."\n"; print '
'; print ''; print ''; - print ''; - print ''; - print ''; - //print ''; + print ''; + print ''; + print ''; + //print ''; print img_picto($langs->trans("ViewCal"),'object_calendarday').' '; print '
'."\n"; print ''; @@ -170,43 +171,43 @@ if ($act->id > 0) // Date end print ''.$langs->trans("DateActionEnd").''; - if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour'); - else print dol_print_date($act->datef,'day'); - if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); + if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); + else print dol_print_date($object->datef,'day'); + if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print ''; // Status print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; - print $act->getLibStatut(4); + print $object->getLibStatut(4); print ''; // Location - print ''.$langs->trans("Location").''.$act->location.''; + print ''.$langs->trans("Location").''.$object->location.''; print '

'; // Third party - Contact - print ''; print ''; print ''; @@ -232,7 +233,7 @@ if ($act->id > 0) // Priority print ''; @@ -255,7 +256,7 @@ if ($act->id > 0) $modulepart = 'actions'; $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; - $param = '&id=' . $act->id; + $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 86d924b5fa2..f636831952c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -260,7 +260,7 @@ abstract class CommonDocGenerator $array_key.'_total_localtax2'=>price2num($object->total_localtax2), $array_key.'_total_ttc'=>price2num($object->total_ttc), $array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()), - + $array_key.'_vatrate'=>vatrate($object->tva), $array_key.'_note_private'=>$object->note, $array_key.'_note'=>$object->note_public, @@ -314,7 +314,7 @@ abstract class CommonDocGenerator 'line_date_end'=>$line->date_end ); } - + /** * Define array with couple substitution key => substitution value * diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 172d65b4ca6..1319ad766d0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -765,6 +765,7 @@ class FormFile { $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; + if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath; } $var=!$var; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index dd4ff4b6ed3..d2310e25ac0 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1564,6 +1564,15 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } + else if ($modulepart == 'project_task') + { + if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->projet->dir_output.'/'.$original_file; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; + } // Wrapping pour les commandes fournisseurs else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') @@ -1786,6 +1795,12 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } else { + if (empty($conf->$modulepart->dir_output)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + $perm=GETPOST('perm'); $subperm=GETPOST('subperm'); if ($perm || $subperm) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index eeb598d20f8..2ae7b9ad595 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -42,7 +42,7 @@ $formfile=new FormFile($db); // Show upload form (document and links) $formfile->form_attach_new_file( - $_SERVER["PHP_SELF"].'?id='.$object->id, + $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1'), '', 0, 0, diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index 7bfc5964140..989a3bcaf73 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -16,6 +16,7 @@ * or see http://www.gnu.org/ */ +// Variable $upload_dir must be defined when entering here // Send file/link if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { diff --git a/htdocs/document.php b/htdocs/document.php index bb6bd032301..1b3d494d1a1 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -168,7 +168,7 @@ if (! file_exists($original_file_osencoded)) exit; } -// Les drois sont ok et fichier trouve, on l'envoie +// Permissions are ok and file found, so we return it header('Content-Description: File Transfer'); if ($encoding) header('Content-Encoding: '.$encoding); From aad7885bca23b5b54ffc642b937cd162773fa684 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 02:35:59 +0100 Subject: [PATCH 09/14] Fix: [bug #1226 ] page ne se charge pas quand beaucoup de prospect en base --- htdocs/core/lib/ajax.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 041235682d2..cc5ca841c52 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -305,6 +305,7 @@ function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0) global $conf; if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) + if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; /* Some properties for combobox: minLengthToAutocomplete: 2, From 5b89bc18f579f0955aa8bfdcb703b9030387428e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 02:46:05 +0100 Subject: [PATCH 10/14] [ bug #1231 ] PDF always generated in interventions --- ChangeLog | 6 +++++- htdocs/fichinter/fiche.php | 36 ++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80383795325..afde59ec7f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,11 @@ Fix: Link to paypal was invalid into email text. Fix: ref and date of supplier invoice. Fix: Check on bank account. Fix: Problem with file upload and download. - +Fix: Page load not ending when large number of thirdparies. We + added option MAIN_DISABLE_AJAX_COMBOX to disable javascript + combo feature that is root cause of problem. +Fix: [ bug #1231 ] PDF always generated in interventions + ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: - New: Add hidden option BANK_DISABLE_DIRECT_INPUT. diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 36178057338..576f7ac496a 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -109,7 +109,8 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->fichein $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } @@ -134,7 +135,8 @@ else if ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->fich $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } @@ -459,7 +461,7 @@ else if ($action == "addline" && $user->rights->ficheinter->creer) { $db->commit(); - fichinter_create($db, $object, $object->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } @@ -529,7 +531,7 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST( $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -564,7 +566,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); } /* @@ -585,7 +587,8 @@ else if ($action == 'up' && $user->rights->ficheinter->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); exit; } @@ -604,7 +607,8 @@ else if ($action == 'down' && $user->rights->ficheinter->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $object, $object->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); exit; } @@ -781,7 +785,7 @@ else if ($action == 'update_extras') $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); if ($ret < 0) $error++; - + if (! $error) { // Actions on extra fields (by external module or standard code) @@ -799,7 +803,7 @@ else if ($action == 'update_extras') } else if ($reshook < 0) $error++; } - + if ($error) $action = 'edit_extras'; } @@ -973,7 +977,7 @@ if ($action == 'create') if (! empty($conf->projet->enabled)) { $formproject=new FormProjets($db); - + $langs->load("project"); print '
'.$langs->trans("ActionOnCompany").''.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")); - if ($act->societe->id && $act->type_code == 'AC_TEL') + print '
'.$langs->trans("ActionOnCompany").''.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); + if ($object->societe->id && $object->type_code == 'AC_TEL') { - if ($act->societe->fetch($act->societe->id)) + if ($object->societe->fetch($object->societe->id)) { - print "
".dol_print_phone($act->societe->phone); + print "
".dol_print_phone($object->societe->phone); } } print '
'.$langs->trans("Contact").''; - if ($act->contact->id > 0) + if ($object->contact->id > 0) { - print $act->contact->getNomUrl(1); - if ($act->contact->id && $act->type_code == 'AC_TEL') + print $object->contact->getNomUrl(1); + if ($object->contact->id && $object->type_code == 'AC_TEL') { - if ($act->contact->fetch($act->contact->id)) + if ($object->contact->fetch($object->contact->id)) { - print "
".dol_print_phone($act->contact->phone_pro); + print "
".dol_print_phone($object->contact->phone_pro); } } } @@ -221,10 +222,10 @@ if ($act->id > 0) if (! empty($conf->projet->enabled)) { print '
'.$langs->trans("Project").''; - if ($act->fk_project) + if ($object->fk_project) { $project=new Project($db); - $project->fetch($act->fk_project); + $project->fetch($object->fk_project); print $project->getNomUrl(1); } print '
'.$langs->trans("Priority").''; - print ($act->priority?$act->priority:''); + print ($object->priority?$object->priority:''); print '
'.$langs->trans("Project").''; @@ -1103,7 +1107,7 @@ else if ($id > 0 || ! empty($ref)) if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); - + } // Confirmation validation @@ -1127,21 +1131,21 @@ else if ($id > 0 || ! empty($ref)) $text=$langs->trans('ConfirmValidateIntervention',$numref); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); - + } // Confirmation de la validation de la fiche d'intervention if ($action == 'modify') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); - + } // Confirmation de la suppression d'une ligne d'intervention if ($action == 'ask_deleteline') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); - + } print ''; @@ -1286,9 +1290,9 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print $extrafields->showInputField($key,$value); - + print ''; print ''; } From fdfb7f1a8aa0fae3ceb75b73b08a5c163cf9914d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 03:24:48 +0100 Subject: [PATCH 11/14] Fix: Be sure there is no duplicate default rib. --- ChangeLog | 3 +- .../class/bonprelevement.class.php | 30 +++++++++---------- htdocs/compta/prelevement/create.php | 2 +- htdocs/langs/fr_FR/withdrawals.lang | 2 +- htdocs/societe/rib.php | 8 ++++- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index afde59ec7f1..8d28705d569 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,8 @@ Fix: Page load not ending when large number of thirdparies. We added option MAIN_DISABLE_AJAX_COMBOX to disable javascript combo feature that is root cause of problem. Fix: [ bug #1231 ] PDF always generated in interventions - +Fix: Be sure there is no duplicate default rib. + ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: - New: Add hidden option BANK_DISABLE_DIRECT_INPUT. diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a4606d669c2..018bbdb9d40 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -683,16 +683,16 @@ class BonPrelevement extends CommonObject $sql = "SELECT count(f.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - if ($banque == 1 || $agence == 1) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr"; + if ($banque || $agence) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr"; $sql.= " WHERE f.fk_statut = 1"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.rowid = pfd.fk_facture"; $sql.= " AND f.paye = 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND f.total_ttc > 0"; - if ($banque == 1 || $agence == 1) $sql.= " AND f.fk_soc = sr.rowid"; - if ($banque == 1) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; - if ($agence == 1) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; + if ($banque || $agence) $sql.= " AND f.fk_soc = sr.rowid"; + if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; + if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; $resql = $this->db->query($sql); @@ -716,8 +716,8 @@ class BonPrelevement extends CommonObject /** * Create a withdraw * - * @param int $banque code of bank - * @param int $agence code of bank office (guichet) + * @param int $banque code of bank (to withdraw a specific bankof a specific customer. By default '') + * @param int $agence code of bank office (guichet) (to withdraw a specific bankof a specific customer. By default '') * @param string $mode real=do action, simu=test only * @return int <0 if KO, nbre of invoice withdrawed if OK */ @@ -755,17 +755,17 @@ class BonPrelevement extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - if ($banque == 1 || $agence ==1) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr"; + if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr"; $sql.= " WHERE f.rowid = pfd.fk_facture"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND s.rowid = f.fk_soc"; - if ($banque == 1 || $agence ==1) $sql.= " AND s.rowid = sr.fk_soc"; + if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc"; $sql.= " AND f.fk_statut = 1"; $sql.= " AND f.paye = 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND f.total_ttc > 0"; - if ($banque == 1) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; - if ($agence == 1) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; + if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; + if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -777,7 +777,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $row = $this->db->fetch_row($resql); - $factures[$i] = $row; + $factures[$i] = $row; // All fields $i++; } $this->db->free($resql); @@ -802,10 +802,10 @@ class BonPrelevement extends CommonObject if (count($factures) > 0) { - foreach ($factures as $fac) + foreach ($factures as $key => $fac) { $fact = new Facture($this->db); - if ($fact->fetch($fac[0]) >= 0) + if ($fact->fetch($fac[0]) >= 0) // Field 0 of $fac is rowid of invoice { if ($soc->fetch($fact->socid) >= 0) { @@ -820,8 +820,8 @@ class BonPrelevement extends CommonObject } else { - dol_syslog("Error on third party bank number RIB/IBAN ".$fact->socid." ".$soc->nom, LOG_ERR); - $facture_errors[$fac[0]]="Error on third party bank number RIB/IBAN ".$fact->socid." ".$soc->nom; + dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->nom, LOG_ERR); + $facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->nom; } } else diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 115902db228..81bb6794736 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -58,9 +58,9 @@ if ($action == 'modify') dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"),'chaine',0,'',$conf->entity); } } - if ($action == 'create') { + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); $result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET); if ($result < 0) diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index 538dafdd397..5cfef386e88 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -32,7 +32,7 @@ LastWithdrawalReceipt=Les %s derniers bons de prélèvements MakeWithdrawRequest=Faire une demande de prélèvement ThirdPartyBankCode=Code banque du tiers ThirdPartyDeskCode=Code guichet du tiers -NoInvoiceCouldBeWithdrawed=Aucune facture percevable, prélevée avec succès. Vérifiez que les factures sont sur des sociétés dont le RIB est correctement renseigné. +NoInvoiceCouldBeWithdrawed=Aucune facture percevable, prélevée avec succès. Vérifiez que les factures sont sur des sociétés dont le compte bancaire par défaut est correctement renseigné. ClassCredited=Classer crédité ClassCreditedConfirm=Êtes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ? TransData=Date de transmission diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 53a148cffc8..0d99b1f8a35 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -60,7 +60,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $account->fetch($id); - $account->socid = $soc->id; + $account->socid = $soc->id; $account->bank = $_POST["bank"]; $account->label = $_POST["label"]; @@ -84,6 +84,12 @@ if ($action == 'update' && ! $_POST["cancel"]) } else { + // If this account is the default bank account, we disable others + if ($account->default_rib) + { + $account->setAsDefault($id); // This will make sure there is only one default rib + } + $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id; header('Location: '.$url); exit; From b94f7a6a6d357231a8aa309b4d0a6e50d69dd661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 03:51:30 +0100 Subject: [PATCH 12/14] Fix some amount were missing local version. --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index b515742a8e1..d1642023c24 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -142,6 +142,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_note_private'=>$object->note, 'object_note'=>$object->note_public, // Payments + 'object_already_payed_locale'=>price($alreadypayed, 0, $outputlangs), + 'object_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs), 'object_already_payed'=>$alreadypayed, 'object_remain_to_pay'=>price2num($object->total_ttc - $sumpayed) ); From 6a84a7f9356894bfc34a07e308eee9e6f030d91e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 13:56:28 +0100 Subject: [PATCH 13/14] Prepare version 3.5.1 --- build/debian/changelog | 7 +++++++ build/doxygen/dolibarr-doxygen.doxyfile | 2 +- build/exe/doliwamp/doliwamp.iss | 4 ++-- build/makepack-dolibarr.pl | 2 +- build/perl/virtualmin/dolibarr.pl | 2 +- build/rpm/dolibarr_fedora.spec | 3 +++ build/rpm/dolibarr_generic.spec | 3 +++ build/rpm/dolibarr_mandriva.spec | 3 +++ build/rpm/dolibarr_opensuse.spec | 3 +++ htdocs/filefunc.inc.php | 2 +- 10 files changed, 25 insertions(+), 6 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index b53a9bb741f..d07e7616ca2 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,3 +1,10 @@ +dolibarr (3.5.1-3) unstable; urgency=low + + [ Laurent Destailleur (eldy) ] + * New upstream release. + + -- Laurent Destailleur (eldy) Fri, 7 Feb 2014 12:00:00 +0100 + dolibarr (3.5.0-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index d7e4a861428..9c94d9db2ae 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 3.5.0 +PROJECT_NUMBER = 3.5.1 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index b492e896aca..0db49fddac7 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -17,9 +17,9 @@ ; ----- Change this ----- AppName=DoliWamp ; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -AppVerName=DoliWamp-3.5.0 +AppVerName=DoliWamp-3.5.1 ; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -OutputBaseFilename=DoliWamp-3.5.0 +OutputBaseFilename=DoliWamp-3.5.1 ; ----- End of change ;OutputManifestFile=build\doliwampbuild.log ; Define full path from which all relative path are defined diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 964b5b58d98..2ed7b860b28 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -18,7 +18,7 @@ use Cwd; $PROJECT="dolibarr"; $MAJOR="3"; $MINOR="5"; -$BUILD="0"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate +$BUILD="1"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate $RPMSUBVERSION="auto"; # auto use value found into BUILD @LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 3ba66bfe22e..a9ef68da0c5 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "3.5.0", "3.4.1", "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" ); +return ( "3.5.1", "3.5.0", "3.4.1", "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" ); } sub script_dolibarr_category diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 4ad2ee57dfd..9dfcdb4aa98 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -330,5 +330,8 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 +- Upstream release + * Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index cd7a6013016..0b37ce61d88 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -558,5 +558,8 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 +- Upstream release + * Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index b7d4c85f17c..923b5924f2d 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -335,5 +335,8 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 +- Upstream release + * Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 14280323b2b..93525e334f0 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -345,5 +345,8 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 +- Upstream release + * Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 - Initial version (#723326) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index f60981e3667..daf4ddbdcfd 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.0'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.1'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From 94be4ec8978cf7aac0a3d175e99b62f93afb8575 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Feb 2014 14:55:27 +0100 Subject: [PATCH 14/14] Fix: Avoid error in migration from 3.1 version. Fix: Suggested migration choice was ko from x.y.z to x.y.z+1 --- htdocs/core/lib/price.lib.php | 4 ++-- htdocs/install/check.php | 24 ++++++++++++++++-------- htdocs/install/upgrade2.php | 8 ++++++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 1d51485185b..d4c0e72820f 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -45,8 +45,8 @@ * @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC * @param int $info_bits Miscellaneous informations on line * @param int $type 0/1=Product/service - * @param string $seller Thirdparty seller (we need $seller->country_code property). Provided only if seller is the supplier. - * @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function) + * @param string $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). * @return result[ 0=total_ht, * 1=total_vat, * 2=total_ttc, diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 097ee22817a..6690f6fc61f 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent @@ -393,24 +393,32 @@ else foreach ($migrationscript as $migarray) { $count++; - $versionfrom=$migarray['from']; + $version=preg_split('/[\.-]/',DOL_VERSION); + $versionfrom=$migarray['from']; $versionto=$migarray['to']; - $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom); - $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto); + $versionarray=preg_split('/[\.-]/',$version); $dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom); $dolibarrversiontoarray=preg_split('/[\.-]/',$versionto); - $version=preg_split('/[\.-]/',DOL_VERSION); + // Define string newversionxxx that are used for text to show + $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom); + $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto); $newversionfrombis=''; - if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis=' '.$langs->trans("or").' '.$versionto; + if (versioncompare($dolibarrversiontoarray,$version) < -2) // From x.y.z -> x.y.z+1 + { + $newversionfrombis=' '.$langs->trans("or").' '.$versionto; + } print ''; print '
'.$langs->trans("Upgrade").'
'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'
'; print $langs->trans("UpgradeDesc"); + if ($ok) { - if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available + if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and last upgrade version is known { // Now we check if this is the first qualified choice - if ($allowupgrade && empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0) + if ($allowupgrade && empty($foundrecommandedchoice) && + (versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$version) < -2) + ) { print '
'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 593ae33ebcc..2bcb244690e 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1459,7 +1459,7 @@ function migrate_price_propal($db,$langs,$conf) } /** - * Mise a jour des totaux lignes de propal + * Update total of contract lines * * @param DoliDB $db Database handler * @param Translate $langs Object langs @@ -1470,6 +1470,10 @@ function migrate_price_contrat($db,$langs,$conf) { $db->begin(); + $tmpmysoc=new Societe($db); + $tmpmysoc->setMysoc($conf); + if (empty($tmpmysoc->country_id)) $tmpmysoc->country_id=0; // Ti not have this set to '' or will make sql syntax error. + print '
'; print '
'; @@ -1506,7 +1510,7 @@ function migrate_price_contrat($db,$langs,$conf) //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis $contratligne->rowid=$rowid; - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2];