From f1506769086f5d662ac4bedeba8c89a8e071fc9b Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 13 Jan 2016 16:33:51 +0100 Subject: [PATCH 1/5] Fix #4409 totals not shown in stock/list --- htdocs/product/stock/list.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) 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); From a8148b8b4052a12b2e67d8697dd30483199b4aa6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jan 2016 20:56:20 +0100 Subject: [PATCH 2/5] FIX Bug: Delivery order and date are not displayed #4372 --- htdocs/expedition/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 00796add031..30e276cca20 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); @@ -113,6 +113,7 @@ if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); +//print $sql; $resql=$db->query($sql); if ($resql) { @@ -225,7 +226,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 ''; From 63ebd40ceb34344f575b5af79c9bdd7cb1d546a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2016 11:22:59 +0100 Subject: [PATCH 3/5] Fix bad var value --- htdocs/core/modules/modProjet.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] = ""; From 23dd6b8388fbcbce028aa0d93ce163cd07714e54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2016 12:35:55 +0100 Subject: [PATCH 4/5] Fix bad management of option SOCIETE_DISABLE_PROSPECTS and SOCIETE_DISABLE_CUSTOMERS --- htdocs/core/menus/standard/eldy.lib.php | 12 +++++++----- htdocs/langs/en_US/categories.lang | 1 + htdocs/societe/index.php | 12 ++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d8f940767b9..68e35536f1b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -645,11 +645,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->categorie->enabled)) { $langs->load("categories"); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { // Categories prospects/customers - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $menutoshow=$langs->trans("CustomersProspectsCategoriesShort"); + if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $menutoshow=$langs->trans("CustomersCategoriesShort"); + if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $menutoshow=$langs->trans("ProspectsCategoriesShort"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); @@ -1011,8 +1014,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->accounting->enabled)) { $langs->load("admin"); - - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount'); } } 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/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']).''; From ef7061a575a5f80e189d8d55860b00037006f423 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2016 12:49:23 +0100 Subject: [PATCH 5/5] Fix bad management of option SOCIETE_DISABLE_PROSPECTS and SOCIETE_DISABLE_CUSTOMERS --- htdocs/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 8bc704520ca..6058e5a70c8 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->fournisseur->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + ! empty($conf->fournisseur->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(