From e038e1a2f5825d02343565336017d89a64614b7c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 12 Sep 2017 09:27:59 +0200 Subject: [PATCH 1/8] Fix: missing select2 combobox --- htdocs/core/class/html.form.class.php | 57 +++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c8ea494ad3a..a296fc9079a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4296,7 +4296,7 @@ class Form */ function select_currency($selected='',$htmlname='currency_id') { - print $this->selectcurrency($selected,$htmlname); + print $this->selectCurrency($selected,$htmlname); } /** @@ -4306,35 +4306,40 @@ class Form * @param string $htmlname name of HTML select list * @return string */ - function selectCurrency($selected='',$htmlname='currency_id') - { - global $conf,$langs,$user; + function selectCurrency($selected='',$htmlname='currency_id') + { + global $conf,$langs,$user; - $langs->loadCacheCurrencies(''); + $langs->loadCacheCurrencies(''); - $out=''; + $out=''; - if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite + if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite - $out.= ''; - if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); - return $out; - } + $out.= ''; + if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + + return $out; + } /** * Return array of currencies in user language From cd888a2149e6fad8982d97ed11cc1b1256a1b1d9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 12 Sep 2017 15:13:12 +0200 Subject: [PATCH 2/8] Fix: hide bank account field if module disabled --- htdocs/comm/card.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index dfdc9183886..2da33334a92 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -330,25 +330,27 @@ if ($id > 0) print ""; print ''; - // Compte bancaire par défaut - print ''; - print ''; - print '
'; - print $langs->trans('PaymentBankAccount'); - print ''; - if (($action != 'editbankaccount') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; - print ''; - if ($action == 'editbankaccount') + if (! empty($conf->banque->enabled)) { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1); + // Compte bancaire par défaut + print ''; + print ''; + print '
'; + print $langs->trans('PaymentBankAccount'); + print ''; + if (($action != 'editbankaccount') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1); + } + else + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none'); + } + print ""; + print ''; } - else - { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none'); - } - print ""; - print ''; - // Relative discounts (Discounts-Drawbacks-Rebates) print ''; From f0e0df2660b771d0106694524317df48708e6ca6 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Tue, 12 Sep 2017 16:29:06 +0200 Subject: [PATCH 3/8] add translation publisher translation for modulehelp.php --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2c2fe276146..f932ec05959 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - admin Foundation=Foundation Version=Version +Publisher=Publisher VersionProgram=Version program VersionLastInstall=Initial install version VersionLastUpgrade=Latest version upgrade From 30eb03af4ccff3e6ca673fa76c7c3e3c032d291a Mon Sep 17 00:00:00 2001 From: atm-ph Date: Tue, 12 Sep 2017 16:36:14 +0200 Subject: [PATCH 4/8] Fix get_class(self) instead of get_class($this) --- htdocs/core/class/commonobject.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b32aa8cca05..3f4ca3e5d05 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5023,7 +5023,7 @@ abstract class CommonObject if (!$notrigger) { // Call triggers - $result=$this->call_trigger(strtoupper(get_class(self)).'_CREATE',$user); + $result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user); if ($result < 0) { $error++; } // End call triggers } @@ -5185,7 +5185,7 @@ abstract class CommonObject if (! $error && ! $notrigger) { // Call triggers - $result=$this->call_trigger(strtoupper(get_class(self)).'_MODIFY',$user); + $result=$this->call_trigger(strtoupper(get_class($this)).'_MODIFY',$user); if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail // End call triggers } @@ -5216,7 +5216,7 @@ abstract class CommonObject if (! $error) { if (! $notrigger) { // Call triggers - $result=$this->call_trigger(strtoupper(get_class(self)).'_DELETE', $user); + $result=$this->call_trigger(strtoupper(get_class($this)).'_DELETE', $user); if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail // End call triggers } From ed8e08b78ad34a1686e87c4c433546bbee916985 Mon Sep 17 00:00:00 2001 From: arnaud Date: Mon, 11 Sep 2017 16:56:50 +0200 Subject: [PATCH 5/8] FIX time.php crashed without project id in param --- htdocs/projet/tasks/time.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 595617110c7..79fc8aeafcb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -442,7 +442,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -450,10 +450,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party - $morehtmlref.=$langs->trans("ThirdParty").': '; - $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); + $morehtmlref.=$langs->trans("ThirdParty").': '; + if (!empty($projectstatic->thirdparty)) { + $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); + } $morehtmlref.=''; } From 24436b550d4da62910602bbab23f44f394de5f56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 12:01:32 +0200 Subject: [PATCH 6/8] Update time.php --- htdocs/projet/tasks/time.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 79fc8aeafcb..4f27ce5af5f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -453,7 +453,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; - if (!empty($projectstatic->thirdparty)) { + if (is_object($projectstatic->thirdparty)) { $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); } $morehtmlref.=''; @@ -464,7 +464,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print '
'; + print '
'; print ''; // Date start - Date end From 93defa5f595062dea438feb780c595eccc1bc919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20BERTHELOT?= Date: Mon, 11 Sep 2017 18:01:24 +0200 Subject: [PATCH 7/8] Fix dates in commande and remisecheque for PostgreSQL (should be treated like strings) --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 235e3a1aa75..9ed198eefa3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2234,7 +2234,7 @@ class Commande extends CommonOrder $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); + $sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 20afa14e0ca..03dffbabf34 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -861,8 +861,8 @@ class RemiseCheque extends CommonObject if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null'); - $sql.= " WHERE rowid = ".$this->id; + $sql.= " SET date_bordereau = '".($date ? $this->db->idate($date) : 'null'); + $sql.= "' WHERE rowid = ".$this->id; dol_syslog("RemiseCheque::set_date", LOG_DEBUG); $resql=$this->db->query($sql); From 8392158ee37121844775370a839f823ae44b94ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 12:05:34 +0200 Subject: [PATCH 8/8] Update remisecheque.class.php --- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 03dffbabf34..808d2cbb00b 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -861,8 +861,8 @@ class RemiseCheque extends CommonObject if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET date_bordereau = '".($date ? $this->db->idate($date) : 'null'); - $sql.= "' WHERE rowid = ".$this->id; + $sql.= " SET date_bordereau = ".($date ? "'".$this->db->idate($date)."'" : 'null'); + $sql.= " WHERE rowid = ".$this->id; dol_syslog("RemiseCheque::set_date", LOG_DEBUG); $resql=$this->db->query($sql);