diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 1033d0c797a..fc073f082fa 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -10957,23 +10957,23 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
'__DAY_TEXT_SHORT__' => dol_trunc($daytext, 3, 'right', 'UTF-8', 1), // Mon
'__DAY_TEXT_MIN__' => dol_trunc($daytext, 1, 'right', 'UTF-8', 1), // M
'__MONTH__' => (string) $tmp['mon'],
- '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])),
- '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])),
- '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])),
+ '__MONTH_TEXT__' => $outputlangs->transnoentitiesnoconv('Month' . sprintf("%02d", $tmp['mon'])),
+ '__MONTH_TEXT_SHORT__' => $outputlangs->transnoentitiesnoconv('MonthShort' . sprintf("%02d", $tmp['mon'])),
+ '__MONTH_TEXT_MIN__' => $outputlangs->transnoentitiesnoconv('MonthVeryShort' . sprintf("%02d", $tmp['mon'])),
'__YEAR__' => (string) $tmp['year'],
'__YEAR_PREVIOUS_MONTH__' => (string) $tmp3['year'],
'__YEAR_NEXT_MONTH__' => (string) $tmp5['year'],
'__PREVIOUS_DAY__' => (string) $tmp2['day'],
'__PREVIOUS_MONTH__' => (string) $tmp3['month'],
- '__PREVIOUS_MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp3['month'])),
- '__PREVIOUS_MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp3['month'])),
- '__PREVIOUS_MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp3['month'])),
+ '__PREVIOUS_MONTH_TEXT__' => $outputlangs->transnoentitiesnoconv('Month' . sprintf("%02d", $tmp3['month'])),
+ '__PREVIOUS_MONTH_TEXT_SHORT__' => $outputlangs->transnoentitiesnoconv('MonthShort' . sprintf("%02d", $tmp3['month'])),
+ '__PREVIOUS_MONTH_TEXT_MIN__' => $outputlangs->transnoentitiesnoconv('MonthVeryShort' . sprintf("%02d", $tmp3['month'])),
'__PREVIOUS_YEAR__' => (string) ($tmp['year'] - 1),
'__NEXT_DAY__' => (string) $tmp4['day'],
'__NEXT_MONTH__' => (string) $tmp5['month'],
- '__NEXT_MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp5['month'])),
- '__NEXT_MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp5['month'])),
- '__NEXT_MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp5['month'])),
+ '__NEXT_MONTH_TEXT__' => $outputlangs->transnoentitiesnoconv('Month' . sprintf("%02d", $tmp5['month'])),
+ '__NEXT_MONTH_TEXT_SHORT__' => $outputlangs->transnoentitiesnoconv('MonthShort' . sprintf("%02d", $tmp5['month'])),
+ '__NEXT_MONTH_TEXT_MIN__' => $outputlangs->transnoentitiesnoconv('MonthVeryShort' . sprintf("%02d", $tmp5['month'])),
'__NEXT_YEAR__' => (string) ($tmp['year'] + 1),
));
}
@@ -10983,9 +10983,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if ((empty($exclude) || !in_array('system', $exclude)) && (empty($include) || in_array('user', $include))) {
$substitutionarray['__DOL_MAIN_URL_ROOT__'] = DOL_MAIN_URL_ROOT;
- $substitutionarray['__(AnyTranslationKey)__'] = $outputlangs->trans('TranslationOfKey');
- $substitutionarray['__(AnyTranslationKey|langfile)__'] = $outputlangs->trans('TranslationOfKey') . ' (load also language file before)';
- $substitutionarray['__[AnyConstantKey]__'] = $outputlangs->trans('ValueOfConstantKey');
+ $substitutionarray['__(AnyTranslationKey)__'] = $outputlangs->transnoentitiesnoconv('TranslationOfKey');
+ $substitutionarray['__(AnyTranslationKey|langfile)__'] = $outputlangs->transnoentitiesnoconv('TranslationOfKey') . ' (load also language file before)';
+ $substitutionarray['__[AnyConstantKey]__'] = $outputlangs->transnoentitiesnoconv('ValueOfConstantKey');
}
// Note: The lazyload variables are replaced only during the call by make_substitutions, and only if necessary
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 6f18874451e..e77a47e4154 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -2666,7 +2666,7 @@ class Holiday extends CommonObject
$typeleaves = $this->getTypes(1, -1);
$arraytypeleaves = array();
- foreach ($typeleaves as $key => $val) {
+ foreach ($typeleaves as $val) {
$labeltoshow = ($outputlangs->trans($val['code']) != $val['code'] ? $outputlangs->trans($val['code']) : $val['label']);
$arraytypeleaves[$val['rowid']] = $labeltoshow;
}
@@ -2791,21 +2791,30 @@ class Holiday extends CommonObject
}
}
$mailtemplate = $formmail->getEMailTemplate($this->db, "holiday", $user, $outputlangs, $templateId, 1, $templateLabel);
- $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $this);
- complete_substitutions_array($substitutionarray, $outputlangs, $this);
- $subject = make_substitutions($mailtemplate->topic, $substitutionarray, $outputlangs);
- $msg = make_substitutions($mailtemplate->content, $substitutionarray, $outputlangs);
- $from = dol_string_nospecial(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
+ if (is_numeric($mailtemplate) || empty($mailtemplate->topic)) {
+ $this->errors[] = 'No mail template found for code "'.$templateLabel.'" or id "'.$templateId.'".';
+ $error++;
+ return 1;
+ }
- $msg = preg_replace('/__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__/', $outputarrayleaves, $msg);
- $cmail = new CMailFile($subject, $mailto, $from, $msg, array(), array(), array(), '', '', 0, 1);
- $result = $cmail->sendfile();
- if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
- $this->errors[] = $cmail->error;
- if (is_array($cmail->errors) && count($cmail->errors) > 0) {
- $this->errors = array_merge($this->errors, $cmail->errors);
- $error++;
+ if (!$error) {
+ $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $this);
+ complete_substitutions_array($substitutionarray, $outputlangs, $this);
+
+ $subject = make_substitutions($mailtemplate->topic, $substitutionarray, $outputlangs);
+ $msg = make_substitutions($mailtemplate->content, $substitutionarray, $outputlangs);
+ $from = dol_string_nospecial(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
+
+ $msg = preg_replace('/__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__/', $outputarrayleaves, $msg);
+ $cmail = new CMailFile($subject, $mailto, $from, $msg, array(), array(), array(), '', '', 0, 1);
+ $result = $cmail->sendfile();
+ if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
+ $this->errors[] = $cmail->error;
+ if (is_array($cmail->errors) && count($cmail->errors) > 0) {
+ $this->errors = array_merge($this->errors, $cmail->errors);
+ $error++;
+ }
}
}
diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql
index 5035d54349f..d665251a3a4 100644
--- a/htdocs/install/mysql/data/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/data/llx_c_email_templates.sql
@@ -34,6 +34,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
-- Recruiting
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'isModEnabled("recruitment")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,
\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n
\n__(Sincerely)__
__SENDEREMAIL_SIGNATURE__',null, 0);
+-- Holiday
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'holiday', 'holiday', '', 0, null, null, '(HolidayHrInformationsPreviousMonth)', 100,'isModEnabled("holiday")', 1, '__(HolidayHrInformationsPreviousMonthTopic)__', '__(Hello)__
__(HolidayHrInformationsPreviousMonthContent)__:
__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__
__SENDEREMAIL_SIGNATURE__', null, 0);
+
-- Event organization
-- Message for default setup of EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,
__(OrganizationEventConfRequestWasReceived)__
__(Sincerely)__
__SENDEREMAIL_SIGNATURE__', null, '1', null);
diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql
index 078a4b1b9b7..8cc2cf2cc3f 100644
--- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql
+++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql
@@ -189,7 +189,7 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN localtax1_type varchar(10) NUL
ALTER TABLE llx_societe_remise_except ADD COLUMN localtax2_tx double(7,4) DEFAULT 0 NOT NULL AFTER localtax1_type;
ALTER TABLE llx_societe_remise_except ADD COLUMN localtax2_type varchar(10) NULL AFTER localtax2_tx;
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'holiday', 'holiday', '', 0, null, null, '(HolidayHrInformationsPreviousMonth)', 100,'isModEnabled("holiday")', 1, '__(HolidayHrInformationsPreviousMonthTopic)__', '__(HolidayHrInformationsPreviousMonthContent)__:
__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__', null, 0);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'holiday', 'holiday', '', 0, null, null, '(HolidayHrInformationsPreviousMonth)', 100,'isModEnabled("holiday")', 1, '__(HolidayHrInformationsPreviousMonthTopic)__', '__(Hello)__
__(HolidayHrInformationsPreviousMonthContent)__:
__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__
__SENDEREMAIL_SIGNATURE__', null, 0);
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_ticket_type integer NULL;
diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang
index 040aa5774d9..802a482c789 100644
--- a/htdocs/langs/en_US/holiday.lang
+++ b/htdocs/langs/en_US/holiday.lang
@@ -171,4 +171,4 @@ ListeLB=List of leave balance
LeaveType = Type of leave balance
HolidayHrInformationsPreviousMonth=Hr information for previous month
HolidayHrInformationsPreviousMonthTopic=HR informations for the month of __PREVIOUS_MONTH_TEXT__
-HolidayHrInformationsPreviousMonthContent=Please find attached the HR information for the month of __PREVIOUS_MONTH_TEXT__ for the company __MYCOMPANY_NAME__
+HolidayHrInformationsPreviousMonthContent=Please find the HR information for the month of __PREVIOUS_MONTH_TEXT__ for the company __MYCOMPANY_NAME__