diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 43e4879e62f..b532b9db108 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -281,13 +281,16 @@ function getNumberInvoicesPieChart($mode) $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; if ($mode == 'customers') { + $element = 'invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; } elseif ($mode == 'fourn' || $mode == 'suppliers') { + $element = 'supplier_invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; } else { return ''; } - $sql .= " WHERE f.type <> 2"; + $sql .= " WHERE f.entity IN (".getEntity($element).")"; + $sql .= " AND f.type <> 2"; $sql .= " AND f.fk_statut = 1"; if (isset($user->socid) && $user->socid > 0) { $sql .= " AND f.fk_soc = ".((int) $user->socid); diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index c59acbea209..600f3878a0a 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -120,7 +120,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) // For multicompany if (!empty($out) && !empty($conf->multicompany->enabled)) { - $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities + $out .= "&entity=".$object->entity; // Check the entity because we may have the same reference in several entities } return $out; diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 4a3bcba51fb..1161b7f07c9 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/multicompany_page.php + * \file htdocs/core/multicompany_page.php * \brief File to return a page with the list of all entities user can switch to */ @@ -41,7 +41,7 @@ if (!defined('NOREQUIREMENU')) { require_once '../main.inc.php'; -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ'); $entityid = GETPOST('entity', 'int'); $backtourl = GETPOST('backtourl'); if (empty($backtourl)) { @@ -63,7 +63,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); * Actions */ -if (GETPOST('acction', 'aZ') == 'switchentity') { +if ($action == 'switchentity') { if (is_object($mc)) { $mc->switchEntity($entityid); }