|
@@ -1,11 +1,11 @@
|
|
|
<?php
|
|
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
- * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
+ * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
|
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
|
|
- * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
|
|
- * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
|
+ * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
|
|
+ * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
|
*
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -80,6 +80,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|
|
|
|
|
if ($search_status == '') $search_status=1;
|
|
|
|
|
|
+// List of fields to search into when doing a "search in all"
|
|
|
+$fieldstosearchall = array(
|
|
|
+ 'c.ref'=>'Ref',
|
|
|
+ 'c.ref_customer'=>'RefCustomer',
|
|
|
+ 'c.ref_supplier'=>'RefSupplier',
|
|
|
+ 's.nom'=>"ThirdParty",
|
|
|
+ 'cd.description'=>'Description',
|
|
|
+ 'c.note_public'=>'NotePublic',
|
|
|
+);
|
|
|
+if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
* View
|
|
@@ -93,7 +104,7 @@ $socstatic = new Societe($db);
|
|
|
llxHeader();
|
|
|
|
|
|
$sql = 'SELECT';
|
|
|
-$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,";
|
|
|
+$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
|
|
|
$sql.= " s.nom as name, s.rowid as socid,";
|
|
|
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
|
|
|
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
|
|
@@ -132,7 +143,7 @@ if ($search_sale > 0)
|
|
|
}
|
|
|
|
|
|
if ($sall) {
|
|
|
- $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
|
|
|
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
|
|
}
|
|
|
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
|
|
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
|
|
@@ -149,7 +160,17 @@ if ($resql)
|
|
|
|
|
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
|
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
+ print '<input type="hidden" name="action" value="list">';
|
|
|
+ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
+ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
|
|
|
+ if ($sall)
|
|
|
+ {
|
|
|
+ foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
|
|
+ print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
|
|
+ }
|
|
|
+
|
|
|
// If the user can view prospects other than his'
|
|
|
$moreforfilter='';
|
|
|
if ($user->rights->societe->client->voir || $socid)
|
|
@@ -199,8 +220,9 @@ if ($resql)
|
|
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
|
|
|
|
|
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
|
|
|
- print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
|
|
|
- print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
|
|
|
+ print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
|
|
|
+ print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
|
|
|
+ print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
|
|
|
print_liste_field_titre($langs->trans("SalesRepresentative"), $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
|
|
|
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
|
|
|
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
|
|
@@ -218,10 +240,13 @@ if ($resql)
|
|
|
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
|
|
print '</td>';
|
|
|
print '<td class="liste_titre">';
|
|
|
- print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
|
|
+ print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
|
|
+ print '</td>';
|
|
|
+ print '<td class="liste_titre">';
|
|
|
+ print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
|
|
print '</td>';
|
|
|
print '<td class="liste_titre">';
|
|
|
- print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
|
|
+ print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
|
|
print '</td>';
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
//print '<td class="liste_titre"> </td>';
|
|
@@ -240,6 +265,7 @@ if ($resql)
|
|
|
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
|
|
|
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
|
|
print '</td>';
|
|
|
+ print '<td>'.$obj->ref_customer.'</td>';
|
|
|
print '<td>'.$obj->ref_supplier.'</td>';
|
|
|
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
|
|
//print '<td align="center">'.dol_print_date($obj->datec).'</td>';
|