From 87b9d0412cd162ec0601876f978fba59082a36ab Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 22 May 2014 12:51:00 +0200 Subject: [PATCH 01/30] Fix element page on project --- ChangeLog | 1 + htdocs/core/class/html.formprojet.class.php | 1 + htdocs/projet/element.php | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9fbc33607bc..fc959306666 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ Fix: TCPDF error file not found in member card generation. Fix: [ bug #1380 ] Customer invoices are not grouped in company results report. Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice. Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php +Fix: element page on project give wrong href link ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9e0d78118b0..2c371d4afcd 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -194,6 +194,7 @@ class FormProjets if (!empty($this->societe->id)) { $sql.= " AND fk_soc=".$this->societe->id; } + $sql.= ' AND entity='.$conf->entity; $sql.= " ORDER BY ref DESC"; dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index e256fb45baa..6ca2be05271 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -114,7 +114,7 @@ print ''; print ''.$langs->trans("Label").''.$project->title.''; -print ''.$langs->trans("ThirdParty").''; +print ''.$langs->trans("Company").''; if (! empty($project->societe->id)) print $project->societe->getNomUrl(1); else print ' '; print ''; @@ -314,7 +314,7 @@ foreach ($listofreferent as $key => $value) } if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer) { - print ''.$langs->trans("AddCustomerInvoice").''; + print ''.$langs->trans("AddCustomerInvoice").''; } } if ($project->societe->fournisseur) From 3481884731ea1956b83c747d3a78a238287a6f9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 May 2014 13:20:03 +0200 Subject: [PATCH 02/30] Fix: A project is linked to a thirdparty (may be a customer, a supplier or a prospect). --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6ca2be05271..4947af8ba30 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -114,7 +114,7 @@ print ''; print ''.$langs->trans("Label").''.$project->title.''; -print ''.$langs->trans("Company").''; +print ''.$langs->trans("ThirdParty").''; if (! empty($project->societe->id)) print $project->societe->getNomUrl(1); else print ' '; print ''; From 603c28dcdd619b39c85ea0ae95b97fe581c98afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 02:04:02 +0200 Subject: [PATCH 03/30] [ bug #1397 ] Filter by supplier orders with status Draft does not filter --- ChangeLog | 1 + htdocs/fourn/commande/liste.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..ef71bc6c28e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ Fix: [ bug #1381 ] PHP Warning when listing stock transactions page. Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error. Fix: TCPDF error file not found in member card generation. Fix: [ bug #1380 ] Customer invoices are not grouped in company results report. +Fix: [ bug #1397 ] Filter by supplier orders with status Draft does not filter ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index ef6e839dd09..2c5cab19531 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 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 @@ -113,7 +114,8 @@ if ($sall) } if ($socid) $sql.= " AND s.rowid = ".$socid; -if (GETPOST('statut')) +//Required triple check because statut=0 means draft filter +if (GETPOST('statut', 'int') !== '') { $sql .= " AND fk_statut =".GETPOST('statut','int'); } From b2f299f5e450934d838e287f5e63f887631ce7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 02:22:38 +0200 Subject: [PATCH 04/30] Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled --- ChangeLog | 1 + htdocs/expedition/note.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..8f2d5ef5914 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar. New: Added es_CL language Fix: Margin tabs bad data show Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. +Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 252e6f922bf..077d28c0620 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -77,14 +77,14 @@ if ($id > 0 || ! empty($ref)) /* Actions */ /******************************************************************************/ -if ($action == 'setnote_public' && $user->rights->facture->creer) +if ($action == 'setnote_public') { $object->fetch($id); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote_private' && $user->rights->facture->creer) +else if ($action == 'setnote_private') { $object->fetch($id); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); From 77c09d887acf2ffd3bb1cbd182fa69ed8442d573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 02:41:39 +0200 Subject: [PATCH 05/30] Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes --- ChangeLog | 1 + htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..b0a55558eae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar. New: Added es_CL language Fix: Margin tabs bad data show Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. +Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d924da16785..2c2a3ab768c 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -182,6 +182,7 @@ class pdf_rouget extends ModelePdfExpedition if (! empty($object->note_public) || ! empty($object->tracking_number)) { $tab_top = 88; + $tab_top_alt = $tab_top; // Tracking number if (! empty($object->tracking_number)) @@ -196,7 +197,9 @@ class pdf_rouget extends ModelePdfExpedition $label=$outputlangs->trans("LinkToTrackYourPackage")."
"; $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $pdf->SetFont('','B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + + $tab_top_alt += 7; } } } @@ -205,7 +208,7 @@ class pdf_rouget extends ModelePdfExpedition if (! empty($object->note_public)) { $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1); } $nexY = $pdf->GetY(); From 9cc74c36d272391e90bf566779ca3ba22812a822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 02:45:15 +0200 Subject: [PATCH 06/30] Missing copyright info --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 2c2a3ab768c..412f34b84be 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 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 From 0d121de1a631a140817b5ef04cf597d35083d4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 02:48:24 +0200 Subject: [PATCH 07/30] Fix: [ bug #1388 ] Wrong date when invoicing several orders --- ChangeLog | 1 + htdocs/commande/orderstoinvoice.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..9832c1c7bfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar. New: Added es_CL language Fix: Margin tabs bad data show Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. +Fix: [ bug #1388 ] Wrong date when invoicing several orders ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index aa2883ccb96..7b79a16bec1 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -413,7 +413,7 @@ if ($action == 'create' && empty($mesgs)) // Date invoice print ''.$langs->trans('Date').''; - $html->select_date(0,'','','','',"add",1,1); + $html->select_date('','','','','',"add",1,1); print ''; // Payment term print ''.$langs->trans('PaymentConditionsShort').''; From a705d4e3336c5b3b38bd51d30c3f67daaed7f288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 03:00:46 +0200 Subject: [PATCH 08/30] Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line --- ChangeLog | 1 + htdocs/commande/fiche.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..ed85d409840 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar. New: Added es_CL language Fix: Margin tabs bad data show Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. +Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 10856f27c5e..4a00c1a661b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -617,27 +617,27 @@ else if ($action == 'addline' && $user->rights->commande->creer) if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error++; + $error = true; } if (empty($idprod) && GETPOST('type') < 0) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); - $error++; + $error = true; } if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error++; + $error = true; } if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error++; + $error = true; } if (empty($idprod) && empty($product_desc)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); - $error++; + $error = true; } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) From 43bf9ba89026eabd8f113697b897b6aafc0cfd33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 May 2014 04:28:57 +0200 Subject: [PATCH 09/30] Fix: Import of ical files was broken Fix: Can import of ical files from BlueMind. --- htdocs/admin/agenda_extsites.php | 4 +-- htdocs/comm/action/class/ical.class.php | 13 +++++---- htdocs/comm/action/index.php | 36 ++++++++++++++++++++++--- htdocs/core/lib/agenda.lib.php | 13 +++++---- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index b133485f866..1da43046b13 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -63,7 +63,7 @@ if ($actionsave) // Save agendas while ($i <= $MAXAGENDA) { - $name=trim(GETPOST('agenda_ext_name'.$i),'alpha'); + $name=trim(GETPOST('agenda_ext_name'.$i,'alpha')); $src=trim(GETPOST('agenda_ext_src'.$i,'alpha')); $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); if ($color=='-1') $color=''; @@ -76,7 +76,7 @@ if ($actionsave) break; } - //print 'color='.$color; + //print '-name='.$name.'-color='.$color; $res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0,'',$conf->entity); diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 0e279adc03c..ae1abb6ea08 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -56,14 +56,13 @@ class ICal { $this->file = $file; $file_text=''; - + $tmparray=file($file); if (is_array($tmparray)) { $file_text = join("", $tmparray); //load file - $file_text = preg_replace("/[\r\n]{1,} ([:;])/","\\1",$file_text); + $file_text = preg_replace("/[\r\n]{1,} /","",$file_text); } - return $file_text; // return all text } @@ -115,6 +114,7 @@ class ICal { // get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin list($key, $value) = $this->retun_key_value($text); + //var_dump($text.' -> '.$key.' - '.$value); switch ($text) // search special string { @@ -165,6 +165,8 @@ class ICal } } } + + //var_dump($this->cal); return $this->cal; } @@ -236,6 +238,7 @@ class ICal */ function retun_key_value($text) { + /* preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); if (empty($matches)) @@ -246,8 +249,8 @@ class ICal { $matches = array_splice($matches, 1, 2); return $matches; - } - + }*/ + return explode(':',$text,2); } /** diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index fbb9400acff..efe47defd92 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -146,9 +146,11 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0 $source='AGENDA_EXT_SRC'.$i; $name='AGENDA_EXT_NAME'.$i; $color='AGENDA_EXT_COLOR'.$i; + $buggedfile='AGENDA_EXT_BUGGEDFILE'.$i; if (! empty($conf->global->$source) && ! empty($conf->global->$name)) { - $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color); + // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' + $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0)); } } } @@ -527,9 +529,11 @@ if (count($listofextcals)) $url=$extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics $namecal = $extcal['name']; $colorcal = $extcal['color']; - //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal; + $buggedfile = $extcal['buggedfile']; + //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile; $ical=new ICal(); $ical->parse($url); + // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ... //var_dump($ical->cal); exit; $icalevents=array(); @@ -643,6 +647,8 @@ if (count($listofextcals)) // Loop on each entry into cal file to know if entry is qualified and add an ActionComm into $eventarray foreach($icalevents as $icalevent) { + //var_dump($icalevent); + //print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'
';exit; if (! empty($icalevent['RRULE'])) continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule. @@ -659,12 +665,36 @@ if (count($listofextcals)) $event->fulldayevent=true; $addevent=true; } - elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array) + elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) { $datestart=$icalevent['DTSTART']; $dateend=$icalevent['DTEND']; $addevent=true; } + elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) + { + $datestart=$icalevent['DTSTART']['unixtime']; + $dateend=$icalevent['DTEND']['unixtime']; + // $buggedfile is set to uselocalandtznodaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtznodaylight' + if ($buggedfile === 'uselocalandtznodaylight') // unixtime is a local date that does not take daylight into account, TZID is +1 for example for 'Europe/Paris' in summer instead of 2 + { + // TODO + } + // $buggedfile is set to uselocalandtzdaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtzdaylight' (for example with bluemind) + if ($buggedfile === 'uselocalandtzdaylight') // unixtime is a local date that does take daylight into account, TZID is +2 for example for 'Europe/Paris' in summer + { + $localtzs = new DateTimeZone(preg_replace('/"/','',$icalevent['DTSTART']['TZID'])); + $localtze = new DateTimeZone(preg_replace('/"/','',$icalevent['DTEND']['TZID'])); + $localdts = new DateTime(dol_print_date($datestart,'dayrfc','gmt'), $localtzs); + $localdte = new DateTime(dol_print_date($dateend,'dayrfc','gmt'), $localtze); + $tmps=-1*$localtzs->getOffset($localdts); + $tmpe=-1*$localtze->getOffset($localdte); + $datestart+=$tmps; + $dateend+=$tmpe; + //var_dump($datestart); + } + $addevent=true; + } if ($addevent) { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index e66d24e576e..f6c84bdeb4a 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -39,7 +39,7 @@ * @param string $filterd Filter of done by user * @param int $pid Product id * @param int $socid Third party id - * @param array $showextcals Array with list of external calendars, or -1 to show no legend + * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend * @param string $actioncode Preselected value of actioncode for filter on type * @return void */ @@ -136,7 +136,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '});' . "\n"; print '' . "\n"; print ''; - if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) + if (! empty($conf->use_javascript_ajax)) { if (count($showextcals) > 0) { @@ -147,7 +147,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; From f34aadef3df57794de74006bc2c2c9fc4da6be12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 May 2014 21:06:53 +0200 Subject: [PATCH 15/30] Fix: css --- htdocs/comm/propal.php | 2 +- htdocs/theme/eldy/style.css.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 33365889d48..5463bf7a69d 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1368,7 +1368,7 @@ if ($action == 'create') // Date print ''; // Validaty duration diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index d6d5199b3c6..fd2c8a17252 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2269,6 +2269,8 @@ li.cal_event { border: none; list-style-type: none; } /* Ajax - Liste deroulante de l'autocompletion */ /* ============================================================================== */ +.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff; } + .ui-autocomplete-loading { background: white url() right center no-repeat; } .ui-autocomplete { position:absolute; @@ -2482,7 +2484,7 @@ A.none, A.none:active, A.none:visited, A.none:hover { { line-height: 1em !important; } -.ui-autocomplete-input { margin: 0; padding: 1px; } +.ui-autocomplete-input { margin: 0; padding: 2px; } /* ============================================================================== */ From 1df758320de0fc201f358d3ab955be820f10ddd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 12:55:39 +0200 Subject: [PATCH 16/30] Fix: the delivery date must not be set with date of proposal. --- htdocs/comm/propal.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5463bf7a69d..513e7cb5032 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1407,8 +1407,7 @@ if ($action == 'create') } else { - $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; - $form->select_date($datepropal,'liv_','','','',"addprop"); + $form->select_date(-1,'liv_','','','',"addprop",1,1); } print ''; From b11ef37c5882f3c9713f47a6f7dd3efe1c9a85b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 12:59:44 +0200 Subject: [PATCH 17/30] Fix: Bad balance of table --- htdocs/comm/propal.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 513e7cb5032..f57778a42a4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1461,7 +1461,7 @@ if ($action == 'create') print ''; } - print '
'; print '' . "\n"; print ' ' . $val ['name']; @@ -434,9 +437,9 @@ function actions_prepare_head($object) $head[$h][1] = $langs->trans('Info'); $head[$h][2] = 'info'; $h++; - + complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); - + complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); return $head; From 7acecadc797e5c22caccb263da384afa1fd9ad82 Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Fri, 23 May 2014 11:37:57 +0200 Subject: [PATCH 10/30] avoid warning in commande.class.php if extrafields is used avoid warning in commande.class.php if extrafields is used --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 146d9e777c2..b96ea931f21 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1362,7 +1362,7 @@ class Commande extends CommonOrder $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); - $this->db->free(); + $this->db->free($result); /* * Lines From fa733c8ba4f7d58e2461101e6a4178bc1acef18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 23 May 2014 11:42:14 +0200 Subject: [PATCH 11/30] Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande --- ChangeLog | 1 + htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3bb088b99f3..e339b627184 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ Fix: [ bug #1381 ] PHP Warning when listing stock transactions page. Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error. Fix: TCPDF error file not found in member card generation. Fix: [ bug #1380 ] Customer invoices are not grouped in company results report. +Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d924da16785..c8ade6dbb94 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -179,7 +179,7 @@ class pdf_rouget extends ModelePdfExpedition $tab_height = 130; $tab_height_newpage = 150; - if (! empty($object->note_public) || ! empty($object->tracking_number)) + if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id))) { $tab_top = 88; From 300e430024a83069f0bbd45030f0de89688b95de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 May 2014 16:13:00 +0200 Subject: [PATCH 12/30] Fix: If user already exists but permissions not set, it was not possible to install Dolibarr. --- htdocs/core/db/mysql.class.php | 12 ++++++++++-- htdocs/core/db/mysqli.class.php | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 227a70a020f..50ef7ac4151 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -1079,8 +1079,16 @@ class DoliDBMysql extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); - return -1; + if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') + { + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); + return -1; + } + else + { + // If user already exists, we continue to set permissions + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + } } $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index c2400a43b7e..96b85633e7a 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1073,8 +1073,16 @@ class DoliDBMysqli extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); - return -1; + if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') + { + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); + return -1; + } + else + { + // If user already exists, we continue to set permissions + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + } } $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log From 20ec1e6ac8c8b51bc133288e704efba7c8eaedff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 May 2014 19:55:40 +0200 Subject: [PATCH 13/30] Fix: Suppliers invoices must be visible if module supplier is on. --- htdocs/core/menus/standard/eldy.lib.php | 15 ++++++--------- htdocs/fourn/facture/impayees.php | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3f059d7dc76..2b84f51cb0d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -758,16 +758,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Suppliers if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { - if (! empty($conf->facture->enabled)) - { - $langs->load("bills"); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); - $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); - $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); + $langs->load("bills"); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); + $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); + $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); - $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire); - } + $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire); } // Orders diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 1d81ae01230..d6a24b01ec6 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -if (! $user->rights->facture->lire) accessforbidden(); +if (! $user->rights->fournisseur->facture->lire) accessforbidden(); $langs->load("companies"); $langs->load("bills"); From 23e951ff2a37bc5b8f004777d744ad4ae7abbde2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 May 2014 20:54:23 +0200 Subject: [PATCH 14/30] Fix: select_date accepts -1 or '' but not 0 --- htdocs/comm/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 361ccf13c22..33365889d48 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1407,7 +1407,7 @@ if ($action == 'create') } else { - $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $form->select_date($datepropal,'liv_','','','',"addprop"); } print '
'.$langs->trans('Date').''; - $form->select_date('','','','','',"addprop"); + $form->select_date('','','','','',"addprop",1,1); print '
'; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
'; if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { // For backward compatibility @@ -1532,14 +1532,11 @@ if ($action == 'create') print ''; print ''; } - print "
%
"; - } print ''; } - print ''; - print '
'; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
'; $langs->load("bills"); print '
'; From 2a6b2a454075b31f43e356a8af4f3795070d12ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 14:00:58 +0200 Subject: [PATCH 18/30] Fix: Stat page show no cache when there is, if user was using apc. --- htdocs/admin/system/perf.php | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index ce74d128a7a..124fc7d35bd 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -85,18 +85,35 @@ print '
'; // OPCode cache print '
'; print ''.$langs->trans("OPCodeCache").': '; -$test1=function_exists('xcache_info'); -if ($test1) +$foundcache=0; +$test=function_exists('xcache_info'); +if (! $foundcache && $test) { + $foundcache++; print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled"); print ' '.$langs->trans("MoreInformation").' Xcache admin page'; } -else +$test=function_exists('eaccelerator_info'); +if (! $foundcache && $test) { - $test2=function_exists('eaccelerator_info'); - if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled"); - else print $langs->trans("NoOPCodeCacheFound"); + $foundcache++; + print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled"); } +$test=function_exists('apc_cache_info'); +if (! $foundcache && $test) +{ + //var_dump(apc_cache_info()); + if (ini_get('apc.enabled')) + { + $foundcache++; + print img_picto('','tick.png').' '.$langs->trans("APCInstalled"); + } + else + { + print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled"); + } +} +if (! $foundcache) print $langs->trans("NoOPCodeCacheFound"); print '
'; // HTTPCacheStaticResources From 872e764c94ab5970eee8c89efdf4cf46d30792a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 14:57:41 +0200 Subject: [PATCH 19/30] Fix: html detection was not working with hx tags. --- htdocs/core/lib/functions.lib.php | 3 ++- test/phpunit/FunctionsLibTest.php | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e37045ef88b..db5de85015d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3673,6 +3673,7 @@ function dol_textishtml($msg,$option=0) elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; + elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) return false; @@ -4532,4 +4533,4 @@ function natural_search($fields, $value) return " AND " . ($end > 1? '(' : '') . $res; } -?> +?> \ No newline at end of file diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index b8414dd170e..342a7074ce9 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $input='xxx
'; $after=dol_textishtml($input); $this->assertTrue($after); + $input='

abc

'; + $after=dol_textishtml($input); + $this->assertTrue($after); // False $input='xxx < br>'; @@ -528,16 +531,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase public function testVerifCond() { $verifcond=verifCond('1==1'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test a true comparison'); $verifcond=verifCond('1==2'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test a false comparison'); $verifcond=verifCond('$conf->facture->enabled'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test that conf property of a module report true when enabled'); $verifcond=verifCond('$conf->moduledummy->enabled'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test that conf property of a module report false when disabled'); $verifcond=verifCond(''); $this->assertTrue($verifcond); From a51e18a5a7577d517c49a71fac8ccdf3f6fc18f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 15:20:26 +0200 Subject: [PATCH 20/30] Fix: $error var must use type int and be increased when error found. Using $error as boolean at some place was source of error. --- htdocs/commande/fiche.php | 12 ++++---- htdocs/holiday/admin/holiday.php | 50 +++++++++++++++++-------------- htdocs/holiday/define_holiday.php | 15 ++++++---- 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 4a00c1a661b..43fe619bd1a 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -568,7 +568,7 @@ else if ($action == 'setnote_private' && $user->rights->commande->creer) else if ($action == 'addline' && $user->rights->commande->creer) { $langs->load('errors'); - $error = false; + $error = 0; // Set if we used free entry or predefined product if (GETPOST('addline_libre') @@ -617,27 +617,27 @@ else if ($action == 'addline' && $user->rights->commande->creer) if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && GETPOST('type') < 0) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); - $error = true; + $error++; } if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error = true; + $error++; } if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && empty($product_desc)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); - $error = true; + $error++; } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php index 174adbdf725..2b265711fa1 100644 --- a/htdocs/holiday/admin/holiday.php +++ b/htdocs/holiday/admin/holiday.php @@ -60,18 +60,18 @@ $cp = new Holiday($db); if ($action == "add") { $message = ''; - $error = false; + $error = 0; // Option du groupe de validation /*if (!$cp->updateConfCP('userGroup',$_POST['userGroup'])) { - $error = true; + $error++; }*/ // Option du délai pour faire une demande de congés payés if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest'])) { - $error = true; + $error++; } // Option du nombre de jours à ajouter chaque mois @@ -79,67 +79,69 @@ if ($action == "add") if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth)) { - $error = true; + $error++; } // Option du nombre de jours pour un mariage $OptMariageCP = price2num($_POST['OptMariage'],5); if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un décés d'un proche $OptDecesProcheCP = price2num($_POST['OptDecesProche'],5); if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un mariage d'un enfant $OptMariageProcheCP = price2num($_POST['OptMariageProche'],5); if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) { - $error = true; + $error++; } // Option du nombre de jours pour un décés d'un parent $OptDecesParentsCP = price2num($_POST['OptDecesParents'],5); if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) { - $error = true; + $error++; } // Option pour avertir le valideur si délai de demande incorrect if(isset($_POST['AlertValidatorDelay'])) { if(!$cp->updateConfCP('AlertValidatorDelay','1')) { - $error = true; + $error++; } } else { if(!$cp->updateConfCP('AlertValidatorDelay','0')) { - $error = true; + $error++; } } // Option pour avertir le valideur si solde des congés de l'utilisateur inccorect if(isset($_POST['AlertValidatorSolde'])) { if(!$cp->updateConfCP('AlertValidatorSolde','1')) { - $error = true; + $error++; } } else { if(!$cp->updateConfCP('AlertValidatorSolde','0')) { - $error = true; + $error++; } } // Option du nombre de jours à déduire pour 1 jour de congés $nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2); - if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) { - $error = true; + if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) + { + $error++; } - if ($error) { + if ($error) + { $message = '
'.$langs->trans('ErrorUpdateConfCP').'
'; } else { $message = '
'.$langs->trans('UpdateConfCPOK').'
'; @@ -151,8 +153,8 @@ if ($action == "add") $result = $db->query($sql); $num = $db->num_rows($sql); - - if($num < 1) { + if($num < 1) + { $cp->createCPusers(); $message.= '
'.$langs->trans('AddCPforUsers').'
'; } @@ -202,7 +204,7 @@ elseif ($action == 'create_event') } elseif($action == 'event' && isset($_POST['update_event'])) { - $error = false; + $error = 0; $eventId = array_keys($_POST['update_event']); $eventId = $eventId[0]; @@ -213,19 +215,21 @@ elseif($action == 'event' && isset($_POST['update_event'])) $eventValue = $optValue; $eventValue = $eventValue[$eventId]; - if(!empty($eventName)) { + if (!empty($eventName)) + { $eventName = trim($eventName); } else { - $error = true; + $error++; } - if(!empty($eventValue)) { + if (!empty($eventValue)) + { $eventValue = price2num($eventValue,2); } else { - $error = true; + $error++; } - if(!$error) + if (!$error) { // Mise à jour des congés de l'utilisateur $update = $cp->updateEventCP($eventId,$eventName,$eventValue); diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 1cf37e77d6f..f167422f503 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -82,7 +82,7 @@ if ($action == 'update' && isset($_POST['update_cp'])) $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. dol_syslog('define_holiday update lastUpdate entry sql='.$sql); - $result = $db->query($sql); + $result = $db->query($sql); $mesg='
'.$langs->trans('UpdateConfCPOK').'
'; @@ -91,21 +91,24 @@ if ($action == 'update' && isset($_POST['update_cp'])) } elseif($action == 'add_event') { - $error = false; + $error = 0; if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) { $event = $_POST['list_event']; - } else { $error = true; + } else { $error++; } if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) { $userCP = $_POST['userCP']; - } else { $error = true; + } else { $erro++; } - if($error) { + if ($error) + { $message = '
'.$langs->trans('ErrorAddEventToUserCP').'
'; - } else { + } + else + { $nb_holiday = $holiday->getCPforUser($userCP); $add_holiday = $holiday->getValueEventCp($event); $new_holiday = $nb_holiday + $add_holiday; From 9bc1a6b4f56e34724cb62f9b7c1fd6bcbb072d19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 May 2014 18:29:22 +0200 Subject: [PATCH 21/30] Fix: favicon must use dol_buildpath and not hardcoded path Conflicts: htdocs/core/lib/security2.lib.php --- htdocs/core/lib/security2.lib.php | 3 ++- htdocs/main.inc.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index a33c1b5d443..a95d7a52356 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -286,7 +286,8 @@ function dol_loginfunction($langs,$conf,$mysoc) // Set jquery theme $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); - $favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico'; + $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); + if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; $jquerytheme = 'smoothness'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 98adfca23e0..12dbfee552d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -959,6 +959,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; // Evite indexation par robots print ''."\n"; $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); + if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; From ae01c785c5dac1120dbe4b262d9f9468680ce7da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2014 03:57:13 +0200 Subject: [PATCH 22/30] Fix: Do not show ref supplier title if ref_supplier not set (currently always the case with 3.5). --- htdocs/core/lib/pdf.lib.php | 8 +++---- .../fourn/class/fournisseur.facture.class.php | 22 +++++++++---------- .../fourn/class/fournisseur.product.class.php | 9 ++++++-- htdocs/fourn/facture/fiche.php | 3 ++- htdocs/product/class/product.class.php | 14 +++++++----- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 13047234834..d8723334328 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -128,7 +128,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') // Protection and encryption of pdf if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION)) - { + { /* Permission supported by TCPDF - print : Print the document; - modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble'; @@ -957,7 +957,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; - + //Manage HTML entities description test //Cause $prodser->description is store with htmlentities but $desc no $needdesctranslation=false; @@ -1032,10 +1032,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (empty($hideref)) { - if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref + if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref else $ref_prodserv = $prodser->ref; // Show local ref only - $ref_prodserv .= " - "; + if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; } $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d8f15c5b9b3..d8a1a1d824e 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -420,7 +420,7 @@ class FactureFournisseur extends CommonInvoice */ function fetch_lines() { - $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; + $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; @@ -428,7 +428,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE fk_facture_fourn='.$this->id; - dol_syslog("FactureFournisseur::fetch_lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG); $resql_rows = $this->db->query($sql); if ($resql_rows) { @@ -443,10 +443,10 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i] = new stdClass(); $this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->description = $obj->description; - $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated $this->lines[$i]->product_ref = $obj->product_ref; // Internal reference - //$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit - $this->lines[$i]->libelle = $obj->label; // Label du produit + $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated. Replace with next line + //$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref into ref_supplier into table llx_facture_fourn_det and update it into updateline + $this->lines[$i]->libelle = $obj->label; // deprecated $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit $this->lines[$i]->pu_ht = $obj->pu_ht; $this->lines[$i]->pu_ttc = $obj->pu_ttc; @@ -474,7 +474,7 @@ class FactureFournisseur extends CommonInvoice else { $this->error=$this->db->error(); - dol_syslog('FactureFournisseur::fetch_lines: Error '.$this->error,LOG_ERR); + dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR); return -3; } } @@ -1127,7 +1127,7 @@ class FactureFournisseur extends CommonInvoice * Update a line detail into database * * @param int $id Id of line invoice - * @param string $label Description of line + * @param string $desc Description of line * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $vatrate VAT Rate * @param double $txlocaltax1 LocalTax1 Rate @@ -1141,9 +1141,9 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) + function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) { - dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); + dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; $pu = price2num($pu); @@ -1169,7 +1169,7 @@ class FactureFournisseur extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty); - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1192,7 +1192,7 @@ class FactureFournisseur extends CommonInvoice } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql.= " description ='".$this->db->escape($label)."'"; + $sql.= " description ='".$this->db->escape($desc)."'"; $sql.= ", pu_ht = ".price2num($pu_ht); $sql.= ", pu_ttc = ".price2num($pu_ttc); $sql.= ", qty = ".price2num($qty); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 10bbd8b270b..5efef7b7c35 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -40,8 +40,13 @@ class ProductFournisseur extends Product var $product_fourn_price_id; // id of ligne product-supplier var $id; // product id - var $fourn_ref; // ref supplier - var $fourn_qty; // quantity for price + var $fourn_ref; // deprecated + var $ref_supplier; // ref supplier (can be set by get_buyprice) + var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) + + var $fourn_qty; // quantity for price (can be set by get_buyprice) + var $fourn_pu; // unit price for quantity (can be set by get_buyprice) + var $fourn_price; // price for quantity var $fourn_remise_percent; // discount for quantity (percent) var $fourn_remise; // discount for quantity (amount) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 566ae26f640..0f15ff42885 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -542,7 +542,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) } if (GETPOST('addline_predefined') || (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0) // we push enter onto qty field - ) + ) { $predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); $idprod=GETPOST('idprod', 'int'); @@ -593,6 +593,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $type = $productsupplier->type; + // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == 0) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 308ca339303..934706a1c95 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -902,14 +902,14 @@ class Product extends CommonObject /** - * Lit le prix pratique par un fournisseur - * On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref + * Read price used by a provider + * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price * @param double $qty Quantity asked * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier ref - * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve + * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0) { @@ -940,7 +940,7 @@ class Product extends CommonObject { // We do same select again but searching with qty, ref and id product $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; - $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx"; + $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'"; $sql.= " AND pfp.fk_product = ".$product_id; @@ -955,9 +955,11 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj && $obj->quantity > 0) // If found { - $this->buyprice = $obj->price; // \deprecated + $this->buyprice = $obj->price; // deprecated + $this->fourn_qty = $obj->quantity; // min quantity for price $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id - $this->ref_fourn = $obj->ref_fourn; // Ref supplier + $this->ref_fourn = $obj->ref_supplier; // deprecated + $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; return $result; From 44ecd504bc718d6aa716c4b3fdc983517afce252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2014 04:12:08 +0200 Subject: [PATCH 23/30] Fix: Field ref_supplier and label not filled. Just add FIXME because fix is too heavy for a maintenance release. --- htdocs/fourn/class/fournisseur.facture.class.php | 10 ++++++---- htdocs/fourn/facture/fiche.php | 13 ++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d8a1a1d824e..63cf162e7e2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -444,10 +444,10 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->description = $obj->description; $this->lines[$i]->product_ref = $obj->product_ref; // Internal reference - $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated. Replace with next line - //$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref into ref_supplier into table llx_facture_fourn_det and update it into updateline - $this->lines[$i]->libelle = $obj->label; // deprecated - $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit + $this->lines[$i]->ref = $obj->product_ref; // deprecated. + $this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline + $this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order) + $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit $this->lines[$i]->pu_ht = $obj->pu_ht; $this->lines[$i]->pu_ttc = $obj->pu_ttc; $this->lines[$i]->tva_tx = $obj->tva_tx; @@ -1034,6 +1034,8 @@ class FactureFournisseur extends CommonInvoice * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue). * + * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. + * * @param string $desc Description de la ligne * @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note) * @param double $txtva Taux de tva force, sinon -1 diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 0f15ff42885..402be19f17a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -373,6 +373,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( $desc, $lines[$i]->subprice, @@ -632,19 +633,17 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) { $ht = price2num($_POST['amount']); $price_base_type = 'HT'; - - //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else - { + { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tauxtva,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } - } + //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 + // FIXME Must add $productsupplier->ref_supplier and $productsupplier->label if there were loaded by get_buyprice previously. + $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + } } //print "xx".$tva_tx; exit; From 4076a4a64303f6cce9c511e62a060de37e7454ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2014 14:51:56 +0200 Subject: [PATCH 24/30] Fix: select_date accepts -1, '' or a date but not '0' --- htdocs/commande/fiche.php | 6 +++--- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/facture.php | 4 ++-- htdocs/compta/paiement.php | 2 +- htdocs/fourn/facture/fiche.php | 6 +++--- htdocs/fourn/facture/paiement.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 43fe619bd1a..c1a6d38a58a 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1548,7 +1548,7 @@ if ($action == 'create' && $user->rights->commande->creer) $demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:''); @@ -1567,7 +1567,7 @@ if ($action == 'create' && $user->rights->commande->creer) $demand_reason_id = $soc->demand_reason_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $projectid = 0; } $absolute_discount=$soc->getAvailableDiscounts(); @@ -1643,7 +1643,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (empty($datedelivery)) { if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; } $form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1); print ""; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 7b79a16bec1..5ea4e5b72cb 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -373,7 +373,7 @@ if ($action == 'create' && empty($mesgs)) $remise_percent = $soc->remise_percent; } $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $absolute_discount=$soc->getAvailableDiscounts(); print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 29f4e61c7c7..d685f9ad1ed 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2082,7 +2082,7 @@ if ($action == 'create') $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; //Replicate extrafields $objectsrc->fetch_optionals($originid); @@ -2095,7 +2095,7 @@ if ($action == 'create') $mode_reglement_id = $soc->mode_reglement_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; } $absolute_discount=$soc->getAvailableDiscounts(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 3b9d257314e..7a149ed80fd 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -397,7 +397,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date payment print ''.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment); + $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment); $form->select_date($datepayment,'','','',0,"add_paiement",1,1); print ''; print ''.$langs->trans('Comments').''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 402be19f17a..966ab630ade 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1122,10 +1122,10 @@ if ($action == 'create') $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } @@ -1135,7 +1135,7 @@ if ($action == 'create') $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 352c3150c52..6f8c3bc1920 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -191,7 +191,7 @@ if ($action == 'create' || $action == 'add_paiement') $object->fetch($facid); $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture); + $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); $sql = 'SELECT s.nom, s.rowid as socid,'; $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total'; From 5d9ec6807c453ec99cb7bf8eb1fe68f349edc58a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 May 2014 01:14:15 +0200 Subject: [PATCH 25/30] Fix: Show duration only if defined. --- htdocs/product/liste.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 501e0c60794..923b19e3daa 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -437,11 +437,15 @@ else if (! empty($conf->service->enabled) && $type != 0) { print ''; - if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - else print $objp->duration; + if (preg_match('/([0-9]+)[a-z]/i',$objp->duration)) + { + if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + //elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); + else print $objp->duration; + } print ''; } From d41f87acabd4eb227a3e65642ef6e7b1d6db167f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 May 2014 01:27:22 +0200 Subject: [PATCH 26/30] Fix: Option to limit was not used everywhere. --- htdocs/projet/tasks/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index cf4d996487b..5483c41e411 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -119,7 +119,7 @@ print ''; print ''; print "\n"; -if (count($tasksarray) > 1000) +if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { print ''; print ''; From 1199d54fb215f0cc4ac5edc038cc20f88e2dafb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 May 2014 17:21:48 +0200 Subject: [PATCH 27/30] Fix: When user has no permissions to see all other user, we must keep only user. --- htdocs/core/class/html.formother.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 7f30f7c9c96..eced2a75729 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -363,7 +363,7 @@ class FormOther $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; - if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0); + if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; // Add existing sales representatives of thirdparty of external user if (empty($user->rights->user->user->lire) && $user->societe_id) { From 51b6be4a64ad3d5a7123e9f610e7f71b22934604 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 May 2014 17:33:19 +0200 Subject: [PATCH 28/30] Fix: If user has no perm to see other user, see himself. --- htdocs/core/class/html.formother.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index eced2a75729..5150f2d4e41 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -363,7 +363,8 @@ class FormOther $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; - if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; + if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; + if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id; // Add existing sales representatives of thirdparty of external user if (empty($user->rights->user->user->lire) && $user->societe_id) { From 33ef8595dcaf61e232b5c38cab10d693a56fa85e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 May 2014 10:19:34 +0200 Subject: [PATCH 29/30] Fix: Bad alignement --- htdocs/comm/propal/list.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index df24b195b7f..d45718b5daf 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -285,7 +285,7 @@ if ($result) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -301,6 +301,7 @@ if ($result) print ''; print ''; print ''; + // Date print ''; print $langs->trans('Month').': '; print ' '.$langs->trans('Year').': '; @@ -308,11 +309,12 @@ if ($result) $formother->select_year($syear,'year',1, 20, 5); print ''; print ' '; + // Amount print ''; print ''; print ''; - - print ''; + // Author + print ''; print ''; print ''; print ''; From 48bbcc6f4af5b8d3ff341a7752df99fafbd56798 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 May 2014 10:45:58 +0200 Subject: [PATCH 30/30] Fix: Button was not be enabled. --- htdocs/admin/agenda_extsites.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 1da43046b13..ac105cf3fba 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); $langs->load("agenda"); $langs->load("admin"); @@ -218,8 +217,7 @@ print ''; print '
'; print '
'; - -print "trans("Save")."\">"; +print "trans("Save")."\">"; print "
"; print "\n";