From 79023cddb0031afb69b3d4cf621735cd8239d619 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Mar 2015 17:34:50 +0100 Subject: [PATCH 1/4] Fix external calendar for users were not visible if no global calendar was set. --- htdocs/admin/agenda_extsites.php | 2 +- htdocs/comm/action/index.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 6b683c8b52b..b49c82c5b84 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -41,7 +41,7 @@ $actiontest=GETPOST('test','alpha'); $actionsave=GETPOST('save','alpha'); if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; -$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; +$MAXAGENDA=$conf->global->AGENDA_EXT_NB; // List of aviable colors $colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5'); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f41dbc50d3a..6baa03ba87e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2014 Cedric GROSS @@ -39,6 +39,9 @@ if (! empty($conf->projet->enabled)) { if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; +if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; +$MAXAGENDA=$conf->global->AGENDA_EXT_NB; + $filter=GETPOST("filter",'',3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $usergroup = GETPOST("usergroup","int",3); @@ -170,7 +173,7 @@ $listofextcals=array(); if (empty($conf->global->AGENDA_DISABLE_EXT)) { $i=0; - while($i < $conf->global->AGENDA_EXT_NB) + while($i < $MAXAGENDA) { $i++; $source='AGENDA_EXT_SRC'.$i; @@ -188,7 +191,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) if (empty($user->conf->AGENDA_DISABLE_EXT)) { $i=0; - while($i < $conf->global->AGENDA_EXT_NB) + while($i < $MAXAGENDA) { $i++; $source='AGENDA_EXT_SRC_'.$user->id.'_'.$i; From 7050ef6176055ce851d4c98ad1242b8975bec3d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Mar 2015 17:56:37 +0100 Subject: [PATCH 2/4] Fix parameter notolderthan was not effective --- htdocs/public/agenda/agendaexport.php | 29 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 2b1d02ef493..3d5492dd62c 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -22,6 +22,10 @@ * http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=vcal&exportkey=cle * http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=ical&type=event&exportkey=cle * http://127.0.0.1/dolibarr/public/agenda/agendaexport.php?format=rss&exportkey=cle + * Other parameters into url are: + * ¬olderthan=99 + * &year=2015 + * &id=..., &idfrom=..., &idto=... */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); @@ -55,23 +59,26 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; // Security check if (empty($conf->agenda->enabled)) accessforbidden('',1,1,1); +// Not older than +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit + // Define format, type and filter $format='ical'; $type='event'; if (! empty($_GET["format"])) $format=$_GET["format"]; if (! empty($_GET["type"])) $type=$_GET["type"]; + $filters=array(); -if (! empty($_GET["year"])) $filters['year']=$_GET["year"]; -if (! empty($_GET["id"])) $filters['id']=$_GET["id"]; -if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"]; -if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"]; -if (! empty($_GET["project"])) $filters['project']=$_GET["project"]; -if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; -if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; -if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; -// Not older than -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; -$filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; +if (! empty($_GET["year"])) $filters['year']=$_GET["year"]; +if (! empty($_GET["id"])) $filters['id']=$_GET["id"]; +if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"]; +if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"]; +if (! empty($_GET["project"])) $filters['project']=$_GET["project"]; +if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; +if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; +if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; +if (GETPOST("notolderthan")) $filters['notolderthan']=GETPOST("notolderthan","int"); +else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; // Check config if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) From 35733c4c0872af7b579b607f5f725ea1fa0d4ce0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Mar 2015 17:47:17 +0100 Subject: [PATCH 3/4] More comments --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 129510194bb..5ecafde1a03 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3759,8 +3759,8 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) /** * This function is called to encode a string into a HTML string but differs from htmlentities because - * all entities but &,<,> are converted. This permits to encode special chars to entities with no double - * encoding for already encoded HTML strings. + * a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted. + * This permits to encode special chars to entities with no double encoding for already encoded HTML strings. * This function also remove last EOL or BR if $removelasteolbr=1 (default). * For PDF usage, you can show text by 2 ways: * - writeHTMLCell -> param must be encoded into HTML. @@ -3777,7 +3777,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8',$removelasteolbr=1) { $newstring=$stringtoencode; - if (dol_textishtml($stringtoencode)) + if (dol_textishtml($stringtoencode)) // Check if text is already HTML or not { $newstring=preg_replace('//i','
',$newstring); // Replace "
" by "
". It's same and avoid pb with FPDF. if ($removelasteolbr) $newstring=preg_replace('/
$/i','',$newstring); // Remove last
(remove only last one) From fa2e57eaa32698d6d00edf758fab6bf8b6df936f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Mar 2015 01:10:23 +0100 Subject: [PATCH 4/4] pcpcs --- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 4 ++-- htdocs/product/stock/lib/replenishment.lib.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 24414c513e6..2c07baba5a0 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1300,7 +1300,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures , $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); $this->total = $this->total + $obj->somme; $i++; } diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index d9d972cc25c..7a432a1109e 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1095,8 +1095,8 @@ ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task); ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date); ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour); -ALTER TABLE llx_projet_task CHANGE COLUMN duration_effective real DEFAULT 0 NULL; -ALTER TABLE llx_projet_task CHANGE COLUMN planned_workload real DEFAULT 0 NULL; +ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL; +ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL; -- add extrafield on ficheinter lines diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index 1ef993c479d..486e8373255 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -37,7 +37,7 @@ function dolDispatchToDo($order_id) $dispatched = array(); $ordered = array(); - # Count nb of quantity dispatched per product + // Count nb of quantity dispatched per product $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'; $sql.= ' WHERE fk_commande = ' . $order_id; $sql.= ' GROUP BY fk_product'; @@ -49,7 +49,7 @@ function dolDispatchToDo($order_id) $dispatched[$obj->fk_product] = $obj; } - # Count nb of quantity to dispatch per product + // Count nb of quantity to dispatch per product $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet'; $sql.= ' WHERE fk_commande = ' . $order_id; $sql.= ' AND fk_product > 0';