diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9469ef39ffb..9b294e76d38 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2016-2017 Laurent Destailleur +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2016-2017 Laurent Destailleur * * 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 diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 137c4f5fe37..74d86d567bf 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Ari Elbaz (elarifr) +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Ari Elbaz (elarifr) * * 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 @@ -20,9 +20,9 @@ */ /** - * \file htdocs/accountancy/class/accountingaccount.class.php - * \ingroup Advanced accountancy - * \brief File of class to manage accounting accounts + * \file htdocs/accountancy/class/accountingaccount.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage accounting accounts */ /** @@ -152,11 +152,11 @@ class AccountingAccount extends CommonObject if (empty($this->pcg_type) || $this->pcg_type == '-1') { - $this->pcg_type = 'XXXXXX'; + $this->pcg_type = 'XXXXXX'; } if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1') { - $this->pcg_subtype = 'XXXXXX'; + $this->pcg_subtype = 'XXXXXX'; } // Check parameters // Put here code to add control on parameters values @@ -235,17 +235,17 @@ class AccountingAccount extends CommonObject */ function update($user) { - // Check parameters - if (empty($this->pcg_type) || $this->pcg_type == '-1') - { - $this->pcg_type = 'XXXXXX'; - } - if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1') - { - $this->pcg_subtype = 'XXXXXX'; - } + // Check parameters + if (empty($this->pcg_type) || $this->pcg_type == '-1') + { + $this->pcg_type = 'XXXXXX'; + } + if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1') + { + $this->pcg_subtype = 'XXXXXX'; + } - $this->db->begin(); + $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null"); @@ -395,17 +395,17 @@ class AccountingAccount extends CommonObject $linkclose=''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowAccoutingAccount"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowAccoutingAccount"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; } - $linkstart=''; + $linkstart=''; $linkend=''; if ($nourl) @@ -462,10 +462,10 @@ class AccountingAccount extends CommonObject } /** - * Account desactivate + * Account deactivated * - * @param int $id Id - * @return int <0 if KO, >0 if OK + * @param int $id Id + * @return int <0 if KO, >0 if OK */ function account_desactivate($id) { $result = $this->checkUsage(); @@ -494,10 +494,10 @@ class AccountingAccount extends CommonObject } /** - * Account activate + * Account activated * - * @param int $id Id - * @return int <0 if KO, >0 if OK + * @param int $id Id + * @return int <0 if KO, >0 if OK */ function account_activate($id) { $this->db->begin(); @@ -522,56 +522,56 @@ class AccountingAccount extends CommonObject /** * Retourne le libelle du statut d'un user (actif, inactif) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ function getLibStatut($mode=0) { - return $this->LibStatut($this->status,$mode); + return $this->LibStatut($this->status,$mode); } /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ function LibStatut($statut,$mode=0) { - global $langs; - $langs->load('users'); + global $langs; + $langs->load('users'); - if ($mode == 0) - { - $prefix=''; - if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } + if ($mode == 0) + { + $prefix=''; + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } } } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 8e78a5845d5..925628c8fa7 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -618,8 +618,8 @@ if (! $error && $action == 'writebookkeeping') { $MAXNBERRORS=5; if ($error >= $MAXNBERRORS) { - setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); - break; // Break in the foreach + setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); + break; // Break in the foreach } } } @@ -1059,59 +1059,59 @@ function getSourceDocRef($val, $typerecord) $sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"]; - $ref = $langs->trans("Invoice"); + $ref = $langs->trans("Invoice"); } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f"; $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"]; - $ref = $langs->trans("SupplierInvoice"); + $ref = $langs->trans("SupplierInvoice"); } elseif ($typerecord == 'payment_expensereport') { $sqlmid = 'SELECT e.rowid as id, e.ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e"; $sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid"; - $ref = $langs->trans("ExpenseReport"); + $ref = $langs->trans("ExpenseReport"); } elseif ($typerecord == 'payment_salary') { $sqlmid = 'SELECT s.rowid as ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s"; $sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"]; - $ref = $langs->trans("SalaryPayment"); + $ref = $langs->trans("SalaryPayment"); } elseif ($typerecord == 'payment_vat') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v"; $sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"]; - $ref = $langs->trans("PaymentVat"); + $ref = $langs->trans("PaymentVat"); } elseif ($typerecord == 'payment_donation') { $sqlmid = 'SELECT payd.fk_donation as ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd"; $sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"]; - $ref = $langs->trans("Donation").' '; + $ref = $langs->trans("Donation").' '; } elseif ($typerecord == 'payment_various') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v"; $sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"]; - $ref = $langs->trans("VariousPayment"); + $ref = $langs->trans("VariousPayment"); } - dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - while ($objmid = $db->fetch_object($resultmid)) - { - $ref.=' '.$objmid->ref; - } - } - else dol_print_error($db); + dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + while ($objmid = $db->fetch_object($resultmid)) + { + $ref.=' '.$objmid->ref; + } + } + else dol_print_error($db); return $ref; } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 32426a312f4..ea8bac6715a 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -437,7 +437,7 @@ if ($id) if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$object->accountancy_code); + $accountingaccount->fetch('',$object->accountancy_code, 1); print $accountingaccount->getNomUrl(0,1,1,'',1); } else { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 6ebcb5fa109..30a8d2d4353 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Laurent Destailleur +/* Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Laurent Destailleur * * 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 @@ -257,7 +257,7 @@ if ($result) // Accounting account if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$obj->accountancy_code); + $accountingaccount->fetch('', $obj->accountancy_code, 1); print ''.$accountingaccount->getNomUrl(0,1,1,'',1).''; }