Fix php8 compatibility
This commit is contained in:
parent
3ae6a1d786
commit
6ebe41324f
@ -519,8 +519,11 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Define some dates
|
||||
$originaldatewhen = $_facrec->date_when;
|
||||
$nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency);
|
||||
$previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd');
|
||||
$nextdatewhen = null; $previousdaynextdatewhen = null;
|
||||
if ($originaldatewhen) {
|
||||
$nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency);
|
||||
$previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd');
|
||||
}
|
||||
|
||||
if (!empty($_facrec->frequency)) { // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarly when there is no recurrence.
|
||||
$this->socid = $_facrec->socid;
|
||||
@ -610,9 +613,9 @@ class Facture extends CommonInvoice
|
||||
$substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y');
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
|
||||
// Only for template invoice
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = (isset($originaldatewhen) ? dol_print_date($originaldatewhen, 'dayhour') : '');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = (isset($nextdatewhen) ? dol_print_date($nextdatewhen, 'dayhour') : '');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = (isset($previousdaynextdatewhen) ? dol_print_date($previousdaynextdatewhen, 'dayhour') : '');
|
||||
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $_facrec->nb_gen_done;
|
||||
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $_facrec->nb_gen_max;
|
||||
|
||||
|
||||
@ -7923,16 +7923,22 @@ abstract class CommonObject
|
||||
|
||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date'))) {
|
||||
$datenotinstring = $this->array_options['options_'.$key];
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
$datenotinstring = null;
|
||||
if (array_key_exists('options_'.$key, $this->array_options)) {
|
||||
$datenotinstring = $this->array_options['options_'.$key];
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
}
|
||||
}
|
||||
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
|
||||
}
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
|
||||
$datenotinstring = $this->array_options['options_'.$key];
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
$datenotinstring = null;
|
||||
if (array_key_exists('options_'.$key, $this->array_options)) {
|
||||
$datenotinstring = $this->array_options['options_'.$key];
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
}
|
||||
}
|
||||
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user