From 423be8a139984953ce56b98afc12f4bd5a7cf367 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jan 2020 19:28:56 +0100 Subject: [PATCH] FIX Label of status of social contribution --- htdocs/compta/sociales/card.php | 53 ++++++++++--------- .../sociales/class/chargesociales.class.php | 10 ++-- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index ff2cb84dbce..92c27ff71a2 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016-2018 Frédéric France * Copyright (C) 2017 Alexandre Spangaro @@ -337,26 +337,26 @@ if ($action == 'create') print ''; print ''; - // Date end period + // Date print ''; print ''; - print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")); - print ''; - print ''; - print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1); - print ''; - print ''; - - // Date due - print ''; - print ''; - print $langs->trans("DateDue"); + print $langs->trans("Date"); print ''; print ''; print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1); print ''; print "\n"; + // Date end period + print ''; + print ''; + print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")); + print ''; + print ''; + print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1); + print ''; + print ''; + // Amount print ''; print ''; @@ -434,11 +434,11 @@ if ($id > 0) } else { + $formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); - $formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); } @@ -515,9 +515,20 @@ if ($id > 0) print ''; // Type - print '"; + print '"; print ""; + // Date + if ($action == 'edit') + { + print '"; + } else { + print ""; + } + // Period end date print ""; print ""; - // Due date - if ($action == 'edit') - { - print '"; - } else { - print ""; - } - // Amount if ($action == 'edit') { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 5bb218d46cd..7b2d9ceea1b 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -499,16 +499,20 @@ class ChargeSociales extends CommonObject // Load translation files required by the page $langs->loadLangs(array("customers","bills")); + // We reinit status array to force to redefine them because label may change according to properties values. + $this->labelStatus = array(); + $this->labelStatusShort = array(); + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); - if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); - $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft'); + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid'); $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled'); - if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); } $statusType = 'status1';
'.$langs->trans("Type")."".$object->type_label."
'; + print $langs->trans("Type")."".$object->type_label."
'.$langs->trans("DateDue").""; + print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); + print "
".$langs->trans("DateDue")."".dol_print_date($object->date_ech, 'day')."
".$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).""; @@ -531,16 +542,6 @@ if ($id > 0) } print "
'.$langs->trans("DateDue").""; - print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); - print "
".$langs->trans("DateDue")."".dol_print_date($object->date_ech, 'day')."