From 89dca04720e6d347916977388725783378193cac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Apr 2014 23:06:58 +0200 Subject: [PATCH 1/4] Update doc --- build/debian/README.howto | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index 6adf020dbfd..15eebac6f3c 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -166,8 +166,7 @@ Warning: Date must have format reported by "date -R" Warning: Name and email must match value into debian/control file (Entry added here is used by next step). * We try to build package -> rm -fr ../build-area -> git-buildpackage -us -uc +> rm -fr ../build-area; git-buildpackage -us -uc Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match @@ -230,20 +229,20 @@ from origin/upstream and origin/pristine. * Staying into git root directory, run > git-import-orig -vv ../dolibarr-3.3.4.tgz +and enter version when requested. Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit * Add an entry into debian/changelog -> dch -v x.y.z-1 "My comment" will add entry. -For example: dch -v x.y.z-1 "New upstream release." for a new version +> dch -v x.y.z-w "My comment" will add entry. +For example: dch -v x.y.z-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) Then modify changelog to replace "unstable" with "UNRELEASED". - -Warning: Date must have format reported by "date -R" -Warning: Name and email must match value into debian/control file (Entry added here is used by next step). +Then check/modify also the user/date signature: +- Date must have format reported by "date -R" +- Name and email must match value into debian/control file (Entry added here is used by next step). * We try to build package -> rm -fr ../build-area -> git-buildpackage -us -uc +> rm -fr ../build-area; git-buildpackage -us -uc Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match @@ -272,4 +271,3 @@ http://packages.qa.debian.org * Package will be into release when test will be moved as stable. - From 30dae3def2af68a207b21b8470d02c22b5fd564d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Apr 2014 23:28:26 +0200 Subject: [PATCH 2/4] Doc --- htdocs/core/lib/treeview.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 2e87dfceea8..54093976a68 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -102,6 +102,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) * $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', * '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); * $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); + * TODO Replace with jstree plugin instead of treeview plugin. * * @param array $tab Array of all elements * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) From 13929bc46fecad5cc0d371a7784bb5fe7ee68ecb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Apr 2014 13:19:31 +0200 Subject: [PATCH 3/4] New: showrefnav can be used with tables without prefix. --- htdocs/core/class/commonobject.class.php | 11 ++++++----- htdocs/core/class/html.form.class.php | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8efd364dbf4..ba4094c2a14 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -816,9 +816,10 @@ abstract class CommonObject * * @param string $filter Optional filter * @param int $fieldid Name of field to use for the select MAX and MIN + * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - function load_previous_next_ref($filter,$fieldid) + function load_previous_next_ref($filter,$fieldid,$nodbprefix=0) { global $conf, $user; @@ -834,7 +835,7 @@ abstract class CommonObject if ($this->element == 'societe') $alias = 'te'; $sql = "SELECT MAX(te.".$fieldid.")"; - $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te"; + $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; @@ -847,7 +848,7 @@ abstract class CommonObject $result = $this->db->query($sql); if (! $result) { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } $row = $this->db->fetch_row($result); @@ -855,7 +856,7 @@ abstract class CommonObject $sql = "SELECT MIN(te.".$fieldid.")"; - $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te"; + $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; @@ -869,7 +870,7 @@ abstract class CommonObject $result = $this->db->query($sql); if (! $result) { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -2; } $row = $this->db->fetch_row($result); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f42d85b5871..4d082960d5d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4023,9 +4023,10 @@ class Form * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous * @param string $morehtmlref Code html supplementaire a afficher apres ref * @param string $moreparam More param to add in nav link url. + * @param int $nodbprefix Do not include DB prefix to forge table name * @return tring Portion HTML avec ref + boutons nav */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='') + function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) { global $langs,$conf; @@ -4034,7 +4035,8 @@ class Form if (empty($fieldref)) $fieldref='ref'; //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; - $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid); + $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); + $previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; $next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; From b586b74c79a0ebc9948873f99281c4b71a6fdef0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Apr 2014 17:07:27 +0200 Subject: [PATCH 4/4] Fix: Try/catch --- htdocs/core/class/conf.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 61ba7b062db..729673bc900 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -204,7 +204,16 @@ class Conf // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC. // In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore. //$this->global->MAIN_SERVER_TZ='Europe/Paris'; - if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') date_default_timezone_set($this->global->MAIN_SERVER_TZ); + if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') + { + try { + date_default_timezone_set($this->global->MAIN_SERVER_TZ); + } + catch(Exception $e) + { + dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR); + } + } // Object $mc if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled)) @@ -243,7 +252,7 @@ class Conf if ($conf->global->FACTURE_TVAOPTION != "franchise") $conf->global->FACTURE_TVAOPTION=1; else $conf->global->FACTURE_TVAOPTION=0; } - + // Variable globales LDAP if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME=''; if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME;