diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d5f4f400d5a8e12a89d78e77f88099652a4bf7c3..853109fe1955834f713107e219989716a1015967 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1928,6 +1928,47 @@ class CommandeFournisseur extends CommonOrder } } + /** + * Charge indicateurs this->nb de tableau de bord + * + * @return int <0 si ko, >0 si ok + */ + function load_state_board() + { + global $conf, $user; + + $this->nb=array(); + $clause = "WHERE"; + + $sql = "SELECT count(co.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = "AND"; + } + $sql.= " ".$clause." co.entity = ".$conf->entity; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["supplier_orders"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 988ee0b6a96cc457f779891160a98a5210dc31af..bd786cfdf4cbcac61181d8f6e6df9e4c8527936d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1614,6 +1614,48 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $xnbp*119.6; } + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf, $user; + + $this->nb=array(); + + $clause = "WHERE"; + + $sql = "SELECT count(f.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = "AND"; + } + $sql.= " ".$clause." f.entity = ".$conf->entity; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["supplier_invoices"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + /** * Load an object from its id and create a new one in database * diff --git a/htdocs/index.php b/htdocs/index.php index 138ddc4e3a9b3ea6def62142bc0d1fa63e605ebd..ebc6760252ccfe3386de3c9270e1f7d85c1a2288 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -154,7 +154,9 @@ if (empty($user->societe_id)) ! empty($conf->propal->enabled) && $user->rights->propale->lire, ! empty($conf->commande->enabled) && $user->rights->commande->lire, ! empty($conf->facture->enabled) && $user->rights->facture->lire, - ! empty($conf->contrat->enabled) && $user->rights->contrat->activer); + ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire, + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire); // Class file containing the method load_state_board for each line $includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/comm/prospect/class/prospect.class.php", @@ -165,7 +167,9 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", - DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); + DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php"); // Name class containing the method load_state_board for each line $classes=array('Client', 'Prospect', @@ -173,10 +177,12 @@ if (empty($user->societe_id)) 'Adherent', 'Product', 'Service', - 'Propal', - 'Commande', - 'Facture', - 'Contrat'); + 'Propal', + 'Commande', + 'Facture', + 'Contrat', + 'CommandeFournisseur', + 'FactureFournisseur'); // Cle array returned by the method load_state_board for each line $keys=array('customers', 'prospects', @@ -184,10 +190,12 @@ if (empty($user->societe_id)) 'members', 'products', 'services', - 'proposals', - 'orders', - 'invoices', - 'Contracts'); + 'proposals', + 'orders', + 'invoices', + 'Contracts', + 'supplier_orders', + 'supplier_invoices'); // Dashboard Icon lines $icons=array('company', 'company', @@ -195,10 +203,12 @@ if (empty($user->societe_id)) 'user', 'product', 'service', - 'propal', - 'order', - 'bill', - 'order'); + 'propal', + 'order', + 'bill', + 'order', + 'order', + 'bill'); // Translation keyword $titres=array("ThirdPartyCustomersStats", "ThirdPartyProspectsStats", @@ -209,7 +219,9 @@ if (empty($user->societe_id)) "CommercialProposalsShort", "CustomersOrders", "BillsCustomers", - "Contracts"); + "Contracts", + "SuppliersOrders", + "SuppliersInvoices"); // Dashboard Link lines $links=array(DOL_URL_ROOT.'/comm/list.php', DOL_URL_ROOT.'/comm/prospect/list.php', @@ -220,7 +232,9 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial', DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial', DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy', - DOL_URL_ROOT.'/contrat/list.php'); + DOL_URL_ROOT.'/contrat/list.php', + DOL_URL_ROOT.'/fourn/commande/list.php', + DOL_URL_ROOT.'/fourn/facture/list.php'); // Translation lang files $langfile=array("companies", "prospects",