diff --git a/ChangeLog b/ChangeLog index 9239e16c680..c03d4d3ff90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,21 +8,22 @@ For users: - New: Can filter list of proposal, order or invoice on sales representative. - New: Add supplier ref on supplier orders. - New: Can export supplier orders. -- New: First feature to install external plugins from gui. +- New: First change to install external plugins from gui (experimental). - New: Monaco is like France for default vat calculation -- New: Can list elements (invoices, orders or proposals on a particular +- New: Can list elements (invoices, orders or proposals) on a particular user contact). This allow to view a "basket" of its elements. - New: Add bank account on payment list of invoice card. - New: Cloning project allow to clones task, notes, files, contacts. - New: Enhance default style. - New: Can edit and resiliate member status from list. -- New: Can insert links into elements lines. Also reported into PDF. +- New: Can insert URL links into elements lines. Also reported into PDF. - New: When a member is validated, we can subscribe to mailing-lists according to its type. - New: Add link to third party into sells and purchase journal. - New: Suggest a method to generate a backup file for user with no access to mysqldump binary. - New: Can correct stock of a warehouse from warehouse card. +- New: [ task #454 ] Add "No category" into filters on category. - New: Update language files (de, tr). - Fix: No images into product description lines as PDF generation does not work with this. diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 2b6e2c5747f..838ff19570b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -241,14 +241,15 @@ class FormOther } /** - * Return select list for categories (to use in form search selectors) + * Return select list for categories (to use in form search selectors) * - * @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) - * @param string $selected Preselected value - * @param string $htmlname Name of combo list - * @return string Html combo list code + * @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) + * @param string $selected Preselected value + * @param string $htmlname Name of combo list + * @param int $nocateg Show also an entry "Not categorized" + * @return string Html combo list code */ - function select_categories($type,$selected=0,$htmlname='search_categ') + function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0) { global $langs; require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); @@ -259,8 +260,8 @@ class FormOther // Print a select with each of them $moreforfilter =''; return $moreforfilter; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 662b7859619..1b7109b2a44 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -56,6 +56,7 @@ CompanyHasNoCategory=This company is not in any categories MemberHasNoCategory=This member is not in any categories ClassifyInCategory=Classify in category NoneCategory=None +NotCategorized=Without category CategoryExistsAtSameLevel=This category already exists with this ref ReturnInProduct=Back to product/service card ReturnInSupplier=Back to supplier card diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 484cc8ce9a3..828354477bf 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -56,6 +56,7 @@ CompanyHasNoCategory=Cette société n'est dans aucune catégorie en particulier MemberHasNoCategory=Cet adhérent n'est dans aucune catégorie en particulier ClassifyInCategory=Classer dans la catégorie NoneCategory=Aucune +NotCategorized=Sans catégorie CategoryExistsAtSameLevel=Cette catégorie existe déjà pour cette référence ReturnInProduct=Retour sur la fiche produit/service ReturnInSupplier=Retour sur la fiche fournisseur diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 6663a9f527e..11c9b8eb456 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -128,14 +128,10 @@ else $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; - $sql.= ' FROM ('; - // We'll need this table joined to the select in order to filter by categ - if ($search_categ) $sql.= MAIN_DB_PREFIX."categorie_product as cp, "; - $sql.= MAIN_DB_PREFIX.'product as p'; - $sql.= ') '; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; + if ($search_categ || $catid) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; - if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) @@ -148,9 +144,11 @@ else if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell); if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy); - if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; - if ($catid) $sql.= " AND cp.fk_categorie = ".$catid; - if ($search_categ) $sql.= " AND cp.fk_categorie = ".$search_categ; + if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; + if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; + if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; + if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$search_categ; + if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; $sql.= " p.fk_product_type, p.tms,"; @@ -238,7 +236,7 @@ else if ($conf->categorie->enabled) { $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ'); + $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1); $moreforfilter.='       '; } if ($moreforfilter)