A better transition with deprecation
This commit is contained in:
parent
7db443e8ab
commit
8a6e28860b
@ -1393,7 +1393,7 @@ class Contrat extends CommonObject
|
||||
if (empty($txtva) || ! is_numeric($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0;
|
||||
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@ -1405,13 +1405,13 @@ class Contrat extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
@ -1603,7 +1603,7 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$remise_percent=0;
|
||||
}
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
|
||||
@ -1771,25 +1771,28 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
|
||||
}
|
||||
|
||||
// Analyze date
|
||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)
|
||||
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
$reg=array();
|
||||
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
{
|
||||
// This part of code should not be used.
|
||||
/*dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||
$sday = (! empty($reg[3]) ? $reg[3] : '');
|
||||
$shour = (! empty($reg[4]) ? $reg[4] : '');
|
||||
$smin = (! empty($reg[5]) ? $reg[5] : '');
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);*/
|
||||
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
|
||||
return '';
|
||||
}
|
||||
elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) // Still available to solve problems in extrafields of type date
|
||||
{
|
||||
// This part of code should not be used.
|
||||
dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||
$sday = (! empty($reg[3]) ? $reg[3] : '');
|
||||
$shour = (! empty($reg[4]) ? $reg[4] : '');
|
||||
$smin = (! empty($reg[5]) ? $reg[5] : '');
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date is a timestamps
|
||||
|
||||
Loading…
Reference in New Issue
Block a user