Debug v24

This commit is contained in:
Laurent Destailleur 2026-03-30 11:56:02 +02:00
parent 065bb67728
commit 06cc22e7f4
5 changed files with 40 additions and 28 deletions

View file

@ -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

View file

@ -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++;
}
}
}

View file

@ -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__,<br><br>\n\n__(YourCandidatureAnswerMessage)__<br>__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n<br><br>\n__(Sincerely)__<br>__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)__<br><br>__(HolidayHrInformationsPreviousMonthContent)__:<br>__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__<br><br>__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)__,<br /><br />__(OrganizationEventConfRequestWasReceived)__<br /><br /><br />__(Sincerely)__<br />__SENDEREMAIL_SIGNATURE__', null, '1', null);

View file

@ -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)__:<br>__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)__<br><br>__(HolidayHrInformationsPreviousMonthContent)__:<br>__HOLIDAY_ARRAY_PER_EMPLOYEE_FOR_PERIOD__<br><br>__SENDEREMAIL_SIGNATURE__', null, 0);
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_ticket_type integer NULL;

View file

@ -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__