diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 075e44deead..c4289a24605 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -1737,7 +1737,7 @@ class Contact extends CommonObject
$this->db->begin();
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".$this->id." AND entity IN (".getEntity("societe_contact").")";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("societe_contact").")";
$result = $this->db->query($sql);
if (!$result) {
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 3191e5edd47..39600605414 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -437,8 +437,8 @@ class Conf
$this->service->dir_temp = $rootfortemp."/produit/temp";
// Module productbatch
- $this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot");
- $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp");
+ $this->productbatch->multidir_output = array($this->entity => $rootfordata."/productlot");
+ $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/productlot/temp");
// Module contrat
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 2b551ed14d1..46fcd5e331b 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -455,7 +455,7 @@ class FormMail extends Form
// Zone to select email template
if (count($modelmail_array) > 0)
{
- $model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : $arraydefaultmessage->id;
+ $model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : ($arraydefaultmessage->id > 0 ? $arraydefaultmessage->id : 0);
// If list of template is filled
$out .= '
'."\n";
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 9ce8d84d7e3..7012b6bff07 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -365,7 +365,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("propal");
print '
| ';
- print ''.img_object('', 'propal').' '.$langs->trans("Proposals").'';
+ print ''.img_object('', 'propal', 'class="paddingright"').$langs->trans("Proposals").'';
print ' | ';
print $product->stats_propale['customers'];
print ' | ';
@@ -381,9 +381,9 @@ function show_stats_for_company($product, $socid)
$nblines++;
$ret = $product->load_stats_proposal_supplier($socid);
if ($ret < 0) dol_print_error($db);
- $langs->load("propal");
+ $langs->load("supplier_proposal");
print ' |
| ';
- print ''.img_object('', 'supplier_proposal').' '.$langs->trans("SupplierProposals").'';
+ print ''.img_object('', 'supplier_proposal', 'class="paddingright"').$langs->trans("SupplierProposals").'';
print ' | ';
print $product->stats_proposal_supplier['suppliers'];
print ' | ';
@@ -401,7 +401,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print ' |
| ';
- print ''.img_object('', 'order').' '.$langs->trans("CustomersOrders").'';
+ print ''.img_object('', 'order', 'class="paddingright"').$langs->trans("CustomersOrders").'';
print ' | ';
print $product->stats_commande['customers'];
print ' | ';
@@ -419,7 +419,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print ' |
| ';
- print ''.img_object('', 'supplier_order').' '.$langs->trans("SuppliersOrders").'';
+ print ''.img_object('', 'supplier_order', 'class="paddingright"').$langs->trans("SuppliersOrders").'';
print ' | ';
print $product->stats_commande_fournisseur['suppliers'];
print ' | ';
@@ -455,7 +455,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("bills");
print ' |
| ';
- print ''.img_object('', 'supplier_invoice').' '.$langs->trans("SuppliersInvoices").'';
+ print ''.img_object('', 'supplier_invoice', 'class="paddingright"').$langs->trans("SuppliersInvoices").'';
print ' | ';
print $product->stats_facture_fournisseur['suppliers'];
print ' | ';
@@ -474,7 +474,7 @@ function show_stats_for_company($product, $socid)
if ($ret < 0) dol_print_error($db);
$langs->load("contracts");
print ' |
| ';
- print ''.img_object('', 'contract').' '.$langs->trans("Contracts").'';
+ print ''.img_object('', 'contract', 'class="paddingright"').$langs->trans("Contracts").'';
print ' | ';
print $product->stats_contrat['customers'];
print ' | ';
@@ -496,15 +496,15 @@ function show_stats_for_company($product, $socid)
$langs->load("mrp");
print ' |
| ';
- print ''.img_object('', 'mrp').' '.$langs->trans("BOM").'';
+ print ''.img_object('', 'bom', 'class="paddingright"').$langs->trans("BOM").'';
print ' | ';
print ' | ';
- print $form->textwithpicto($product->stats_bom['nb_toproduce'], $langs->trans("QtyToProduce"));
- print $form->textwithpicto($product->stats_bom['nb_toconsume'], $langs->trans("ToConsume"));
+ print $form->textwithpicto($product->stats_bom['nb_toconsume'], $langs->trans("RowMaterial"));
+ print $form->textwithpicto($product->stats_bom['nb_toproduce'], $langs->trans("Finished"));
print ' | ';
- print $form->textwithpicto($product->stats_bom['qty_toproduce'], $langs->trans("QtyToProduce"));
- print $form->textwithpicto($product->stats_bom['qty_toconsume'], $langs->trans("ToConsume"));
+ print $form->textwithpicto($product->stats_bom['qty_toconsume'], $langs->trans("RowMaterial"));
+ print $form->textwithpicto($product->stats_bom['qty_toproduce'], $langs->trans("Finished"));
print ' | ';
print '
';
}
@@ -519,7 +519,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("mrp");
print '
| ';
- print ''.img_object('', 'mrp').' '.$langs->trans("MO").'';
+ print ''.img_object('', 'mrp', 'class="paddingright"').$langs->trans("MO").'';
print ' | ';
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index f8286216e57..3be810a2e8e 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2464,7 +2464,7 @@ class Product extends CommonObject
$this->stats_bom['qty_toconsume'] = 0;
$sql = "SELECT COUNT(DISTINCT b.rowid) as nb_toproduce,";
- $sql .= " b.qty as qty_toproduce";
+ $sql .= " SUM(b.qty) as qty_toproduce";
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid";
$sql .= " WHERE ";
diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php
index 1582646cd8a..d1254a65b1e 100644
--- a/htdocs/product/stats/bom.php
+++ b/htdocs/product/stats/bom.php
@@ -244,8 +244,8 @@ if ($id > 0 || !empty($ref))
print ' |
';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", "&id=".$product->id, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.date_valid", "", "&id=".$product->id, 'align="center"', $sortfield, $sortorder);
- print_liste_field_titre("ToConsume", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
- print_liste_field_titre("QtyToProduce", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("RowMaterial", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("Finished", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "b.status", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
print "
\n";
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index 8601ce25ebc..0968e2ea7ce 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -397,7 +397,7 @@ if (empty($action))
print '
'; // ancre
// Documents
- $filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product_batch').dol_sanitizeFileName($object->ref);
+ $filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product_batch');
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $usercanread;
$delallowed = $usercancreate;
diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php
index 535486f8c62..2882bbf1c9f 100644
--- a/htdocs/product/stock/productlot_document.php
+++ b/htdocs/product/stock/productlot_document.php
@@ -26,7 +26,7 @@
/**
* \file htdocs/product/stock/productlot_document.php
* \ingroup product
- * \brief Page des documents joints sur les lots produits
+ * \brief Page of attached documents for porudct lots
*/
require '../../main.inc.php';
@@ -79,7 +79,7 @@ if ($id || $ref)
$object->fetch($id, $productid, $batch);
$object->ref = $object->batch; // For document management ( it use $object->ref)
- if (!empty($conf->productbatch->enabled)) $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, $modulepart).dol_sanitizeFileName($object->ref);
+ if (!empty($conf->productbatch->enabled)) $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart);
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 0c6db4a4a2d..1a276c75f5f 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -352,7 +352,7 @@ foreach ($search as $key => $val)
if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2);
continue;
}
- if ($key == 'fk_user_assign' || $key == 'fk_user_create')
+ if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project')
{
if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2);
continue;
@@ -362,7 +362,7 @@ foreach ($search as $key => $val)
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
-if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
+//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";