From 8a9b9f173657f6111bfa6a8ff461a2d2ecb02d41 Mon Sep 17 00:00:00 2001 From: atm-john Date: Thu, 25 Oct 2018 21:53:48 +0200 Subject: [PATCH 1/7] Fix title --- htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php index ad32f1b9aa8..ae80389bd3a 100644 --- a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php +++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php @@ -68,7 +68,7 @@ $(document).ready(function(){ modal: true, height: windowHeight, width: windowWidth, - title: "trans('LinesToImport'); ?>", + title: "transnoentities('LinesToImport'); ?>", buttons: { "trans('Import'); ?>": function() { $( this ).dialog( "close" ); From 35421d135a0a638987ec774df0194bca23623783 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Oct 2018 15:01:50 +0200 Subject: [PATCH 2/7] FIX Total of timespent Conflicts: htdocs/core/js/timesheet.js --- htdocs/core/js/timesheet.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index ae7d839919c..aaec6971e2f 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -217,20 +217,21 @@ function updateTotal(days,mode) else jQuery('.totalDay'+days).removeClass("bold"); jQuery('.totalDay'+days).text(pad(total.getHours())+':'+pad(total.getMinutes())); - var total = new Date(0); - total.setHours(0); - total.setMinutes(0); + var totalhour = 0; + var totalmin = 0; for (var i=0; i<7; i++) { var taskTime= new Date(0); result=parseTime(jQuery('.totalDay'+i).text(),taskTime); if (result >= 0) { - total.setHours(total.getHours()+taskTime.getHours()); - total.setMinutes(total.getMinutes()+taskTime.getMinutes()); + totalhour = totalhour + taskTime.getHours(); + totalmin = totalmin + taskTime.getMinutes(); } } - jQuery('.totalDayAll').text(pad(total.getHours())+':'+pad(total.getMinutes())); + morehours = Math.floor(totalmin / 60); + totalmin = totalmin % 60; + jQuery('.totalDayAll').text(pad(morehours + totalhour)+':'+pad(totalmin)); } else { From d800fe925625790ef14680a068936eadaf0b2eb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Oct 2018 16:21:01 +0200 Subject: [PATCH 3/7] FIX extrafields of taks not visible in creation --- htdocs/projet/tasks.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 145c1742077..94a51ef3d01 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -490,7 +490,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Planned workload print ''.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text'); + print $form->select_duration('planned_workload', $planned_workload?$planned_workload : 0, 0, 'text'); print ''; // Progress @@ -506,11 +506,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Other options $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$taskstatic,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + if (empty($reshook) && ! empty($extrafields_task->attribute_label)) { - print $object->showOptionals($extrafields_task,'edit'); + print $taskstatic->showOptionals($extrafields_task,'edit'); // Do not use $object here that is object of project } print ''; From 6e3822345cec2bc1f497a10a23e110fd0be6bb62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Oct 2018 00:55:55 +0100 Subject: [PATCH 4/7] Fix use setup of template for attached files in mass actions --- htdocs/core/class/html.formmail.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 117bfb13769..6c74c1ca612 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -845,6 +845,13 @@ class FormMail extends Form $out.= ''.$langs->trans("MailFile").''; $out.= ''; + + // If a template was selected, we use setup of template to define if join file checkbox is selected or not. + if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + { + $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1); + } + if (! empty($this->withmaindocfile)) { if ($this->withmaindocfile == 1) From 244c7f8dc3a7f359f1fd356d72ec22c4dfb76dba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Oct 2018 02:02:43 +0100 Subject: [PATCH 5/7] FIX thirdparty property of object not loaded when only one record --- htdocs/core/actions_massactions.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b59b03d536f..710091a1661 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -333,12 +333,16 @@ if (! $error && $massaction == 'confirm_presend') if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); - // $listofqualifiedobj is array with key = object id of qualified objects for the current thirdparty + // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); $looparray=array(); if (! $oneemailperrecipient) { $looparray = $listofqualifiedobj; + foreach ($looparray as $key => $objecttmp) + { + $looparray[$key]->thirdparty = $thirdparty; + } } else { @@ -348,7 +352,7 @@ if (! $error && $massaction == 'confirm_presend') } //var_dump($looparray);exit; - foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty if we choose to send one email per thirdparty instead of per record + foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per record { // Make substitution in email content $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); From 553e984465609c7d1454f4f3e623805c65ca627c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Oct 2018 02:11:33 +0100 Subject: [PATCH 6/7] FIX Selection of addmaindocfile is lost on error --- htdocs/core/class/html.formmail.class.php | 8 ++++++-- htdocs/core/tpl/massactions_pre.tpl.php | 11 ++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6c74c1ca612..434f49bb3d6 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -846,8 +846,12 @@ class FormMail extends Form $out.= ''; + if (GETPOSTISSET('sendmail')) + { + $this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1); + } // If a template was selected, we use setup of template to define if join file checkbox is selected or not. - if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1); } @@ -860,7 +864,7 @@ class FormMail extends Form } if ($this->withmaindocfile == -1) { - $out.=''; + $out.=''; } $out.=' '.$langs->trans("JoinMainDoc").'.
'; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index d46e27e28af..a66e9ba270e 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -41,11 +41,12 @@ if ($massaction == 'presend') { $langs->load("mails"); + $listofselectedid = array(); + $listofselectedthirdparties = array(); + $listofselectedref = array(); + if (! GETPOST('cancel', 'alpha')) { - $listofselectedid = array(); - $listofselectedthirdparties = array(); - $listofselectedref = array(); foreach ($arrayofselected as $toselectid) { $result = $objecttmp->fetch($toselectid); @@ -110,8 +111,8 @@ if ($massaction == 'presend') } else { $formmail->withtoreadonly = 1; } - - $formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); + + $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; $formmail->withtofree = empty($liste)?1:0; $formmail->withtocc = 1; From 04f80f0925279bd614d20107aac94e32b52a0043 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Oct 2018 02:27:51 +0100 Subject: [PATCH 7/7] FIX Do not show check box if not applicable --- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/class/html.formmail.class.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 710091a1661..312d6c3d507 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -93,7 +93,7 @@ if (! $error && $massaction == 'confirm_presend') } // Check mandatory parameters - if (empty($user->email)) + if (GETPOST('fromtype','alpha') === 'user' && empty($user->email)) { $error++; setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 434f49bb3d6..99f14e973ca 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -846,14 +846,17 @@ class FormMail extends Form $out.= ''; - if (GETPOSTISSET('sendmail')) + if ($this->withmaindocfile) // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked) { - $this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1); - } - // If a template was selected, we use setup of template to define if join file checkbox is selected or not. - elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) - { - $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1); + if (GETPOSTISSET('sendmail')) + { + $this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1); + } + // If a template was selected, we use setup of template to define if join file checkbox is selected or not. + elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + { + $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1); + } } if (! empty($this->withmaindocfile))