Merge pull request #7143 from hregis/6.0_bug

Fix: missing entity filter (multicompany)
This commit is contained in:
Laurent Destailleur 2017-07-13 14:33:45 +02:00 committed by GitHub
commit 4ee70e496e
2 changed files with 178 additions and 164 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -534,7 +534,7 @@ if ($id > 0)
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">'; $boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">'; $boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
if ($conf->propal->enabled) if (! empty($conf->propal->enabled))
{ {
// Box proposals // Box proposals
$tmp = $object->getOutstandingProposals(); $tmp = $object->getOutstandingProposals();
@ -552,7 +552,7 @@ if ($id > 0)
if ($link) $boxstat.='</a>'; if ($link) $boxstat.='</a>';
} }
if ($conf->commande->enabled) if (! empty($conf->commande->enabled))
{ {
// Box proposals // Box proposals
$tmp = $object->getOutstandingOrders(); $tmp = $object->getOutstandingOrders();
@ -570,13 +570,12 @@ if ($id > 0)
if ($link) $boxstat.='</a>'; if ($link) $boxstat.='</a>';
} }
if ($conf->facture->enabled) if (! empty($conf->facture->enabled))
{ {
$tmp = $object->getOutstandingBills(); $tmp = $object->getOutstandingBills();
$outstandingOpened=$tmp['opened']; $outstandingOpened=$tmp['opened'];
$outstandingTotal=$tmp['total_ht']; $outstandingTotal=$tmp['total_ht'];
$outstandingTotalIncTax=$tmp['total_ttc']; $outstandingTotalIncTax=$tmp['total_ttc'];
$text=$langs->trans("OverAllInvoices"); $text=$langs->trans("OverAllInvoices");
$link=''; $link='';
$icon='bill'; $icon='bill';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org> * Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -3351,6 +3351,11 @@ class Societe extends CommonObject
$sql = "SELECT rowid, total_ht, total as total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; $sql = "SELECT rowid, total_ht, total as total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f";
$sql .= " WHERE fk_soc = ". $this->id; $sql .= " WHERE fk_soc = ". $this->id;
if ($mode == 'supplier') {
$sql .= " AND entity IN (".getEntity('supplier_proposal').")";
} else {
$sql .= " AND entity IN (".getEntity('propal').")";
}
dol_syslog("getOutstandingProposals", LOG_DEBUG); dol_syslog("getOutstandingProposals", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -3386,6 +3391,11 @@ class Societe extends CommonObject
$sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; $sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f";
$sql .= " WHERE fk_soc = ". $this->id; $sql .= " WHERE fk_soc = ". $this->id;
if ($mode == 'supplier') {
$sql .= " AND entity IN (".getEntity('supplier_order').")";
} else {
$sql .= " AND entity IN (".getEntity('commande').")";
}
dol_syslog("getOutstandingOrders", LOG_DEBUG); dol_syslog("getOutstandingOrders", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -3429,6 +3439,11 @@ class Societe extends CommonObject
if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
$sql .= " WHERE fk_soc = ". $this->id; $sql .= " WHERE fk_soc = ". $this->id;
if ($mode == 'supplier') {
$sql .= " AND entity IN (".getEntity('facture_fourn').")";
} else {
$sql .= " AND entity IN (".getEntity('facture').")";
}
dol_syslog("getOutstandingBills", LOG_DEBUG); dol_syslog("getOutstandingBills", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);