From 6b90558b7ab9f0d89f6a04b1a800d4c5b09e8e2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Apr 2018 11:20:56 +0200 Subject: [PATCH 1/7] FIX File name not visible in email preview --- htdocs/core/class/CMailFile.class.php | 2 +- htdocs/core/class/smtps.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index d9469c11559..6dbc622032d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1128,7 +1128,7 @@ class CMailFile $out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol; $out.= "Content-Type: " . $mimetype_list[$i] . "; name=\"".$filename_list[$i]."\"".$this->eol; $out.= "Content-Transfer-Encoding: base64".$this->eol; - $out.= "Content-Description: File Attachment".$this->eol; + $out.= "Content-Description: ".$filename_list[$i].$this->eol; $out.= $this->eol; $out.= $encoded; $out.= $this->eol; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index c4176d2b81b..d83ff3110ba 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1410,7 +1410,7 @@ class SMTPs $content = 'Content-Type: ' . $_msgData['mimeType'] . '; charset="' . $this->getCharSet() . '"' . "\r\n" . 'Content-Transfer-Encoding: ' . $this->getTransEncodeType() . "\r\n" . 'Content-Disposition: inline' . "\r\n" - . 'Content-Description: message' . "\r\n"; + . 'Content-Description: Message' . "\r\n"; if ( $this->getMD5flag() ) $content .= 'Content-MD5: ' . $_msgData['md5'] . "\r\n"; @@ -1459,7 +1459,7 @@ class SMTPs . 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n" . 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" - . 'Content-Description: File Attachment' . "\r\n"; + . 'Content-Description: ' . $_data['fileName'] ."\r\n"; if ( $this->getMD5flag() ) $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n"; From e834eff049fa30ddcd34bab334f62360b1baeb7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Apr 2018 20:03:24 +0200 Subject: [PATCH 2/7] FIX #8650 --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 6749d4be51c..efb47ede029 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -707,3 +707,6 @@ create table llx_facture_rec_extrafields ALTER TABLE llx_facture_rec_extrafields ADD INDEX idx_facture_rec_extrafields (fk_object); + +UPDATE llx_cronjob set entity = 1 where entity = 0 and label in ('RecurringInvoices', 'SendEmailsReminders'); +UPDATE llx_cronjob set entity = 0 where entity = 1 and label in ('PurgeDeleteTemporaryFilesShort', 'MakeLocalDatabaseDumpShort'); From 77d9ff033af3b49ab950371d971adb358a419214 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Apr 2018 15:06:30 +0200 Subject: [PATCH 3/7] FIX cron script disabled if module disabled --- scripts/cron/cron_run_jobs.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 246fd3d75b4..5113e5971b0 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -75,6 +75,13 @@ $now=dol_now(); @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . $now . " *****\n"; +// Check module cron is activated +if (empty($conf->cron->enabled)) +{ + print "Error: module Scheduled jobs (cron) not activated\n"; + exit(-1); +} + // Check security key if ($key != $conf->global->CRON_KEY) { From 315d5bad3903e7c48dc1941163282b335b7c2ff5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Apr 2018 10:35:11 +0200 Subject: [PATCH 4/7] FIX Error in ContractLigne not return to Contract --- htdocs/contrat/class/contrat.class.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 85128ea8a69..a460f6aff51 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -237,7 +237,13 @@ class Contrat extends CommonObject */ function active_line($user, $line_id, $date, $date_end='', $comment='') { - return $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); + $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); + if ($result < 0) + { + $this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error; + $this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors; + } + return $result; } @@ -252,7 +258,13 @@ class Contrat extends CommonObject */ function close_line($user, $line_id, $date_end, $comment='') { - return $this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); + $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); + if ($result < 0) + { + $this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error; + $this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors; + } + return $result; } From f95e5078c103a0f4a81fba85b37940a23df70802 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Apr 2018 21:33:49 +0200 Subject: [PATCH 5/7] FIX Can't edit option PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY --- htdocs/projet/admin/project.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index b1cf4d9773b..4135d547be3 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -274,12 +274,11 @@ elseif ($action == 'updateoptions') $conf->global->PROJECT_USE_SEARCH_TO_SELECT = $companysearch; } } -} -else if ($action == "linkOtherCompany") -{ - $projectToSelect = GETPOST('projectToSelect'); - - dolibarr_set_const($db, 'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect, 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value + if (GETPOST('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) + { + $projectToSelect = GETPOST('projectToSelect','alpha'); + dolibarr_set_const($db, 'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect, 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value + } } From 0a5e6069375baf320383b23f1b9efff822b6e2fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Apr 2018 22:53:57 +0200 Subject: [PATCH 6/7] FIX extrafields price and double were lost during a failed post. --- 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 a8e4956a10d..21631b86cac 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5783,9 +5783,9 @@ abstract class CommonObject } else { $value = $this->array_options["options_" . $key]; // No GET, no POST, no default value, so we take value of object. } + //var_dump($keyprefix.' - '.$key.' - '.$keysuffix.' - '.$keyprefix.'options_'.$key.$keysuffix.' - '.$this->array_options["options_".$key.$keysuffix].' - '.$getposttemp.' - '.$value); break; } - //var_dump($value); if ($extrafields->attribute_type[$key] == 'separate') { @@ -5810,12 +5810,12 @@ abstract class CommonObject // Convert date into timestamp format (value in memory must be a timestamp) if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { - $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]); + $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]); } // Convert float submited string into real php numeric (value in memory must be a php numeric) if (in_array($extrafields->attribute_type[$key],array('price','double'))) { - $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix,'int',3)):$this->array_options['options_'.$key]; + $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix, 'alpha', 3)):$this->array_options['options_'.$key]; } $labeltoshow = $langs->trans($label); From fdb3a11f3492ce30bae8380fd29163d6b8812c22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Apr 2018 22:56:40 +0200 Subject: [PATCH 7/7] FIX extrafields price and double were lost during a failed post. --- htdocs/core/class/extrafields.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 7d6de9bda7f..2216c0fd7aa 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1779,13 +1779,14 @@ class ExtraFields } else if (in_array($key_type,array('price','double'))) { - $value_arr=GETPOST("options_".$key); + $value_arr=GETPOST("options_".$key, 'alpha'); $value_key=price2num($value_arr); } else { $value_key=GETPOST("options_".$key); } + $object->array_options["options_".$key]=$value_key; }