Merge pull request #2007 from aspangaro/develop-search
Improvement into list & presentation/typo
This commit is contained in:
commit
5cb6b11878
@ -99,6 +99,13 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi
|
||||
$filterd=$user->id;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter"))
|
||||
{
|
||||
$datestart='';
|
||||
$dateend='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('agendalist'));
|
||||
|
||||
@ -278,8 +285,7 @@ if ($resql)
|
||||
//print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
//print ' ';
|
||||
//print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -323,10 +323,9 @@ if ($result)
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
|
||||
@ -43,9 +43,9 @@ $orderyear=GETPOST("orderyear","int");
|
||||
$ordermonth=GETPOST("ordermonth","int");
|
||||
$deliveryyear=GETPOST("deliveryyear","int");
|
||||
$deliverymonth=GETPOST("deliverymonth","int");
|
||||
$sref=GETPOST('sref','alpha');
|
||||
$sref_client=GETPOST('sref_client','alpha');
|
||||
$snom=GETPOST('snom','alpha');
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_ref_customer=GETPOST('search_ref_customer','alpha');
|
||||
$search_company=GETPOST('search_company','alpha');
|
||||
$sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
@ -69,6 +69,20 @@ $limit = $conf->liste_limit;
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter"))
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_ref_customer='';
|
||||
$search_company='';
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
$deliveryyear='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
@ -81,24 +95,6 @@ $parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
$deliveryyear='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -128,8 +124,8 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql.= ' AND c.entity = '.$conf->entity;
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref) {
|
||||
$sql .= natural_search('c.ref', $sref);
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('c.ref', $search_ref);
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
@ -188,13 +184,13 @@ else if ($deliveryyear > 0)
|
||||
{
|
||||
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
|
||||
}
|
||||
if (!empty($snom))
|
||||
if (!empty($search_company))
|
||||
{
|
||||
$sql .= natural_search('s.nom', $snom);
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if (!empty($sref_client))
|
||||
if (!empty($search_ref_customer))
|
||||
{
|
||||
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
|
||||
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\'';
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
@ -246,15 +242,15 @@ if ($resql)
|
||||
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
|
||||
if ($orderyear) $param.='&orderyear='.$orderyear;
|
||||
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
|
||||
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
|
||||
if ($sref) $param.='&sref='.$sref;
|
||||
if ($snom) $param.='&snom='.$snom;
|
||||
if ($sref_client) $param.='&sref_client='.$sref_client;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
|
||||
if ($orderyear) $param.='&orderyear='.$orderyear;
|
||||
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
|
||||
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
|
||||
if ($search_ref) $param.='&search_ref='.$search_ref;
|
||||
if ($search_company) $param.='&search_company='.$search_company;
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
@ -294,33 +290,35 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="sref" value="'.$sref.'">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="sref_client" value="'.$sref_client.'">';
|
||||
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">';
|
||||
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
|
||||
print '</td><td class="liste_titre">';
|
||||
print '</td><td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
|
||||
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
|
||||
print '</td><td class="liste_titre"> ';
|
||||
print '</td><td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
@ -443,12 +441,12 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// Order date
|
||||
print '<td align="right">';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_commande), 'day');
|
||||
print '</td>';
|
||||
|
||||
// Delivery date
|
||||
print '<td align="right">';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_livraison), 'day');
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ if ($month > 0)
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
@ -357,7 +357,6 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -39,12 +39,11 @@ $langs->load("sendings");
|
||||
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_refsupp=GETPOST('search_refsupp');
|
||||
$search_nom=GETPOST('search_nom');
|
||||
$search_company=GETPOST('search_company');
|
||||
$search_user=GETPOST('search_user');
|
||||
$search_ttc=GETPOST('search_ttc');
|
||||
$sall=GETPOST('search_all');
|
||||
$search_status=GETPOST('search_status','int');
|
||||
if ($search_status == '') $search_status=-1;
|
||||
|
||||
$page = GETPOST('page','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -58,6 +57,18 @@ $orderid = GETPOST('orderid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter"))
|
||||
{
|
||||
$search_ref='';
|
||||
$search_refsupp='';
|
||||
$search_company='';
|
||||
$search_user='';
|
||||
$search_ttc='';
|
||||
$search_status='';
|
||||
}
|
||||
|
||||
if ($search_status == '') $search_status=-1;
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -102,9 +113,9 @@ if ($search_ref)
|
||||
{
|
||||
$sql .= natural_search('cf.ref', $search_ref);
|
||||
}
|
||||
if ($search_nom)
|
||||
if ($search_company)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if ($search_user)
|
||||
{
|
||||
@ -154,13 +165,14 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$param="";
|
||||
if ($search_ref) $param.="&search_ref=".$search_ref;
|
||||
if ($search_nom) $param.="&search_nom=".$search_nom;
|
||||
if ($search_user) $param.="&search_user=".$search_user;
|
||||
if ($search_ttc) $param.="&search_ttc=".$search_ttc;
|
||||
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
if ($search_ref) $param.="&search_ref=".$search_ref;
|
||||
if ($search_company) $param.="&search_company=".$search_company;
|
||||
if ($search_user) $param.="&search_user=".$search_user;
|
||||
if ($search_ttc) $param.="&search_ttc=".$search_ttc;
|
||||
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -180,7 +192,7 @@ if ($resql)
|
||||
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ref" value="'.$search_ref.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_refsupp" value="'.$search_refsupp.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$search_nom.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.$search_company.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_user" value="'.$search_user.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ttc" value="'.$search_ttc.'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -188,10 +200,9 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formorder->selectSupplierOrderStatus($search_status,1,'search_status');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
@ -510,7 +510,7 @@ else
|
||||
$product_static->status_buy = $objp->tobuy;
|
||||
$product_static->status = $objp->tosell;
|
||||
// Status (to sell)
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
|
||||
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
|
||||
} else {
|
||||
@ -519,7 +519,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
|
||||
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
|
||||
} else {
|
||||
|
||||
@ -461,7 +461,6 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user