Merge remote-tracking branch 'origin/3.3' into develop

This commit is contained in:
Laurent Destailleur 2013-01-18 12:17:21 +01:00
commit f650888ea6
3 changed files with 26 additions and 20 deletions

View File

@ -114,6 +114,7 @@ For developers:
- New: Add PRODUCT_PRICE_MODIFY trigger.
- New: Created function to retrieve total amount of discount of an invoice/proposal...
- New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus.
- New: Use PHP classes DateTime* for some data functions instead of adodb
- Qual: Renamed SUPPLIER_INVOICE_BUILDDOC trigger to BILL_SUPPLIER_BUILDDOC
- Qual: Renamed INVOICE_SUPPLIER_DELETE trigger to BILL_SUPPLIER_DELETE
- Qual: Renamed SUPLIER_ORDER_BUILDDOC trigger to ORDER_SUPPLIER_BUILDDOC

View File

@ -88,7 +88,7 @@ function getServerTimeZoneInt($refgmtdate='now')
// Method 1 (include daylight)
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
if ($refgmtdate == 'now') $newrefgmtdate=$yearref.'-'.$monthref.'-'.$dayref;
elseif ($refgmtdate == 'summer') $newrefgmtdate=$yearref.'-05-15';
elseif ($refgmtdate == 'summer') $newrefgmtdate=$yearref.'-08-01';
else $newrefgmtdate=$yearref.'-01-01';
$localtz = new DateTimeZone(getServerTimeZoneString());
$localdt = new DateTime($newrefgmtdate, $localtz);
@ -773,7 +773,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
global $langs;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday);
// Check parameters
if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day';
if (! is_int($timestampEnd) && ! is_float($timestampEnd)) return 'ErrorBadParameter_num_open_day';

View File

@ -116,27 +116,32 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
if (defined("SYSLOG_FILE_NO_ERROR")) $filefd = @fopen($logfile, 'a+');
else $filefd = fopen($logfile, 'a+');
if (!$filefd && ! defined("SYSLOG_FILE_NO_ERROR"))
if (! $filefd)
{
// Do not break dolibarr usage if log fails
//throw new Exception('Failed to open log file '.basename($logfile));
print 'Failed to open log file '.basename($logfile);
if (! defined("SYSLOG_FILE_NO_ERROR"))
{
// Do not break dolibarr usage if log fails
//throw new Exception('Failed to open log file '.basename($logfile));
print 'Failed to open log file '.basename($logfile);
}
}
else
{
$logLevels = array(
LOG_EMERG => 'EMERG',
LOG_ALERT => 'ALERT',
LOG_CRIT => 'CRIT',
LOG_ERR => 'ERR',
LOG_WARNING => 'WARNING',
LOG_NOTICE => 'NOTICE',
LOG_INFO => 'INFO',
LOG_DEBUG => 'DEBUG'
);
$logLevels = array(
LOG_EMERG => 'EMERG',
LOG_ALERT => 'ALERT',
LOG_CRIT => 'CRIT',
LOG_ERR => 'ERR',
LOG_WARNING => 'WARNING',
LOG_NOTICE => 'NOTICE',
LOG_INFO => 'INFO',
LOG_DEBUG => 'DEBUG'
);
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-5s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-5s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
fwrite($filefd, $message."\n");
fclose($filefd);
fwrite($filefd, $message."\n");
fclose($filefd);
}
}
}