mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Can filter proposal on a tag of a product
Enhance also the prototype test_arrays to include select form before table.
This commit is contained in:
parent
e9526066b7
commit
df1dfcbd8a
|
|
@ -56,6 +56,7 @@ $search_refcustomer=GETPOST('search_refcustomer','alpha');
|
|||
$search_societe=GETPOST('search_societe','alpha');
|
||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_author=GETPOST('search_author','alpha');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$viewstatut=$db->escape(GETPOST('viewstatut'));
|
||||
$object_statut=$db->escape(GETPOST('propal_statut'));
|
||||
|
|
@ -91,6 +92,7 @@ if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both
|
|||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_author='';
|
||||
$search_product_category='';
|
||||
$search_town='';
|
||||
$year='';
|
||||
$month='';
|
||||
|
|
@ -145,14 +147,15 @@ if (! $sortorder) $sortorder='DESC';
|
|||
$limit = $conf->liste_limit;
|
||||
|
||||
|
||||
if (! $sall) $sql = 'SELECT';
|
||||
else $sql = 'SELECT DISTINCT';
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
|
@ -190,7 +193,8 @@ if ($search_montant_ht != '')
|
|||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
$sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
|
||||
|
|
@ -223,7 +227,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
$result=$db->query($sql);
|
||||
|
|
@ -265,15 +269,28 @@ if ($result)
|
|||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
||||
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($conf->categorie->enabled && $user->rights->produit->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4357,16 +4357,18 @@ class Form
|
|||
global $conf, $langs;
|
||||
|
||||
// Do we want a multiselect ?
|
||||
$multiselect = 0;
|
||||
if (preg_match('/^multi/',$htmlname)) $multiselect = 1;
|
||||
//$jsbeautify = 0;
|
||||
//if (preg_match('/^multi/',$htmlname)) $jsbeautify = 1;
|
||||
$jsbeautify = 1;
|
||||
|
||||
if ($value_as_key) $array=array_combine($array, $array);
|
||||
|
||||
$out='';
|
||||
|
||||
// Add code for jquery to use multiselect
|
||||
if ($addjscombo && empty($conf->dol_use_jmobile) && $multiselect)
|
||||
if ($addjscombo && empty($conf->dol_use_jmobile) && $jsbeautify)
|
||||
{
|
||||
$minLengthToAutocomplete=0;
|
||||
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT;
|
||||
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -294,3 +294,4 @@ LastUpdated=Last updated
|
|||
CorrectlyUpdated=Correctly updated
|
||||
PropalMergePdfProductActualFile=Files use to add into PDF Azur are/is
|
||||
PropalMergePdfProductChooseFile=Select PDF files
|
||||
IncludingProductWithTag=Including product with tag
|
||||
|
|
@ -148,6 +148,39 @@ print_barre_liste('Title of my list', 3, $_SERVER["PHP_SELF"], '', '', '', 'Text
|
|||
|
||||
?>
|
||||
<table class="liste noborder tagtable centpercent" id="tablelines3">
|
||||
<?php
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('This is a select list for a filter A'). ': ';
|
||||
$cate_arbo = array('field1'=>'value1a into the select list A','field2'=>'value2a');
|
||||
$moreforfilter.=$form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('This is a select list for a filter B'). ': ';
|
||||
$cate_arbo = array('field1'=>'value1b into the select list B','field2'=>'value2b');
|
||||
$moreforfilter.=$form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('This is a select list for a filter C'). ': ';
|
||||
$cate_arbo = array('field1'=>'value1c into the select list C','field2'=>'value2c');
|
||||
$moreforfilter.=$form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('This is a select list for a filter D'). ': ';
|
||||
$cate_arbo = array('field1'=>'value1d into the select list D','field2'=>'value2d');
|
||||
$moreforfilter.=$form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="10">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
?>
|
||||
<tr class="liste_titre">
|
||||
<?php print getTitleFieldOfList($langs->trans('title1'),0,$_SERVER["PHP_SELF"],'aaa','','','align="left"',$sortfield,$sortorder); ?>
|
||||
<?php print getTitleFieldOfList($langs->trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?>
|
||||
|
|
|
|||
|
|
@ -452,6 +452,10 @@ textarea.centpercent {
|
|||
height: 28px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
div.divsearchfield {
|
||||
float: <?php print $left; ?>;
|
||||
margin-<?php print $right; ?>: 12px;
|
||||
}
|
||||
|
||||
/* Style to move picto into left of button */
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user