New: [ task #90 ] Barcode search

This commit is contained in:
Laurent Destailleur 2013-09-16 17:10:49 +02:00
parent 01fb596555
commit 921777449f
3 changed files with 49 additions and 23 deletions

View File

@ -40,21 +40,22 @@ For users:
- New: Add Maghreb regions and departments.
- New: A more responsive desgin for statistic box of home page.
- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode
- New: [ task #1014 ] Add option to recursivly add parent category
- New: [ task #1016 ] Can define a specific numbering for deposits
- New: [ task #918 ] Stock replenishment
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count
- New: Add pdf link into supplier invoice list and supplier order list
- New: Genrate auto the PDF for supplier invoice
- New: Add category into filter webservice thirdparty method getListOfThirdParties
- New: Allow to define margin or mark rate during quoting, ordering, invoicing
- New: User permissions on margin module
- New: Add ref supplier into muscadet model
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering.
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode.
- New: [ task #1014 ] Add option to recursivly add parent category.
- New: [ task #1016 ] Can define a specific numbering for deposits.
- New: [ task #918 ] Stock replenishment.
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
- New: Add pdf link into supplier invoice list and supplier order list.
- New: Genrate auto the PDF for supplier invoice.
- New: Add category into filter webservice thirdparty method getListOfThirdParties.
- New: Allow to define margin or mark rate during quoting, ordering, invoicing.
- New: User permissions on margin module.
- New: Add ref supplier into muscadet model.
- New: Can use tag {mm} before {yy} even when there is a reset into numbering masks.
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables
- New: [ task #923 ] Localtax support for ODT templates
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables.
- New: [ task #923 ] Localtax support for ODT templates.
- New: [ task #90 ] Barcode search.
For translators:
- Qual: Normalized sort order of all languages files with english reference files.

View File

@ -58,6 +58,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
* Search area
*/
$rowspan=2;
if (! empty($conf->barcode->enabled)) $rowspan++;
print '<form method="post" action="'.DOL_URL_ROOT.'/societe/societe.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';

View File

@ -41,6 +41,7 @@ $result = restrictedArea($user,'societe',$socid,'');
$search_nom=trim(GETPOST("search_nom"));
$search_nom_only=trim(GETPOST("search_nom_only"));
$search_all=trim(GETPOST("search_all"));
$sbarcode=trim(GETPOST("sbarcode"));
$search_town=trim(GETPOST("search_town"));
$socname=trim(GETPOST("socname"));
$search_idprof1=trim(GETPOST('search_idprof1'));
@ -70,7 +71,7 @@ $pagenext = $page + 1;
* Actions
*/
// Recherche
// special search
if ($mode == 'search')
{
$search_nom=$socname;
@ -122,7 +123,11 @@ if ($mode == 'search')
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
if (!empty($conf->barcode->enabled))
{
$sql.= "AND s.barcode LIKE '".$db->escape($crit)."'";
}
$result=$db->query($sql);
if ($result)
{
@ -158,6 +163,7 @@ if (GETPOST("button_removefilter_x"))
$search_sale='';
$socname="";
$search_nom="";
$sbarcode="";
$search_town="";
$search_idprof1='';
$search_idprof2='';
@ -185,7 +191,7 @@ if ($socname)
*/
$title=$langs->trans("ListOfThirdParties");
$sql = "SELECT s.rowid, s.nom as name, s.town, s.datec, s.datea,";
$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.datea,";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
@ -250,6 +256,7 @@ if ($search_idprof6) $sql .= " AND s.idprof6 LIKE '%".$db->escape($search_idprof
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
if (!empty($conf->barcode->enabled) && $sbarcode) $sql.= " AND s.barcode LIKE '%".$db->escape($sbarcode)."%'";
//print $sql;
// Count total nb of records
@ -270,6 +277,7 @@ if ($resql)
$i = 0;
$params = "&amp;socname=".$socname."&amp;search_nom=".$search_nom."&amp;search_town=".$search_town;
$params.= ($sbarcode?"&amp;sbarcode=".$sbarcode:"");
$params.= '&amp;search_idprof1='.$search_idprof1;
$params.= '&amp;search_idprof2='.$search_idprof2;
$params.= '&amp;search_idprof3='.$search_idprof3;
@ -328,6 +336,7 @@ if ($resql)
// Lines of titles
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$params,"",$sortfield,$sortorder);
if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$params,'',$sortfield,$sortorder);
print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$params,'class="nowrap"',$sortfield,$sortorder);
print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$params,'class="nowrap"',$sortfield,$sortorder);
@ -344,24 +353,33 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
print '<input class="flat" type="text" name="search_nom" value="'.$search_nom.'">';
print '</td><td class="liste_titre">';
print '</td>';
// Barcode
if (! empty($conf->barcode->enabled))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
print '</td>';
}
// Town
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_town" value="'.$search_town.'">';
print '</td>';
// IdProf1
print '<td class="liste_titre">';
print '<input class="flat" size="8" type="text" name="search_idprof1" value="'.$search_idprof1.'">';
print '<input class="flat" size="4" type="text" name="search_idprof1" value="'.$search_idprof1.'">';
print '</td>';
// IdProf2
print '<td class="liste_titre">';
print '<input class="flat" size="8" type="text" name="search_idprof2" value="'.$search_idprof2.'">';
print '<input class="flat" size="4" type="text" name="search_idprof2" value="'.$search_idprof2.'">';
print '</td>';
// IdProf3
print '<td class="liste_titre">';
print '<input class="flat" size="8" type="text" name="search_idprof3" value="'.$search_idprof3.'">';
print '<input class="flat" size="4" type="text" name="search_idprof3" value="'.$search_idprof3.'">';
print '</td>';
// IdProf4
print '<td class="liste_titre">';
print '<input class="flat" size="8" type="text" name="search_idprof4" value="'.$search_idprof4.'">';
print '<input class="flat" size="4" type="text" name="search_idprof4" value="'.$search_idprof4.'">';
print '</td>';
// Type (customer/prospect/supplier)
print '<td class="liste_titre" align="middle">';
@ -387,7 +405,8 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var]."><td>";
print "<tr ".$bc[$var].">";
print "<td>";
$companystatic->id=$obj->rowid;
$companystatic->name=$obj->name;
$companystatic->canvas=$obj->canvas;
@ -395,6 +414,11 @@ if ($resql)
$companystatic->status=$obj->status;
print $companystatic->getNomUrl(1,'',100);
print "</td>\n";
// Barcode
if (! empty($conf->barcode->enabled))
{
print '<td>'.$objp->barcode.'</td>';
}
print "<td>".$obj->town."</td>\n";
print "<td>".$obj->idprof1."</td>\n";
print "<td>".$obj->idprof2."</td>\n";