From 4c887d6110b86fe1f2bc9bf23dc3b1f10bb0568c Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Mon, 24 Aug 2020 14:53:34 +0200 Subject: [PATCH 01/53] Fix for non-numeric value in payment --- htdocs/fourn/facture/paiement.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index db5bc9acfb5..df5d62d1e5f 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -129,7 +129,8 @@ if (empty($reshook)) $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $paiement_id = 0; $totalpayment = 0; - $atleastonepaymentnotnull = 0; + $atleastonepaymentnotnull = 0; + $multicurrency_totalpayment = 0; // Generate payment array and check if there is payment higher than invoice and payment date before invoice date $tmpinvoice = new FactureFournisseur($db); @@ -171,7 +172,7 @@ if (empty($reshook)) } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { $cursorfacid = substr($key, 21); - $multicurrency_amounts[$cursorfacid] = price2num(trim(GETPOST($key))); + $multicurrency_amounts[$cursorfacid] = GETPOST($key) ? price2num(trim(GETPOST($key))) : 0; $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid]; if (!empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++; $result = $tmpinvoice->fetch($cursorfacid); From 25840c2b3dca1a846f7c72c0b64d9064046defb0 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 25 Aug 2020 12:40:29 +0200 Subject: [PATCH 02/53] Create Event - Add fields --- htdocs/comm/action/card.php | 27 ++++++++++++++++++++++++++- htdocs/core/class/html.form.class.php | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index eb723013f81..7090438c7ce 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -64,6 +64,10 @@ $apmin = GETPOST('apmin'); $p2hour = GETPOST('p2hour'); $p2min = GETPOST('p2min'); +$offsetvalue = GETPOST('offsetvalue'); +$offsetunit = GETPOST('offsetunittype_duration'); +$typeremind = GETPOST('typeremind'); + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); @@ -1106,7 +1110,28 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print '


'; + + print ''; + + //Reminder + print ''; + + //Reminder Type + print ''; + + //Notification + print ''; + + print '
'.$langs->trans("Reminder").''; + print ''; + print '
'.$langs->trans("ReminderType").''; + print $form->select_type_duration('offsetunit'); + print '
'.$langs->trans("TypeRemind").''; + print $form->selectarray('typeremind', array('mail'=>$langs->trans('EMail'), 'push'=>$langs->trans('OSNotif'))); + print '
'; + + dol_fiche_end(); print '
'; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5567813db79..d102b0133f4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5673,6 +5673,27 @@ class Form return $retstring; } + public function select_type_duration($prefix){ + + global $langs; + + $retstring = ''; + + $TDurationTypes = array('year'=>$langs->trans('Years'), 'month'=>$langs->trans('Month'), 'week'=>$langs->trans('Weeks'), 'day'=>$langs->trans('Days'), 'minute'=>$langs->trans('Minutes')); + + $retstring .= '"; + + print $retstring; + return; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to show a form to select a duration on a page From 94b2f3c5e1f921acb1eb30e418b6edf461907cdd Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 25 Aug 2020 12:57:36 +0200 Subject: [PATCH 03/53] Add $conf conditions --- htdocs/comm/action/card.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7090438c7ce..d3548a2505f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1110,26 +1110,33 @@ if ($action == 'create') print ''; - print '


'; - print ''; + if($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) + { + print '


