diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 70b39fde0fb..564de96b4f4 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -201,6 +201,7 @@ if (empty($reshook)) { $object->label = GETPOST('label', 'alpha'); $object->date_ech = $dateech; $object->periode = $dateperiod; + $object->period = $dateperiod; $object->amount = $amount; $object->fk_user = $fk_user; $object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int'); @@ -236,6 +237,7 @@ if (empty($reshook)) { $object->date_ech = $dateech; $object->periode = $dateperiod; + $object->period = $dateperiod; $object->amount = $amount; $object->fk_user = $fk_user; @@ -271,6 +273,7 @@ if (empty($reshook)) { if (GETPOST('clone_for_next_month', 'int')) { // This can be true only if TAX_ADD_CLONE_FOR_NEXT_MONTH_CHECKBOX has been set $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); + $object->period = dol_time_plus_duree($object->periode, 1, 'm'); $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm'); } else { // Note date_ech is often a little bit higher than dateperiod @@ -278,6 +281,7 @@ if (empty($reshook)) { $newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int')); if ($newdateperiod) { $object->periode = $newdateperiod; + $object->period = $newdateperiod; if (empty($newdateech)) { $object->date_ech = $object->periode; } @@ -288,6 +292,7 @@ if (empty($reshook)) { // TODO We can here get dol_get_last_day of previous month: // $object->periode = dol_get_last_day(year of $object->date_ech - 1m, month or $object->date_ech -1m) $object->periode = $object->date_ech; + $object->period = $object->date_ech; } } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 909072fb459..246e92e0031 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -66,7 +66,11 @@ class ChargeSociales extends CommonObject public $type_label; public $amount; public $paye; + /** + * @deprecated + */ public $periode; + public $period; /** * @var integer|string date_creation @@ -149,7 +153,7 @@ class ChargeSociales extends CommonObject public function fetch($id, $ref = '') { $sql = "SELECT cs.rowid, cs.date_ech"; - $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; + $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key"; $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private"; $sql .= ", c.libelle as type_label"; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; @@ -186,7 +190,8 @@ class ChargeSociales extends CommonObject $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->paye = $obj->paye; - $this->periode = $this->db->jdate($obj->periode); + $this->periode = $this->db->jdate($obj->period); + $this->period = $this->db->jdate($obj->period); $this->import_key = $this->import_key; $this->db->free($resql); @@ -211,7 +216,7 @@ class ChargeSociales extends CommonObject $newamount = price2num($this->amount, 'MT'); // Validation of parameters - if ($newamount == 0 || empty($this->date_ech) || empty($this->periode)) { + if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) { return false; } @@ -744,6 +749,7 @@ class ChargeSociales extends CommonObject $this->date_creation = dol_now(); $this->date_ech = $this->date_creation + 3600 * 24 * 30; $this->periode = $this->date_creation + 3600 * 24 * 30; + $this->period = $this->date_creation + 3600 * 24 * 30; $this->amount = 100; $this->label = 'Social contribution label'; $this->type = 1; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 554be07eb97..9409ae0d40f 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -267,7 +267,7 @@ if ($id > 0 && $action != 'edit') { // Type print '