New: [ task #454 ] Add "No category" into filters on category

combo for product list
This commit is contained in:
Laurent Destailleur 2012-07-18 00:20:33 +02:00
parent 73b17dc4c5
commit ba25905926
5 changed files with 28 additions and 21 deletions

View File

@ -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.

View File

@ -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 ='<select class="flat" name="'.$htmlname.'">';
$moreforfilter.='<option value="">&nbsp;</option>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs))
{
foreach ($tab_categs as $categ)
@ -270,6 +271,11 @@ class FormOther
$moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>';
}
}
if ($nocateg)
{
$langs->load("categories");
$moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected="selected"':'').'>- '.$langs->trans("NotCategorized").' -</option>';
}
$moreforfilter.='</select>';
return $moreforfilter;

View File

@ -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

View File

@ -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

View File

@ -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.=' &nbsp; &nbsp; &nbsp; ';
}
if ($moreforfilter)