diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php
index d4beb3ecdd9..a4b9bdb7a5a 100644
--- a/htdocs/adherents/liste.php
+++ b/htdocs/adherents/liste.php
@@ -256,9 +256,9 @@ if ($resql)
print '
';
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index ac5b825b421..d733182f054 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -188,7 +188,7 @@ if ($result)
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 9f4be55eb40..7e990e602c9 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -571,6 +571,48 @@ class Categorie
}
}
+ /**
+ * check for the presence of an object in a category
+ * @param string $type object type
+ * @param int $object_id id of the object to search
+ * @return int nb number of occurrences
+ */
+ function containsObject($type, $object_id)
+ {
+ $field = ''; $classname = ''; $category_table = ''; $object_table = '';
+ if ($type == 'product') {
+ $field = 'product';
+ }
+ if ($type == 'customer') {
+ $field = 'societe';
+ }
+ if ($type == 'supplier') {
+ $field = 'societe';
+ $category_table = 'fournisseur';
+ }
+ if ($type == 'member') {
+ $field = 'member';
+ $category_table = '';
+ }
+ if ($type == 'contact') {
+ $field = 'socpeople';
+ $category_table = 'contact';
+ }
+ if (empty($category_table)) {
+ $category_table = $field;
+ }
+ $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table;
+ $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id;
+ dol_syslog(get_class($this)."::containsObject sql=".$sql);
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ return $this->db->fetch_object($resql)->nb;
+ } else {
+ $this->error=$this->db->error().' sql='.$sql;
+ dol_syslog(get_class($this)."::containsObject ".$this->error, LOG_ERR);
+ return -1;
+ }
+ }
/**
* Return childs of a category
diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php
index 5c85f745def..7f9d7ede440 100644
--- a/htdocs/comm/contact.php
+++ b/htdocs/comm/contact.php
@@ -141,7 +141,7 @@ if ($resql)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print "\n";
print '';
diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php
index ed12edd032a..4e6ac38c810 100644
--- a/htdocs/comm/list.php
+++ b/htdocs/comm/list.php
@@ -233,9 +233,9 @@ if ($result)
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
$parameters=array();
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 5b3ec5bfc1d..916a6163668 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -434,9 +434,9 @@ if ($object->fetch($id) >= 0)
print '';
// Source
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index 3510df7339e..8d7f3ea988a 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -1080,7 +1080,7 @@ else
{
$out.= '';
$out.= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
- $out.= ' ';
+ $out.= ' ';
$out.= '
';
}
}
diff --git a/htdocs/comm/mailing/liste.php b/htdocs/comm/mailing/liste.php
index 41a4e57a7ac..81af4f4f6e6 100644
--- a/htdocs/comm/mailing/liste.php
+++ b/htdocs/comm/mailing/liste.php
@@ -121,7 +121,7 @@ if ($result)
print ' ';
if (! $filteremail) print ' ';
print ' ';
- print ' ';
+ print ' ';
print " ";
print "\n";
print '';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 262ccbfe91e..7a652631d67 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -309,7 +309,7 @@ if ($result)
print '';
$formpropal->select_propal_statut($viewstatut,1);
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 18038d3ed44..767a29f0b88 100644
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -378,7 +378,7 @@ if ($resql)
// Print the search button
print '';
- print ' ';
+ print ' ';
print ' ';
$parameters=array();
diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php
index 35a5891d604..373775a0da0 100644
--- a/htdocs/commande/customer.php
+++ b/htdocs/commande/customer.php
@@ -142,7 +142,7 @@ if ($resql)
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index aaf6b5312ae..c4a416f1898 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -301,7 +301,7 @@ if ($resql)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
$var=true;
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 806fd95a957..aa2883ccb96 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -603,7 +603,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs))
//SEARCH BUTTON
print '';
- print ' ';
+ print ' ';
//ALL/NONE
print ' ';
diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 319ba7ab9d9..d85d6ff3b27 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -422,7 +422,7 @@ if ($id > 0 || ! empty($ref))
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print "\n";
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index 650733dbb9c..a94e2fc5cd0 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -184,7 +184,7 @@ if ($resql)
print '';
print ' ';
if (! empty($_REQUEST['bid'])) print ' ';
- print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php
index f54f893d79c..4f6719adb14 100644
--- a/htdocs/compta/clients.php
+++ b/htdocs/compta/clients.php
@@ -173,7 +173,7 @@ if ($resql)
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index 330f493e6ba..94a3a26a0f3 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -119,7 +119,7 @@ if ($resql)
print '';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print " \n";
$var=true;
diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php
index 56c66d4fdce..f045e82be71 100644
--- a/htdocs/compta/dons/liste.php
+++ b/htdocs/compta/dons/liste.php
@@ -144,7 +144,7 @@ if ($resql)
print '';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print " \n";
$var=True;
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 3d792e343f0..d1750755835 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -299,7 +299,7 @@ if ($resql)
print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").' ';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 83b9fd30945..42d08c3b02c 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -317,7 +317,7 @@ if ($resql)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print " \n";
if ($num > 0)
diff --git a/htdocs/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/liste.php
index 1c1cf71b11c..7f656a75c79 100644
--- a/htdocs/compta/paiement/cheque/liste.php
+++ b/htdocs/compta/paiement/cheque/liste.php
@@ -102,7 +102,7 @@ if ($resql)
print ' ';
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php
index 5e1653b3ec3..16a6c1410e6 100644
--- a/htdocs/compta/paiement/liste.php
+++ b/htdocs/compta/paiement/liste.php
@@ -167,7 +167,7 @@ if ($resql)
print '';
print '';
print ' ';
- print ' ';
+ print ' ';
print ' ';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index d5c140be91e..cd460f1aac2 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -88,7 +88,7 @@ if ($result)
print '';
print '';
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index 3ae2b850aac..e4889645869 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -114,7 +114,7 @@ if ($resql)
print '';
diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php
index 5ed627dee58..2cd859969a9 100644
--- a/htdocs/compta/prelevement/liste.php
+++ b/htdocs/compta/prelevement/liste.php
@@ -129,7 +129,7 @@ if ($result)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print '';
print '';
diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php
index 54cb9fc0c42..e96c5389529 100644
--- a/htdocs/compta/sociales/index.php
+++ b/htdocs/compta/sociales/index.php
@@ -162,7 +162,7 @@ if ($resql)
print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index e24ca5dd56b..ac82e2e342a 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -252,7 +252,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
print '>';
print '';
- print ' ';
+ print ' ';
print ' ';
// Array header
print "";
diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index 97333f1758c..9745ef16290 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -322,7 +322,7 @@ if ($subcat) {
}
print'>';
print '';
-print ' ';
+print ' ';
print ' ';
print ' ';
// Array titles
diff --git a/htdocs/compta/ventilation/lignes.php b/htdocs/compta/ventilation/lignes.php
index e8578e7dcf0..fbc86557178 100644
--- a/htdocs/compta/ventilation/lignes.php
+++ b/htdocs/compta/ventilation/lignes.php
@@ -90,7 +90,7 @@ if ($result)
print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 2b1c5e982df..1c735d787b4 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -343,9 +343,9 @@ if ($result)
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php
index 40a6811e41b..38576f7e764 100644
--- a/htdocs/contrat/liste.php
+++ b/htdocs/contrat/liste.php
@@ -129,7 +129,7 @@ if ($resql)
print '';
print ' ';
//print ' ';
- print ' ';
+ print ' ';
print " ";
print "\n";
print '';
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index ea42df9e01d..2f42fc39c77 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -184,7 +184,7 @@ if ($resql)
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
print $form->select_date($filter_date2,'op2',0,0,1);
print '';
- print ' ';
+ print ' ';
print " ";
print "\n";
print '';
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index bcd6c53d489..a81eff0e5c3 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -630,7 +630,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
// Edit
print '';
- print ' ';
+ print ' ';
print ' ';
print "";
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index 8d27450eaf8..19a0d5cc3b1 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -182,9 +182,9 @@ print '';
print $form->selectarray('status', array('0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")), $status, 1);
print ' ';
print ' ';
-print ' ';
+print ' ';
print ' ';
-print ' ';
+print ' ';
print ' ';
print '';
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 93142ed2dc3..2a037a07563 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -124,7 +124,7 @@ if ($result)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print "\n";
$companystatic=new Societe($db);
diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php
index bc4004e4fc1..d6c4bb9427d 100644
--- a/htdocs/fourn/commande/liste.php
+++ b/htdocs/fourn/commande/liste.php
@@ -152,7 +152,7 @@ if ($resql)
print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index bc7632350c1..dd8d778d63a 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -235,7 +235,7 @@ if ($resql)
print '';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index f625cead27c..8f3f2909832 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -463,7 +463,7 @@ if (empty($action))
print '';
print '';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/fourn/liste.php b/htdocs/fourn/liste.php
index f59e692fb87..5ce488939b3 100644
--- a/htdocs/fourn/liste.php
+++ b/htdocs/fourn/liste.php
@@ -183,7 +183,7 @@ if ($resql)
print ' ';
print '';
- print ' ';
+ print ' ';
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php
index 7806fdab1bd..76c34be7034 100644
--- a/htdocs/fourn/product/liste.php
+++ b/htdocs/fourn/product/liste.php
@@ -200,9 +200,9 @@ if ($resql)
print ' ';
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print '';
print '';
diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php
index 34443bfaa98..e7c4b0a3d50 100644
--- a/htdocs/holiday/index.php
+++ b/htdocs/holiday/index.php
@@ -326,7 +326,7 @@ print '';
// ACTION
print '';
-print ' ';
+print ' ';
print ' ';
print "\n";
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index e9fe0b60a03..28330586070 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -370,8 +370,8 @@ else
print '';
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php
index 00793b2ff8a..fcbcd780fb6 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -274,8 +274,8 @@ if ($resql)
print ' ';
print ' ';
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php
index eb9391c8698..f8135b69566 100644
--- a/htdocs/product/stock/mouvement.php
+++ b/htdocs/product/stock/mouvement.php
@@ -452,9 +452,9 @@ if ($resql)
print ' ';
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
print '';
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 788bd8fee09..887a23ac0bc 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -176,7 +176,7 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.price,';
$sql.= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
$sql.= ' p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' p.desiredstock,';
-$sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").') as stock_physique';
+$sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
$sql.= ' ON p.rowid = s.fk_product';
@@ -219,7 +219,7 @@ $sql.= ' HAVING p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel
$sql.= ' AND p.desiredstock > 0';
if ($salert == 'on') // Option to see when stock is lower than alert
{
- $sql .= ' AND SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").') < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL';
+ $sql .= ' AND SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL';
$alertchecked = 'checked="checked"';
}
$sql.= $db->order($sortfield,$sortorder);
@@ -412,10 +412,8 @@ print ' '.
' '.
' '.
''.
- ' theme . '/img/search.png" alt="' . $langs->trans("Search") . '">'.
- ' '.
+ ' '.
+ ' '.
' '.
'';
@@ -611,4 +609,4 @@ function toggle(source)
llxFooter();
$db->close();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php
index a81a21c6c9b..974f7f5ef00 100644
--- a/htdocs/projet/liste.php
+++ b/htdocs/projet/liste.php
@@ -142,7 +142,7 @@ if ($resql)
print ' ';
print '';
print ' ';
- print ' ';
+ print ' ';
print "\n";
while ($i < $num)
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index 8795cf98486..8c626175d3d 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -116,7 +116,7 @@ print '';
print '';
print ' ';
print ' ';
-print ' ';
+print ' ';
print "\n";
// Show all lines in taskarray (recursive function to go down on tree)
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 03036f36a04..d7c8616a273 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -269,8 +269,8 @@ print '';
print ' ';
print ' ';
print '';
-print ' ';
-print ' ';
+print ' ';
+print ' ';
print ' ';
print '';
diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php
index bf21bfecfa7..7d3e2e1a78d 100644
--- a/htdocs/societe/societe.php
+++ b/htdocs/societe/societe.php
@@ -389,9 +389,9 @@ if ($resql)
print '';
// Status
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print "\n";
diff --git a/htdocs/user/index.php b/htdocs/user/index.php
index 62ead1935eb..baa704509cc 100644
--- a/htdocs/user/index.php
+++ b/htdocs/user/index.php
@@ -126,7 +126,7 @@ if ($result)
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print "\n";