diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index c263cc99696..0c6180e0fcb 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * @@ -85,8 +85,7 @@ if (GETPOST("mode") != 'sconly') print "
"; } - -if ($conf->tax->enabled) +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { // Social contributions only if (GETPOST("mode") != 'sconly') @@ -197,7 +196,7 @@ if ($conf->tax->enabled) } // VAT -if ($conf->tax->enabled) +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') { @@ -380,16 +379,16 @@ while($j<$numlt) } - // Payment Salary -if ($conf->salaries->enabled) +if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) { if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') { $sal = new PaymentSalary($db); - print '
'; - print load_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + print "
"; + + print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 83bbb0a59b4..cc47c9570a6 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -146,10 +146,11 @@ class pdf_paiement $num=0; $lines=array(); - // count number of ligne of payement + // count number of lines of payment $sql = "SELECT p.rowid as prowid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; $sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; + $sql.= " AND p.entity = " . $conf->entity; $result = $this->db->query($sql); if ($result) { @@ -160,19 +161,23 @@ class pdf_paiement $sql = "SELECT p.datep as dp, f.facnumber"; //$sql .= ", c.libelle as paiement_type, p.num_paiement"; $sql.= ", c.code as paiement_code, p.num_paiement"; - $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount "; - $sql.= ", pf.amount as pf_amount , ba.ref as bankaccount "; + $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; + $sql.= ", pf.amount as pf_amount"; + if (! empty($conf->banque->enabled)) + $sql.= ", ba.ref as bankaccount"; $sql.= ", p.rowid as prowid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,"; - $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; + if (! empty($conf->banque->enabled)) + $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; - $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; + if (! empty($conf->banque->enabled)) + $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND p.fk_paiement = c.id "; $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 7abaf2c6b99..bd72c916103 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1432,7 +1432,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $prodcustprice->fetch_all($sortfield, $sortorder, 0, 0, $filter); + $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); } $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);