From 8b20c5edab762bf71208a281f76fa07645422e4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2017 15:44:11 +0200 Subject: [PATCH] FIX Remove warning when using log into syslog --- htdocs/accountancy/journal/bankjournal.php | 11 ++++++++--- htdocs/core/modules/syslog/mod_syslog_syslog.php | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 505e2a9f534..35f612802c2 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -172,13 +172,16 @@ if ($result) { { $obj = $db->fetch_object($result); + $lineisapurchase = ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)'); + $lineisasell = ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)'); + // Set accountancy code (for bank and thirdparty) $compta_bank = $obj->account_number; $compta_soc = 'NotDefined'; - if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') + if ($lineisapurchase) $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier); - if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') + if ($lineisasell) $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); $tabcompany[$obj->rowid] = array ( @@ -604,6 +607,8 @@ if (! $error && $action == 'writebookkeeping') { } } + + // Export if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -936,7 +941,7 @@ $db->close(); * Return source for doc_ref of a bank transaction * * @param string $val Array of val - * @param string $typerecord Type of record + * @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...) * @return string|unknown */ function getSourceDocRef($val, $typerecord) diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index e0283ac9a9f..1f2f499fbac 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -49,7 +49,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface public function isActive() { global $conf; - + // This function does not exists on some ISP (Ex: Free in France) if (!function_exists('openlog')) return 0; @@ -81,15 +81,15 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface */ public function checkConfiguration() { - global $langs; + global $conf, $langs; $errors = array(); - $facility = SYSLOG_FACILITY; + $facility = constant($conf->global->SYSLOG_FACILITY); if ($facility) { // Only LOG_USER supported on Windows - if (! empty($_SERVER["WINDIR"])) $facility='LOG_USER'; + if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER'); dol_syslog("admin/syslog: facility ".$facility); }