'; - //Reminder - print ''; + print '
'.$langs->trans("Reminder").''; - print ''; - print '
'; - //Reminder Type - print ''; + //Reminder + print ''; - //Notification - print ''; + //Reminder Type + print ''; - print '
'.$langs->trans("ReminderType").''; - print $form->select_type_duration('offsetunit'); - print '
'.$langs->trans("Reminder").''; + print ''; + print '
'.$langs->trans("TypeRemind").''; - print $form->selectarray('typeremind', array('mail'=>$langs->trans('EMail'), 'push'=>$langs->trans('OSNotif'))); - print '
'.$langs->trans("ReminderType").''; + print $form->select_type_duration('offsetunit'); + print '
'; + //Notification + $TRemindTypes = array(); + if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['mail'] = $langs->trans('EMail'); + if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('OSNotif'); + print ''.$langs->trans("TypeRemind").''; + print $form->selectarray('typeremind',$TRemindTypes); + print ''; + + print ''; + } dol_fiche_end(); From 6a94c0f52fd45250aba8a47e18b9e93e031e1741 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 25 Aug 2020 16:43:57 +0200 Subject: [PATCH 04/53] Add model type mail --- htdocs/admin/mails_templates.php | 1 + htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index bdd9f571123..ad9627a817d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -168,6 +168,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementL if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject'); if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket'); if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = $langs->trans('RecruitmentCandidatures'); +if ($conf->agenda->enabled) $elementList['event_push'] = $langs->trans('MailToSendEventPush'); $elementList['user'] = $langs->trans('MailToUser'); $parameters = array('elementList'=>$elementList); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fbbdf81ff93..317dba89233 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2019,3 +2019,4 @@ MeasuringScaleDesc=The scale is the number of places you have to move the decima TemplateAdded=Template added TemplateUpdated=Template updated TemplateDeleted=Template deleted +MailToSendEventPush=Notification événement diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 236b4c61bd9..fce8aa988e0 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2011,3 +2011,4 @@ RssNote=Remarque: Chaque définition de flux RSS fournit un widget que vous deve JumpToBoxes=Aller à la Configuration -> Widgets MeasuringUnitTypeDesc=Utilisez ici une valeur comme "taille", "surface", "volume", "poids", "temps" MeasuringScaleDesc=L'échelle est le nombre de positions où vous devez déplacer la partie décimale pour qu'elle corresponde à l'unité de référence par défaut. Pour le type d'unité "temps", c'est le nombre de secondes. Les valeurs comprises entre 80 et 99 sont des valeurs réservées. +MailToSendEventPush=Notification événement From 7df993c7edeac411d0dcd9e7c2d895141611f48f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 25 Aug 2020 17:26:32 +0200 Subject: [PATCH 05/53] Add "select_model_mail" function + add select to create event --- htdocs/comm/action/card.php | 19 ++++++++++----- htdocs/core/class/html.form.class.php | 33 +++++++++++++++++++++++++++ htdocs/langs/fr_FR/agenda.lang | 3 +++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d3548a2505f..cda05d21784 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1118,23 +1118,30 @@ if ($action == 'create') print ''; //Reminder - print ''; - //Reminder Type - print ''; - //Notification + //Reminder Type $TRemindTypes = array(); if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['mail'] = $langs->trans('EMail'); if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('OSNotif'); - print ''; + //Mail Model + //TODO : ajouter les conditions pour l'affichage de ce champs : si au moins un model existe et si Email est le type de rappel sélectionné + print ''; + + print '
'.$langs->trans("Reminder").''; + print '
'.$langs->trans("ReminderTime").''; print ''; print '
'.$langs->trans("ReminderType").''; + //Time Type + print '
'.$langs->trans("TimeType").''; print $form->select_type_duration('offsetunit'); print '
'.$langs->trans("TypeRemind").''; - print $form->selectarray('typeremind',$TRemindTypes); + print '
'.$langs->trans("ReminderType").''; + print $form->selectarray('remindertype',$TRemindTypes); print '
'.$langs->trans("Model").''; + print $form->select_model_mail('eventpush', 'event_push'); + print '
'; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d102b0133f4..8d54dc78b13 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7965,4 +7965,37 @@ class Form return $ret; } + + public function select_model_mail($prefix, $modelType = ''){ + + global $langs, $db, $user; + + $retstring = ''; + + $TModels = array(); + + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); + + if($result > 0){ + + foreach($formmail->lines_model as $model){ + $TModels[$model->id] = $model->label; + } + + } + + $retstring .= '"; + + print $retstring; + return; + } } diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 6da45f7976d..e0d3e1fcbdf 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -158,3 +158,6 @@ DateStartPlusOne=Date de début + 1 heure SetAllEventsToTodo=Réglez tous les événements à "A faire" SetAllEventsToInProgress=Définir tous les événements à "En cours" SetAllEventsToFinished=Définir tous les événements sur "Terminés" +ReminderTime=Durée du rappel +TimeType=Type de durée +ReminderType=Type de rappel From a4018f41f7f36f47a9f7b189ecf4eda98a0b9c26 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 10:52:36 +0200 Subject: [PATCH 06/53] WIP --- htdocs/comm/action/card.php | 6 ++++-- htdocs/core/class/html.form.class.php | 7 ++++++- htdocs/langs/en_US/agenda.lang | 4 ++++ htdocs/langs/fr_FR/agenda.lang | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cda05d21784..b31d6a4d226 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -66,7 +66,8 @@ $p2min = GETPOST('p2min'); $offsetvalue = GETPOST('offsetvalue'); $offsetunit = GETPOST('offsetunittype_duration'); -$typeremind = GETPOST('typeremind'); +$remindertype = GETPOST('remindertype'); +$modelmail = GETPOST('eventpushmodel_mail'); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); @@ -1113,7 +1114,8 @@ if ($action == 'create') if($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) { - print '


'; + print '


