diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index af2f630b54c..8de0d100194 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -116,8 +116,8 @@ class modProjet extends DolibarrModules $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; - - $this->const[$r][0] = "PROJECT_USE_OPPORTUNIES"; + + $this->const[$r][0] = "PROJECT_USE_OPPORTUNITIES"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; $this->const[$r][3] = ""; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 016d0da52f6..ff16d70ed33 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -102,7 +102,7 @@ if ($socid) { $sql.= " AND e.fk_soc = ".$socid; } -if ($viewstatut <> '') { +if ($viewstatut <> '' && $viewstatut >= 0) { $sql.= " AND e.fk_statut = ".$viewstatut; } if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); @@ -120,6 +120,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); +//print $sql; $resql=$db->query($sql); if ($resql) { @@ -232,7 +233,8 @@ if ($resql) if ($conf->livraison_bon->enabled) { $shipment->fetchObjectLinked($shipment->id,$shipment->element); - $receiving=(! empty($shipment->linkedObjects['delivery'][0])?$shipment->linkedObjects['delivery'][0]:''); + $receiving=''; + if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']); // Ref print ''; diff --git a/htdocs/index.php b/htdocs/index.php index 8bc704520ca..8d818c7afc9 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -147,8 +147,8 @@ if (empty($user->societe_id)) // Condition to be checked for each display line dashboard $conditions=array( $user->rights->user->user->lire, - ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), ! empty($conf->adherent->enabled) && $user->rights->adherent->lire, ! empty($conf->product->enabled) && $user->rights->produit->lire, @@ -157,8 +157,8 @@ if (empty($user->societe_id)) ! 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->fournisseur->enabled) && $user->rights->fournisseur->commande->lire, - ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire, + ! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); // Class file containing the method load_state_board for each line $includes=array( @@ -348,7 +348,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } // Number of suppliers orders a deal -if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) +if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board=new CommandeFournisseur($db); @@ -386,7 +386,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) } // Number of supplier invoices (has paid) -if (! empty($conf->fournisseur->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) +if (! empty($conf->supplier_invoice->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 81c73356c93..ccf22bb5003 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -76,6 +76,7 @@ ProductsCategoryShort=Products tag/category MembersCategoryShort=Members tag/category SuppliersCategoriesShort=Suppliers tags/categories CustomersCategoriesShort=Customers tags/categories +ProspectsCategoriesShort=Prospects tags/categories CustomersProspectsCategoriesShort=Custo./Prosp. categories ProductsCategoriesShort=Products tags/categories MembersCategoriesShort=Members tags/categories diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 4801dff3af0..6d487de21e3 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -68,7 +68,7 @@ $form=new Form($db); $warehouse=new Entrepot($db); $sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; -$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; @@ -83,6 +83,16 @@ $result=$db->query($sql); if ($result) { $totalnboflines = $db->num_rows($result); + // fetch totals + $line = $total = $totalsell = $totalStock = 0; + while ($line < $totalnboflines) + { + $objp = $db->fetch_object($result); + $total += price2num($objp->estimatedvalue,'MU'); + $totalsell += price2num($objp->sellvalue,'MU'); + $totalStock += $objp->stockqty; + $line++; + } } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -118,6 +128,7 @@ if ($result) print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); @@ -135,7 +146,7 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -152,7 +163,6 @@ if ($result) if ($num) { $entrepot=new Entrepot($db); - $total = $totalsell = 0; $var=false; while ($i < min($num,$limit)) { @@ -164,6 +174,8 @@ if ($result) print '' . $entrepot->getNomUrl(1) . ''; // Location print ''.$objp->lieu.''; + // Stock qty + print ''.price2num($objp->stockqty,5).''; // PMP value print ''; if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1); @@ -185,17 +197,15 @@ if ($result) print "\n"; - $total += price2num($objp->estimatedvalue,'MU'); - $totalsell += price2num($objp->sellvalue,'MU'); - $var=!$var; $i++; } - if ($totalnboflines <= $limit) + if ($totalnboflines-$offset <= $limit) { print ''; print ''.$langs->trans("Total").''; + print ''.price2num($totalStock,5).''; print ''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''; print ''; if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b5f895cdcbb..76e1a22dd37 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -115,8 +115,8 @@ if ($result) while ($objp = $db->fetch_object($result)) { $found=0; - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } if ($found) $total++; @@ -130,8 +130,8 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou { print ''; $dataseries=array(); - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier'])); if (! empty($conf->societe->enabled)) $dataseries[]=array('label'=>$langs->trans("Others"),'data'=>round($third['other'])); $data=array('series'=>$dataseries); @@ -140,13 +140,13 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou } else { - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = ""; $statstring.= ''.$langs->trans("Prospects").''.round($third['prospect']).''; $statstring.= ""; } - if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { $statstring.= ""; $statstring.= ''.$langs->trans("Customers").''.round($third['customer']).'';