From f763f2361401042ad043a693c837a23fe8ac1dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 18 Jan 2015 00:57:03 +0100 Subject: [PATCH 1/7] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3388bbdbfe7..683c2c419f0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2335,8 +2335,11 @@ class Facture extends CommonInvoice } /** + * Update invoice line with percentage + * * @param FactureLigne $line Invoice line * @param int $percent + * @return void */ function update_percent($line, $percent) { @@ -3451,6 +3454,7 @@ class Facture extends CommonInvoice /** * Checks if the invoice is the first of a cycle * + * @return boolean */ function is_first() { @@ -3460,6 +3464,7 @@ class Facture extends CommonInvoice /** * Returns an array containing the previous situations as Facture objects * + * @return mixed -1 if error, array of previous situations */ function get_prev_sits() { @@ -3514,7 +3519,6 @@ class Facture extends CommonInvoice * @return int 0 or 1 if OK, -1 if error * */ - function is_last_in_cycle() { $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref; @@ -4096,7 +4100,6 @@ class FactureLigne extends CommonInvoiceLine * * @return int >= 0 */ - function get_prev_progress() { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { From 6237f68e74e0689ad4d19fa9ae9ca47a1463b46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 18 Jan 2015 01:07:32 +0100 Subject: [PATCH 2/7] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 683c2c419f0..a6cf04715f2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2338,7 +2338,7 @@ class Facture extends CommonInvoice * Update invoice line with percentage * * @param FactureLigne $line Invoice line - * @param int $percent + * @param int $percent Percentage * @return void */ function update_percent($line, $percent) From 48c6897f758fa93f33c9ab62eb05ae3a738c52b4 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Sun, 18 Jan 2015 03:20:35 +0100 Subject: [PATCH 3/7] Store per entity SMTP configuration --- htdocs/admin/mails.php | 12 ++++++------ htdocs/install/mysql/data/llx_const.sql | 6 +++--- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 8 ++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b39760c6907..e3908ad19d7 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -65,12 +65,12 @@ if ($action == 'update' && empty($_POST["cancel"])) { dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity); // Send mode parameters - dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',0); - if (isset($_POST["MAIN_MAIL_SMTP_PORT"])) dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',0); - if (isset($_POST["MAIN_MAIL_SMTP_SERVER"])) dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',0); - if (isset($_POST["MAIN_MAIL_SMTPS_ID"])) dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',0); - if (isset($_POST["MAIN_MAIL_SMTPS_PW"])) dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',0); - if (isset($_POST["MAIN_MAIL_EMAIL_TLS"])) dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',0); + dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity); // Content parameters dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity); diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 0c0a98355c0..3b627f3d99b 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -40,13 +40,13 @@ insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0); insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_PORT','','chaine','Port for SMTP server',0,0); - insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_UPLOAD_DOC','2048','chaine','Max size for file upload (0 means no upload allowed)',0,0); -- Hidden but specific to one entity insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MONNAIE','EUR','chaine','Monnaie',0,1); + +insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0,1); +insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_PORT','','chaine','Port for SMTP server',0,1); insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_EMAIL_FROM','robot@domain.com','chaine','EMail emetteur pour les emails automatiques Dolibarr',0,1); -- diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 02265ff86c8..d3f269d6dbe 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -37,3 +37,11 @@ ALTER TABLE llx_facture ADD situation_counter tinyint UNSIGNED; ALTER TABLE llx_facture ADD situation_final boolean; ALTER TABLE llx_facturedet ADD situation_percent real; ALTER TABLE llx_facturedet ADD fk_prev_id integer; + +-- Convert SMTP config to main entity, so new entities don't get the old values +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SENDMODE"; +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTP_PORT"; +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTP_SERVER"; +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTPS_ID"; +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTPS_PW"; +UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_EMAIL_TLS"; \ No newline at end of file From 2396f03093171f06342abd1e3825c3b3cf259d77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Jan 2015 11:21:43 +0100 Subject: [PATCH 4/7] Add PHP 5.6 into travis tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 98ebd9ceea3..f65d575f924 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ php: - "5.3" - "5.4" - "5.5" + - "5.6" env: - DB=mysql From 1681e3b03d8cbe064d33115d2a1b128860790574 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Jan 2015 11:36:15 +0100 Subject: [PATCH 5/7] Fix: Not allowed types (http://wiki.dolibarr.org/index.php/Langages_et_normes#Structure_des_tables_et_champs) --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 02265ff86c8..cea731b9dc9 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -32,8 +32,8 @@ ALTER TABLE llx_product_fournisseur_price ADD fk_price_expression integer DEFAUL insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2131, 213, '5', '0', 'VAT 5%', 1); -- Add situation invoices -ALTER TABLE llx_facture ADD situation_cycle_ref smallint UNSIGNED; -ALTER TABLE llx_facture ADD situation_counter tinyint UNSIGNED; -ALTER TABLE llx_facture ADD situation_final boolean; +ALTER TABLE llx_facture ADD situation_cycle_ref integer; +ALTER TABLE llx_facture ADD situation_counter integer; +ALTER TABLE llx_facture ADD situation_final integer; ALTER TABLE llx_facturedet ADD situation_percent real; ALTER TABLE llx_facturedet ADD fk_prev_id integer; From f3a313645263ae33fe3d634de8534ac92907614d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 18 Jan 2015 11:38:45 +0100 Subject: [PATCH 6/7] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c4b025878c5..aa1f79cfb11 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2666,7 +2666,7 @@ class Form * * @return string HTML select */ - function load_situation_invoices($selected = '', $socid) + function load_situation_invoices($selected = '', $socid = '') { global $langs; From b53b8d2e45ab6d532705a5c4c46d27d3271c24f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Jan 2015 11:48:52 +0100 Subject: [PATCH 7/7] Fixed: Backward compatibility --- htdocs/comm/action/class/actioncomm.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fb7195fdd68..b58123578dd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -138,6 +138,13 @@ class ActionComm extends CommonObject if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; + if (! is_array($this->userassigned)) // For backward compatibility + { + $tmpid=$this->userassigned; + $this->userassigned=array(); + $this->userassigned[$tmpid]=array('id'=>$tmpid); + } + $userownerid=$this->userownerid; $userdoneid=$this->userdoneid;