'; + print load_fiche_titre($langs->trans("AddReminder"), '', ''); print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8d54dc78b13..e3757e3c0ed 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5673,7 +5673,7 @@ class Form return $retstring; } - public function select_type_duration($prefix){ + public function select_type_duration($prefix, $selected = 'month'){ global $langs; @@ -5684,7 +5684,12 @@ class Form $retstring .= ''; + + print "\n".''."\n"; + + print '
'.$langs->trans("AddReminder").'
'; @@ -1145,6 +1165,7 @@ if ($action == 'create') print '
'; + print '
'; } dol_fiche_end(); From 42f492877e0b25409496a81dce25f987ae9ac13c Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 11:36:32 +0200 Subject: [PATCH 08/53] WIP --- htdocs/comm/action/card.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b705e1193ee..c81180b4764 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1120,18 +1120,6 @@ if ($action == 'create') print '
'; print ''.$langs->trans("AddReminder").''; - print "\n".''."\n"; - print ''; + + print "\n".''."\n"; } dol_fiche_end(); From d3ac39589a44f07f855d1920551aced05924c36a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 12:48:12 +0200 Subject: [PATCH 09/53] WIP --- htdocs/comm/action/card.php | 40 +++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c81180b4764..78e0a109bf8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncommreminder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; @@ -67,9 +68,11 @@ $p2min = GETPOST('p2min'); $addreminder = GETPOST('addreminder'); $offsetvalue = GETPOST('offsetvalue'); $offsetunit = GETPOST('offsetunittype_duration'); -$remindertype = GETPOST('remindertype'); +$remindertype = GETPOST('selectremindertype'); $modelmail = GETPOST('eventpushmodel_mail'); +//var_dump($_POST); exit; + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); @@ -384,6 +387,31 @@ if (empty($reshook) && $action == 'add') $moreparam = ''; if ($user->id != $object->userownerid) $moreparam = "filtert=-1"; // We force to remove filter so created record is visible when going back to per user view. + //Reminder + if($addreminder == 'on'){ + $actionCommReminder = new ActionCommReminder($db); + +// if($offsetunit == 'minute'){ +// $timeBeforeEvent = convertTime2Seconds('', $offsetvalue); +// } elseif($offsetunit == 'hour'){ +// $timeBeforeEvent = convertTime2Seconds($offsetvalue); +// } elseif ($offsetunit == 'day') { +// $timeBeforeEvent = 3600 * 24 * $offsetvalue; +// } elseif ($offsetunit == 'week') { +// $timeBeforeEvent = 3600 * 24 * 7 * $offsetvalue; +// } elseif ($offsetunit == 'month') { +// $timeBeforeEvent = 3600 * 24 * 7 * $offsetvalue; +// } +// var_dump($datep); exit; +// +// $actionCommReminder->typeremind = $remindertype; +// $actionCommReminder->fk_user = $user; +// $actionCommReminder->offsetunit = $offsetunit; +// $actionCommReminder->offsetvalue = $offsetvalue; +// $actionCommReminder->offsetvalue = 'todo'; + + } + $db->commit(); if (!empty($backtopage)) { @@ -1139,10 +1167,10 @@ if ($action == 'create') //Reminder Type $TRemindTypes = array(); - if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['mail'] = $langs->trans('EMail'); + if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('OSNotif'); print ''.$langs->trans("ReminderType").''; - print $form->selectarray('remindertype',$TRemindTypes); + print $form->selectarray('selectremindertype',$TRemindTypes); print ''; //Mail Model @@ -1165,9 +1193,9 @@ if ($action == 'create') } }); - $("#remindertype").click(function(){ - var selected_option = $("#remindertype option:selected").val(); - if(selected_option == "mail") { + $("#selectremindertype").click(function(){ + var selected_option = $("#selectremindertype option:selected").val(); + if(selected_option == "email") { $("#select_eventpushmodel_mail").closest("tr").show(); } else { $("#select_eventpushmodel_mail").closest("tr").hide(); From 2fb582483617125c38b326c90f0af0da03c38e3c Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 15:12:08 +0200 Subject: [PATCH 10/53] Calcul date of reminder for event create --- htdocs/comm/action/card.php | 45 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 78e0a109bf8..e1a5b1876b9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -389,26 +389,34 @@ if (empty($reshook) && $action == 'add') //Reminder if($addreminder == 'on'){ + $actionCommReminder = new ActionCommReminder($db); -// if($offsetunit == 'minute'){ -// $timeBeforeEvent = convertTime2Seconds('', $offsetvalue); -// } elseif($offsetunit == 'hour'){ -// $timeBeforeEvent = convertTime2Seconds($offsetvalue); -// } elseif ($offsetunit == 'day') { -// $timeBeforeEvent = 3600 * 24 * $offsetvalue; -// } elseif ($offsetunit == 'week') { -// $timeBeforeEvent = 3600 * 24 * 7 * $offsetvalue; -// } elseif ($offsetunit == 'month') { -// $timeBeforeEvent = 3600 * 24 * 7 * $offsetvalue; -// } -// var_dump($datep); exit; -// -// $actionCommReminder->typeremind = $remindertype; -// $actionCommReminder->fk_user = $user; -// $actionCommReminder->offsetunit = $offsetunit; -// $actionCommReminder->offsetvalue = $offsetvalue; -// $actionCommReminder->offsetvalue = 'todo'; + if($offsetunit == 'minute'){ + $dateremind = strtotime("-".$offsetvalue." minutes", $datep); + } elseif($offsetunit == 'hour'){ + $dateremind = strtotime("-".$offsetvalue." hours", $datep); + } elseif ($offsetunit == 'day') { + $dateremind = strtotime("-".$offsetvalue." day", $datep); + } elseif ($offsetunit == 'week') { + $dateremind = strtotime("-".$offsetvalue." week", $datep); + } elseif ($offsetunit == 'month') { + $dateremind = strtotime("-".$offsetvalue." month", $datep); + } elseif ($offsetunit == 'year') { + $dateremind = strtotime("-".$offsetvalue." year", $datep); + } + + $actionCommReminder->dateremind = date('Y-m-d H:i:s', $dateremind); + $actionCommReminder->typeremind = $remindertype; + $actionCommReminder->fk_user = $user; + $actionCommReminder->offsetunit = $offsetunit; + $actionCommReminder->offsetvalue = $offsetvalue; + $actionCommReminder->offsetvalue = 'todo'; + //TODO : $fk_project + + $res = $actionCommReminder->create($user); + + var_dump($res); exit; } @@ -1174,7 +1182,6 @@ if ($action == 'create') print ''; //Mail Model - //TODO : ajouter les conditions pour l'affichage de ce champs : si au moins un model existe et si Email est le type de rappel sélectionné print ''.$langs->trans("Model").''; print $form->select_model_mail('eventpush', 'event_push'); print ''; From d4e6a9871c29474710674b3c22586eec22eb11bc Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 15:14:07 +0200 Subject: [PATCH 11/53] Update select_type_duration() function --- 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 e3757e3c0ed..4ea835acd36 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5679,7 +5679,7 @@ class Form $retstring = ''; - $TDurationTypes = array('year'=>$langs->trans('Years'), 'month'=>$langs->trans('Month'), 'week'=>$langs->trans('Weeks'), 'day'=>$langs->trans('Days'), 'minute'=>$langs->trans('Minutes')); + $TDurationTypes = array('year'=>$langs->trans('Years'), 'month'=>$langs->trans('Month'), 'week'=>$langs->trans('Weeks'), 'day'=>$langs->trans('Days'),'week'=>$langs->trans('Weeks'), 'day'=>$langs->trans('Days'), 'hour'=>$langs->trans('Hours'), 'minute'=>$langs->trans('Minutes')); $retstring .= ''; From cf9337b6449a8ccc8a737b35357314b1a605adc1 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 15:58:14 +0200 Subject: [PATCH 14/53] Add fk_project to actioncommreminder object --- htdocs/comm/action/card.php | 1 + htdocs/comm/action/class/actioncommreminder.class.php | 8 +++++++- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5eefb341c3c..cd550a1b8dd 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -412,6 +412,7 @@ if (empty($reshook) && $action == 'add') $actionCommReminder->offsetunit = $offsetunit; $actionCommReminder->offsetvalue = $offsetvalue; $actionCommReminder->status = $actionCommReminder::STATUS_TODO; + $actionCommReminder->fk_project = $object->id; //TODO : $fk_project $res = $actionCommReminder->create($user); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index db66112a261..58da9134a29 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -80,7 +80,8 @@ class ActionCommReminder extends CommonObject 'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,), 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), + 'fk_project' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), ); /** @@ -109,6 +110,11 @@ class ActionCommReminder extends CommonObject */ public $status; + /** + * @var int Project + */ + public $fk_project; + const STATUS_TODO = 0; const STATUS_DONE = 1; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 954f93a72cd..08b6389aac6 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -281,4 +281,5 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); -ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1; \ No newline at end of file +ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1; +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_project integer NOT NULL; \ No newline at end of file From a01d1b58c7c04267daf24f707ffa05e8ce338efc Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 16:06:20 +0200 Subject: [PATCH 15/53] Add fk_email_template --- htdocs/comm/action/card.php | 2 +- htdocs/comm/action/class/actioncommreminder.class.php | 6 ++++++ htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cd550a1b8dd..18e836823e0 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1180,7 +1180,7 @@ if ($action == 'create') print ''; //Mail Model - print ''.$langs->trans("Model").''; + print ''.$langs->trans("EMailTemplates").''; print $form->select_model_mail('eventpush', 'event_push'); print ''; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 58da9134a29..383acddb70c 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -82,6 +82,7 @@ class ActionCommReminder extends CommonObject 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), 'fk_project' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), + 'fk_email_template' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>0), ); /** @@ -115,6 +116,11 @@ class ActionCommReminder extends CommonObject */ public $fk_project; + /** + * @var int Template Mail + */ + public $fk_email_template; + const STATUS_TODO = 0; const STATUS_DONE = 1; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 08b6389aac6..676655815dc 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -282,4 +282,5 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1; -ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_project integer NOT NULL; \ No newline at end of file +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_project integer NOT NULL; +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer; \ No newline at end of file From cc29654f476a886b5bc6046ae27805cacc6d187e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 16:48:09 +0200 Subject: [PATCH 16/53] WIP : rename fk_project to fk_actioncomm + add line to sql file to install --- htdocs/comm/action/card.php | 12 ++++++------ .../comm/action/class/actioncommreminder.class.php | 6 +++--- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 5 +++-- .../mysql/tables/llx_actioncomm_reminder.key.sql | 2 +- .../install/mysql/tables/llx_actioncomm_reminder.sql | 6 +++++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 18e836823e0..5465e00887a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -69,7 +69,7 @@ $addreminder = GETPOST('addreminder'); $offsetvalue = GETPOST('offsetvalue'); $offsetunit = GETPOST('offsetunittype_duration'); $remindertype = GETPOST('selectremindertype'); -$modelmail = GETPOST('eventpushmodel_mail'); +$modelmail = GETPOST('agendasendmodel_mail'); //var_dump($_POST); exit; @@ -412,8 +412,8 @@ if (empty($reshook) && $action == 'add') $actionCommReminder->offsetunit = $offsetunit; $actionCommReminder->offsetvalue = $offsetvalue; $actionCommReminder->status = $actionCommReminder::STATUS_TODO; - $actionCommReminder->fk_project = $object->id; - //TODO : $fk_project + $actionCommReminder->fk_actioncomm = $object->id; + if($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail; $res = $actionCommReminder->create($user); } @@ -1181,7 +1181,7 @@ if ($action == 'create') //Mail Model print ''.$langs->trans("EMailTemplates").''; - print $form->select_model_mail('eventpush', 'event_push'); + print $form->select_model_mail('agendasend', 'agenda_send'); print ''; @@ -1201,9 +1201,9 @@ if ($action == 'create') $("#selectremindertype").click(function(){ var selected_option = $("#selectremindertype option:selected").val(); if(selected_option == "email") { - $("#select_eventpushmodel_mail").closest("tr").show(); + $("#select_agendasendmodel_mail").closest("tr").show(); } else { - $("#select_eventpushmodel_mail").closest("tr").hide(); + $("#select_agendasendmodel_mail").closest("tr").hide(); }; }); })'; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 383acddb70c..9e7f8f62fc1 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -81,8 +81,8 @@ class ActionCommReminder extends CommonObject 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), - 'fk_project' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), - 'fk_email_template' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>0), + 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), + 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>0), ); /** @@ -114,7 +114,7 @@ class ActionCommReminder extends CommonObject /** * @var int Project */ - public $fk_project; + public $fk_actioncomm; /** * @var int Template Mail diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 676655815dc..3a6d9a98d0b 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -282,5 +282,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1; -ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_project integer NOT NULL; -ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer; \ No newline at end of file +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_actioncomm integer NOT NULL; +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer; +ALTER TABLE llx_actioncomm_reminder DROP INDEX uk_actioncomm_reminder_unique, ADD UNIQUE uk_actioncomm_reminder_unique (fk_user, typeremind, offsetvalue, offsetunit, fk_actioncomm); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql index 94e50d05634..634e474782a 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql @@ -20,6 +20,6 @@ ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_dateremind ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_fk_user (fk_user); -- END MODULEBUILDER INDEXES -ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_user, typeremind, offsetvalue, offsetunit); +ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_actioncomm, fk_user, typeremind, offsetvalue, offsetunit); diff --git a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql index 2edb11c45c5..78dd00d6ea5 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql @@ -22,6 +22,10 @@ CREATE TABLE llx_actioncomm_reminder( fk_user integer NOT NULL, offsetvalue integer NOT NULL, offsetunit varchar(1) NOT NULL, - status integer NOT NULL DEFAULT 0 + status integer NOT NULL DEFAULT 0, + entity integer NOT NULL DEFAULT 1, + fk_actioncomm integer NOT NULL, + fk_email_template integer + -- END MODULEBUILDER FIELDS ) ENGINE=innodb; From efe60ebc58654910bd0d4492c0df1dc24cb1e684 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 17:02:34 +0200 Subject: [PATCH 17/53] Error management --- htdocs/comm/action/card.php | 11 ++++++++++- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5465e00887a..d783af604b7 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -387,7 +387,7 @@ if (empty($reshook) && $action == 'add') $moreparam = ''; if ($user->id != $object->userownerid) $moreparam = "filtert=-1"; // We force to remove filter so created record is visible when going back to per user view. - //Reminder + //Create eminder if($addreminder == 'on'){ $actionCommReminder = new ActionCommReminder($db); @@ -416,6 +416,15 @@ if (empty($reshook) && $action == 'add') if($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail; $res = $actionCommReminder->create($user); + + if($res <= 0){ + // If error + $db->rollback(); + $langs->load("errors"); + $error = $langs->trans('ErrorReminderActionCommCreation'); + setEventMessages($error, null, 'errors'); + $action = 'create'; $donotclearsession = 1; + } } $db->commit(); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 186272da1b6..0203f2e7af2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1082,3 +1082,4 @@ MODIFYInDolibarr=Record %s modified DELETEInDolibarr=Record %s deleted VALIDATEInDolibarr=Record %s validated APPROVEDInDolibarr=Record %s approved +ErrorReminderActionCommCreation=Error creating the reminder notification for this event \ No newline at end of file diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 1d5dd9bc6cb..aaadd7e31fe 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1043,4 +1043,4 @@ AmountMustBePositive=Le montant doit être positif. ByStatus=Par statut InformationMessage=Information ASAP=Dès que possible - +ErrorReminderActionCommCreation=Erreur lors de la création de la notification de rappel de cet événement From 6a60228bc3f55b18d7ca50f4a2363454c2f243f0 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Aug 2020 17:11:32 +0200 Subject: [PATCH 18/53] Translation --- htdocs/comm/action/card.php | 2 +- htdocs/langs/en_US/agenda.lang | 2 ++ htdocs/langs/en_US/main.lang | 3 +-- htdocs/langs/fr_FR/agenda.lang | 2 ++ htdocs/langs/fr_FR/main.lang | 3 +-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d783af604b7..bf7b7ccfaf4 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1183,7 +1183,7 @@ if ($action == 'create') //Reminder Type $TRemindTypes = array(); if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); - if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('OSNotif'); + if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('BrowserPush'); print ''.$langs->trans("ReminderType").''; print $form->selectarray('selectremindertype',$TRemindTypes); print ''; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 6d59e464660..bbfb143cee8 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -164,3 +164,5 @@ ReminderTime=Reminder period before the event TimeType=Duration type ReminderType=Callback type AddReminder=Create an automatic reminder notification for this event +ErrorReminderActionCommCreation=Error creating the reminder notification for this event +BrowserPush=Browser Notification \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0203f2e7af2..7ebcc9dd609 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1081,5 +1081,4 @@ CREATEInDolibarr=Record %s create MODIFYInDolibarr=Record %s modified DELETEInDolibarr=Record %s deleted VALIDATEInDolibarr=Record %s validated -APPROVEDInDolibarr=Record %s approved -ErrorReminderActionCommCreation=Error creating the reminder notification for this event \ No newline at end of file +APPROVEDInDolibarr=Record %s approved \ No newline at end of file diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 8a097ed73d2..80d1c953e0b 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -162,3 +162,5 @@ ReminderTime=Délai de rappel avant l'événement TimeType=Type de durée ReminderType=Type de rappel AddReminder=Créer une notification de rappel automatique pour cet évènement +ErrorReminderActionCommCreation=Erreur lors de la création de la notification de rappel de cet événement +BrowserPush=Notification navigateur diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index aaadd7e31fe..54b700cae39 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1042,5 +1042,4 @@ NotUsedForThisCustomer=Non utilisé pour ce client AmountMustBePositive=Le montant doit être positif. ByStatus=Par statut InformationMessage=Information -ASAP=Dès que possible -ErrorReminderActionCommCreation=Erreur lors de la création de la notification de rappel de cet événement +ASAP=Dès que possible \ No newline at end of file From bbc554070cdc57ec1be27d6d073c3552338fc64f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 27 Aug 2020 09:33:40 +0200 Subject: [PATCH 19/53] Fix --- htdocs/comm/action/class/actioncommreminder.class.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 9e7f8f62fc1..2d327cfc409 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -81,7 +81,7 @@ class ActionCommReminder extends CommonObject 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), - 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), + 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1, 'index'=>1,), 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>0), ); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 317dba89233..6b8d3a0a9b0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2019,4 +2019,4 @@ MeasuringScaleDesc=The scale is the number of places you have to move the decima TemplateAdded=Template added TemplateUpdated=Template updated TemplateDeleted=Template deleted -MailToSendEventPush=Notification événement +MailToSendEventPush=Event notification From 9d1fc28eba249121916ca5bbd6be854c095b50a6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 27 Aug 2020 09:35:02 +0200 Subject: [PATCH 20/53] Fix type reminder "push" to "browser" --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index bf7b7ccfaf4..d05b0914254 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1183,7 +1183,7 @@ if ($action == 'create') //Reminder Type $TRemindTypes = array(); if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); - if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('BrowserPush'); + if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['browser'] = $langs->trans('BrowserPush'); print ''.$langs->trans("ReminderType").''; print $form->selectarray('selectremindertype',$TRemindTypes); print ''; From 4ef26443006e095cdb822a8743589940475b01a9 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 27 Aug 2020 10:29:23 +0200 Subject: [PATCH 21/53] Use date.lib.php functions --- htdocs/comm/action/card.php | 14 +++++++------- htdocs/core/lib/date.lib.php | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d05b0914254..9ab1cf3366a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -393,20 +393,20 @@ if (empty($reshook) && $action == 'add') $actionCommReminder = new ActionCommReminder($db); if($offsetunit == 'minute'){ - $dateremind = strtotime("-".$offsetvalue." minutes", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i'); } elseif($offsetunit == 'hour'){ - $dateremind = strtotime("-".$offsetvalue." hours", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'h'); } elseif ($offsetunit == 'day') { - $dateremind = strtotime("-".$offsetvalue." day", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'd'); } elseif ($offsetunit == 'week') { - $dateremind = strtotime("-".$offsetvalue." week", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'w'); } elseif ($offsetunit == 'month') { - $dateremind = strtotime("-".$offsetvalue." month", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'm'); } elseif ($offsetunit == 'year') { - $dateremind = strtotime("-".$offsetvalue." year", $datep); + $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'y'); } - $actionCommReminder->dateremind = date('Y-m-d H:i:s', $dateremind); + $actionCommReminder->dateremind = $db->idate($dateremind); $actionCommReminder->typeremind = $remindertype; $actionCommReminder->fk_user = $user; $actionCommReminder->offsetunit = $offsetunit; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 22f99312520..1c7ff2cf20e 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -108,7 +108,7 @@ function getServerTimeZoneInt($refgmtdate = 'now') * * @param int $time Date timestamp (or string with format YYYY-MM-DD) * @param int $duration_value Value of delay to add - * @param int $duration_unit Unit of added delay (d, m, y, w, h) + * @param int $duration_unit Unit of added delay (d, m, y, w, h, i) * @return int New timestamp */ function dol_time_plus_duree($time, $duration_value, $duration_unit) @@ -116,6 +116,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) global $conf; if ($duration_value == 0) return $time; + if ($duration_unit == 'i') return $time + (60 * $duration_value); if ($duration_unit == 'h') return $time + (3600 * $duration_value); if ($duration_unit == 'w') return $time + (3600 * 24 * 7 * $duration_value); From b0fe7bc2e0913057d08e93e220ad0d591d5ece05 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 Aug 2020 08:47:57 +0000 Subject: [PATCH 22/53] Fixing style errors. --- htdocs/comm/action/card.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 9ab1cf3366a..46c42bff6ad 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -388,13 +388,12 @@ if (empty($reshook) && $action == 'add') if ($user->id != $object->userownerid) $moreparam = "filtert=-1"; // We force to remove filter so created record is visible when going back to per user view. //Create eminder - if($addreminder == 'on'){ - + if ($addreminder == 'on'){ $actionCommReminder = new ActionCommReminder($db); - if($offsetunit == 'minute'){ + if ($offsetunit == 'minute'){ $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i'); - } elseif($offsetunit == 'hour'){ + } elseif ($offsetunit == 'hour'){ $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'h'); } elseif ($offsetunit == 'day') { $dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'd'); @@ -413,11 +412,11 @@ if (empty($reshook) && $action == 'add') $actionCommReminder->offsetvalue = $offsetvalue; $actionCommReminder->status = $actionCommReminder::STATUS_TODO; $actionCommReminder->fk_actioncomm = $object->id; - if($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail; + if ($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail; $res = $actionCommReminder->create($user); - if($res <= 0){ + if ($res <= 0){ // If error $db->rollback(); $langs->load("errors"); @@ -1156,9 +1155,8 @@ if ($action == 'create') print ''; - if($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) + if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) { - //checkbox create reminder print '
'; print ''.$langs->trans("AddReminder").''; @@ -1182,10 +1180,10 @@ if ($action == 'create') //Reminder Type $TRemindTypes = array(); - if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); - if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['browser'] = $langs->trans('BrowserPush'); + if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); + if (!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['browser'] = $langs->trans('BrowserPush'); print ''.$langs->trans("ReminderType").''; - print $form->selectarray('selectremindertype',$TRemindTypes); + print $form->selectarray('selectremindertype', $TRemindTypes); print ''; //Mail Model From 5856033892819d90aeba821aa75d04227e454b8d Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 27 Aug 2020 11:15:08 +0200 Subject: [PATCH 23/53] Replace "agenda_send" and "event_push" to "actioncomm_send" --- htdocs/admin/mails_templates.php | 2 +- htdocs/comm/action/card.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 128a55a4889..3414f00b5d1 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -168,7 +168,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementL if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject'); if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket'); if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = $langs->trans('RecruitmentCandidatures'); -if ($conf->agenda->enabled) $elementList['event_push'] = $langs->trans('MailToSendEventPush'); +if ($conf->agenda->enabled) $elementList['actioncomm_send'] = $langs->trans('MailToSendEventPush'); $elementList['user'] = $langs->trans('MailToUser'); $parameters = array('elementList'=>$elementList); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 46c42bff6ad..7ecc12a621d 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -69,7 +69,7 @@ $addreminder = GETPOST('addreminder'); $offsetvalue = GETPOST('offsetvalue'); $offsetunit = GETPOST('offsetunittype_duration'); $remindertype = GETPOST('selectremindertype'); -$modelmail = GETPOST('agendasendmodel_mail'); +$modelmail = GETPOST('actioncommsendmodel_mail'); //var_dump($_POST); exit; @@ -1188,7 +1188,7 @@ if ($action == 'create') //Mail Model print ''.$langs->trans("EMailTemplates").''; - print $form->select_model_mail('agendasend', 'agenda_send'); + print $form->select_model_mail('actioncommsend', 'actioncomm_send'); print ''; @@ -1208,9 +1208,9 @@ if ($action == 'create') $("#selectremindertype").click(function(){ var selected_option = $("#selectremindertype option:selected").val(); if(selected_option == "email") { - $("#select_agendasendmodel_mail").closest("tr").show(); + $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { - $("#select_agendasendmodel_mail").closest("tr").hide(); + $("#select_actioncommsendmodel_mail").closest("tr").hide(); }; }); })'; From a5d1f1f68f0c9c3f8cf3d43629a858bd14869bc2 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 28 Aug 2020 10:02:43 +0200 Subject: [PATCH 24/53] FIX: expenses lines overlapping the frame for total amounts. If there is no room for this frame when printing the last expense line, this line should be on a new page. --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 32a8714cf12..e3d64f190d0 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport while ($i < $nblines) { $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); - if (empty($showpricebeforepagebreak)) { + if (empty($showpricebeforepagebreak) && $i !== $nblines - 1) { $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. } else { $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. From a031a10f77f0d1dbf58710f7aadcebd9262deb3f Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Fri, 28 Aug 2020 13:34:28 +0100 Subject: [PATCH 25/53] fix:option to see complete names of partners --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 71e214af5c0..3a317cc6968 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1047,7 +1047,7 @@ while ($i < min($num, $limit)) { $savalias = $obj->name_alias; if (!empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias = ''; - print ''; + print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME)?'class="tdoverflowmax200':'').'">'; if ($contextpage == 'poslist') { print $obj->name; From 215085e0e6f877ddf50648b9e1fc989dcdefb66c Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 28 Aug 2020 15:51:39 +0200 Subject: [PATCH 26/53] FIX: unit price divided by quantity when accepting supplier price proposal --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index b5d9652ed18..adfd1b07f04 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1810,7 +1810,7 @@ class SupplierProposal extends CommonObject if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); $productsupplier->id = $product->fk_product; - $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); + $productsupplier->update_buyprice($product->qty, $product->total_ht, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_total_ht, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '' ); } return 1; @@ -1849,7 +1849,7 @@ class SupplierProposal extends CommonObject public function createPriceFournisseur($product, $user) { global $conf; - + $price=price2num($product->subprice*$product->qty, 'MU'); $qty=price2num($product->qty); $unitPrice = price2num($product->subprice, 'MU'); From 49098218cbbe1b6f132912e3adadd00c300e3c6c Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 28 Aug 2020 16:55:28 +0200 Subject: [PATCH 27/53] NEW subject title with company name instead of application title in ticket message --- htdocs/core/class/html.formticket.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 251433a82a6..8be1c3d2833 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -919,8 +919,7 @@ class FormTicket // Subject print ''.$langs->trans('Subject').''; - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; - print 'ref.'] '.$langs->trans('TicketNewMessage').'" />'; + print 'ref . '] '.$langs->trans('TicketNewMessage').'" />'; print ''; // Destinataires From 0b8d7f329e9abee5bb842e1164f5caf4e2f8a452 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Aug 2020 17:17:22 +0200 Subject: [PATCH 28/53] FIX added information on user list not visible with multiselect --- htdocs/core/class/html.form.class.php | 35 ++++++++++++--------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c8a38dd0ea6..22da5ba9e8e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1753,43 +1753,39 @@ class Form $out .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength); // Complete name with more info - $moreinfo = 0; + $moreinfo = ''; if (!empty($conf->global->MAIN_SHOW_LOGIN)) { - $out .= ($moreinfo ? ' - ' : ' (').$obj->login; - $moreinfo++; + $moreinfo .= ($moreinfo ? ' - ' : ' (').$obj->login; } if ($showstatus >= 0) { if ($obj->statut == 1 && $showstatus == 1) { - $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); - $moreinfo++; + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); } if ($obj->statut == 0) { - $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); - $moreinfo++; + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); } } if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { if (!$obj->entity) { - $out .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); - $moreinfo++; + $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); } else { - $out .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); - $moreinfo++; + $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); } } - $out .= ($moreinfo ? ')' : ''); + $moreinfo .= ($moreinfo ? ')' : ''); if ($disableline && $disableline != '1') { - $out .= ' - '.$disableline; // This is text from $enableonlytext parameter + $moreinfo .= ' - '.$disableline; // This is text from $enableonlytext parameter } + $out .= $moreinfo; $out .= ''; - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength); + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; $i++; } @@ -6378,7 +6374,7 @@ class Form * @param string $htmlname Name of select * @param array $array Array with key+value * @param array $selected Array with key+value preselected - * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" + * @param int $key_in_label 1 to show key like in "[key] value" * @param int $value_as_key 1 to use value as key * @param string $morecss Add more css style * @param int $translate Translate and encode value @@ -6404,7 +6400,7 @@ class Form // Add code for jquery to use multiselect if (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { - $out .= "\n".' + $out .= "\n".' '."\n"; } @@ -880,8 +893,8 @@ if ($action == 'create') if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; - $default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? '' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); - $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ?GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1); + $default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); + $formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1); print ''; } @@ -1204,15 +1217,15 @@ if ($action == 'create') $(".reminderparameters").hide(); } }); - - $("#selectremindertype").click(function(){ + + $("#selectremindertype").click(function(){ var selected_option = $("#selectremindertype option:selected").val(); if(selected_option == "email") { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); }; - }); + }); })'; print ''."\n"; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a09bcc455ea..ed80b07f480 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5594,9 +5594,11 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; } if ($fullday) $reset_scripts .= ' } '; @@ -5609,9 +5611,11 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; } if ($fullday) $reset_scripts .= ' } '; } @@ -5676,7 +5680,7 @@ class Form * @param string $modelType Model type * @return string HTML select string */ - public function select_type_duration($prefix, $selected = 'minute') + public function select_type_duration($prefix, $selected = 'minute') { global $langs; From 9cba23e458c06c81a051c16e95e69ab0b620f61a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2020 06:10:18 +0200 Subject: [PATCH 51/53] Fix phpcs --- htdocs/core/class/html.form.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ed80b07f480..d3b1589410e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5673,16 +5673,18 @@ class Form return $retstring; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * select_type_duration * * @param string $prefix Prefix - * @param string $modelType Model type + * @param string $selected Selected type * @return string HTML select string */ public function select_type_duration($prefix, $selected = 'minute') { - global $langs; + // phpcs:enable + global $langs; $retstring = ''; @@ -7978,6 +7980,7 @@ class Form return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * select_model_mail * @@ -7985,8 +7988,9 @@ class Form * @param string $modelType Model type * @return string HTML select string */ - public function select_model_mail($prefix, $modelType = '') { - + public function select_model_mail($prefix, $modelType = '') + { + // phpcs:enable global $langs, $db, $user; $retstring = ''; From 6293f766925729f94625bd4b6839fe25e67ef103 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2020 06:17:26 +0200 Subject: [PATCH 52/53] Debug --- htdocs/admin/agenda_reminder.php | 2 +- htdocs/comm/action/card.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index c55e4a1afd5..5d23bbb08a1 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -231,7 +231,7 @@ print ''; dol_fiche_end(); -print '
'; +//print '
'; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 4a78939a8e2..037ac8bed89 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -257,7 +257,7 @@ if (empty($reshook) && $action == 'add') if (!$error) { // Initialisation objet actioncomm - $object->priority = GETPOST("priority") ? GETPOST("priority") : 0; + $object->priority = GETPOSTISSET("priority") ? GETPOST("priority", "int") : 0; $object->fulldayevent = (!empty($fulldayevent) ? 1 : 0); $object->location = GETPOST("location", 'alphanohtml'); $object->label = GETPOST('label', 'alphanohtml'); @@ -487,7 +487,7 @@ if (empty($reshook) && $action == 'update') $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; - $object->priority = GETPOST("priority", "alphanohtml"); + $object->priority = GETPOST("priority", "int"); $object->fulldayevent = GETPOST("fullday") ? 1 : 0; $object->location = GETPOST('location', "alphanohtml"); $object->socid = GETPOST("socid", "int"); @@ -1145,14 +1145,16 @@ if ($action == 'create') } // Priority - print ''.$langs->trans("Priority").''; - print ''; - print ''; + if (! empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) { + print ''.$langs->trans("Priority").''; + print ''; + print ''; + } // Description print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', (GETPOST('note', 'none') ? GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); + $doleditor = new DolEditor('note', (GETPOSTISSET('note') ? GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); $doleditor->Create(); print ''; From 9614dcf9ec83fed72d3abec76b3cf4c387209ad2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 29 Aug 2020 18:38:26 +0200 Subject: [PATCH 53/53] fix comment --- .../mysql/tables/llx_recruitment_recruitmentcandidature.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql index 93fb231dc35..eae967704b4 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql @@ -23,5 +23,5 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_rec ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); ---ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid); +-- ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid);