Merge pull request #18861 from marc-dll/NEW_expense_report_prefill_dates
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
This commit is contained in:
commit
b352d43baa
@ -145,10 +145,13 @@ if ($action == 'updateMask') {
|
|||||||
$draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
|
$draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
|
||||||
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
$amounts = GETPOST('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', 'int');
|
$dates = GETPOST('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', 'int');
|
||||||
$res3 = dolibarr_set_const($db, 'EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', intval($amounts), 'chaine', 0, '', $conf->entity);
|
$res3 = dolibarr_set_const($db, 'EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', intval($dates), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) {
|
$amounts = GETPOST('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', 'int');
|
||||||
|
$res4 = dolibarr_set_const($db, 'EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', intval($amounts), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0) || !($res4 >0)) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,11 +464,18 @@ print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htm
|
|||||||
print '<input class="flat minwidth200" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
|
print '<input class="flat minwidth200" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print $langs->trans('PrefillExpenseReportDatesWithCurrentMonth');
|
||||||
|
print '</td><td class="right">';
|
||||||
|
print $form->selectyesno('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', empty($conf->global->EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH) ? 0 : 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans('ForceExpenseReportsLineAmountsIncludingTaxesOnly');
|
print $langs->trans('ForceExpenseReportsLineAmountsIncludingTaxesOnly');
|
||||||
print '</td><td class="right">';
|
print '</td><td class="right">';
|
||||||
print $form->selectyesno('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', empty($conf->global->EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY) ? 0 : 1, 1);
|
print $form->selectyesno('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', empty($conf->global->EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY) ? 0 : 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print $form->buttonsSaveCancel("Save", '');
|
print $form->buttonsSaveCancel("Save", '');
|
||||||
|
|||||||
@ -68,6 +68,17 @@ $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('socid_id',
|
|||||||
|
|
||||||
$childids = $user->getAllChildIds(1);
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
|
if (! empty($conf->global->EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH)) {
|
||||||
|
if (empty($date_start)) {
|
||||||
|
$date_start = dol_mktime(0, 0, 0, (int) dol_print_date(dol_now(), '%m'), 1, (int) dol_print_date(dol_now(), '%Y'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($date_end)) {
|
||||||
|
// date('t') => number of days in the month, so last day of the month too
|
||||||
|
$date_end = dol_mktime(0, 0, 0, (int) dol_print_date(dol_now(), '%m'), (int) date('t'), (int) dol_print_date(dol_now(), '%Y'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hack to use expensereport dir
|
// Hack to use expensereport dir
|
||||||
$rootfordata = DOL_DATA_ROOT;
|
$rootfordata = DOL_DATA_ROOT;
|
||||||
$rootforuser = DOL_DATA_ROOT;
|
$rootforuser = DOL_DATA_ROOT;
|
||||||
|
|||||||
@ -517,7 +517,8 @@ Field=Field
|
|||||||
ProductDocumentTemplates=Document templates to generate product document
|
ProductDocumentTemplates=Document templates to generate product document
|
||||||
FreeLegalTextOnExpenseReports=Free legal text on expense reports
|
FreeLegalTextOnExpenseReports=Free legal text on expense reports
|
||||||
WatermarkOnDraftExpenseReports=Watermark on draft expense reports
|
WatermarkOnDraftExpenseReports=Watermark on draft expense reports
|
||||||
ForceExpenseReportsLineAmountsIncludingTaxesOnly=Force expense report amounts to be input only including taxes
|
PrefillExpenseReportDatesWithCurrentMonth=Pre-fill start and end dates of new expense report with start and end dates of the current month
|
||||||
|
ForceExpenseReportsLineAmountsIncludingTaxesOnly=Force the entry of expense report amounts always in amount with taxes
|
||||||
AttachMainDocByDefault=Set this to 1 if you want to attach main document to email by default (if applicable)
|
AttachMainDocByDefault=Set this to 1 if you want to attach main document to email by default (if applicable)
|
||||||
FilesAttachedToEmail=Attach file
|
FilesAttachedToEmail=Attach file
|
||||||
SendEmailsReminders=Send agenda reminders by emails
|
SendEmailsReminders=Send agenda reminders by emails
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user