From e5ef45562883733fcb7ae5c65533c310105eb73f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:46:08 +0100 Subject: [PATCH 1/5] fix: date auto fill date paiement tax --- htdocs/compta/paiement_charge.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 509e20f3613..a1c3a246829 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -224,8 +224,8 @@ if ($action == 'create') print ''.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : 0; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + $datepaye = ($datepaye == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepaye); + print $form->selectDate($datepaye, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 33d7998a9682fecabd94f9f0e61a50a56ff9b0ce Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:47:20 +0100 Subject: [PATCH 2/5] fix: date auto fill date paiement tax --- htdocs/compta/paiement_charge.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a1c3a246829..37301908693 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,9 +223,9 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepaye = ($datepaye == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepaye); - print $form->selectDate($datepaye, '', '', '', '', "add_payment", 1, 1); + $datepayment = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datepayment = ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepayment); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 7e30812529d6b68e4838d246686a02cd07216a06 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 22:01:53 +0100 Subject: [PATCH 3/5] fix review --- htdocs/compta/paiement_charge.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 37301908693..ac89cfef0b6 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,8 +223,13 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $datepayment = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment = ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepayment); + if (GETPOSTISSET('remonth')) { + $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { + $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); + } else { + $datepayment = '' ; + } print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 0fa7134bd11559e51ea019dddd06ca15cb25f19b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 14 Jan 2021 13:04:02 +0100 Subject: [PATCH 4/5] better fix --- htdocs/compta/paiement_charge.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index ac89cfef0b6..f67bed0ec63 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,14 +223,16 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; + $empty=1; + $datepayment=''; if (GETPOSTISSET('remonth')) { $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $empty=0; } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); - } else { - $datepayment = '' ; + $empty=0; } - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', '', '', $empty, "add_payment", 1, 1); print ""; print ''; From a8cdecf1b8c234af63c13040d7cc03823001b0f1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 19:17:23 +0100 Subject: [PATCH 5/5] better fix --- htdocs/compta/paiement_charge.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index f67bed0ec63..715a0851c65 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,16 +223,9 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $empty=1; - $datepayment=''; - if (GETPOSTISSET('remonth')) { - $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $empty=0; - } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { - $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); - $empty=0; - } - print $form->selectDate($datepayment, '', '', '', $empty, "add_payment", 1, 1); + $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : ''; + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print ""; print '';