>From 16fa9a7cd0ff6b8b6367590240dd7bf98741434c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 7 Jan 2019 16:50:47 +0100 Subject: [PATCH 1/2] do not use empty because of account could be '0 = zero' --- htdocs/accountancy/journal/purchasesjournal.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 41579cd5cd..f090c52a19 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -7,6 +7,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Eric Seigne * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -139,7 +140,7 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'; + $cptfour = ( $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "" ) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'; $cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; $i = 0; @@ -147,7 +148,7 @@ if ($result) { $obj = $db->fetch_object($result); // Controls - $compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour; + $compta_soc = ( $obj->code_compta_fournisseur != "" ) ? $obj->code_compta_fournisseur : $cptfour; $compta_prod = $obj->compte; if (empty($compta_prod)) { @@ -741,7 +742,7 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); // Button to write into Ledger - if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } @@ -876,7 +877,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; } @@ -885,7 +886,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; $accountoshow = length_accounta($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; } @@ -911,7 +912,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ProductAccountNotDefined").''; } @@ -945,7 +946,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.''; } @@ -976,7 +977,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.''; } -- 2.11.0