Remove 2 other duplicated pages. There is only one page now for all list
of thirdarties (with a parameter type to have it specialized per customer, prospect or supplier profile).
This commit is contained in:
parent
90a221ef6d
commit
8d24adc97e
@ -1,348 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2004-2011 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) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is freei software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/comm/list.php
|
|
||||||
* \ingroup commercial societe
|
|
||||||
* \brief List of customers
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("customers");
|
|
||||||
$langs->load("suppliers");
|
|
||||||
$langs->load("commercial");
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOST('socid','int');
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
|
||||||
$result = restrictedArea($user,'societe',$socid,'');
|
|
||||||
|
|
||||||
$sortfield = GETPOST('sortfield','alpha');
|
|
||||||
$sortorder = GETPOST('sortorder','alpha');
|
|
||||||
$page=GETPOST('page','int');
|
|
||||||
if ($page == -1) { $page = 0 ; }
|
|
||||||
$offset = $conf->liste_limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="s.nom";
|
|
||||||
|
|
||||||
$search_company = GETPOST("search_company");
|
|
||||||
$search_zipcode = GETPOST("search_zipcode");
|
|
||||||
$search_town = GETPOST("search_town");
|
|
||||||
$search_code = GETPOST("search_code");
|
|
||||||
$search_compta = GETPOST("search_compta");
|
|
||||||
$search_status = GETPOST("search_status",'int');
|
|
||||||
$search_country = GETPOST("search_country",'int');
|
|
||||||
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
|
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
|
||||||
|
|
||||||
// Load sale and categ filters
|
|
||||||
$search_sale = GETPOST("search_sale",'int');
|
|
||||||
$search_categ = GETPOST("search_categ",'int');
|
|
||||||
$catid = GETPOST("catid",'int');
|
|
||||||
// If the internal user must only see his customers, force searching by him
|
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
|
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
|
||||||
$hookmanager->initHooks(array('customerlist'));
|
|
||||||
$extrafields = new ExtraFields($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$search_sale="";
|
|
||||||
$search_categ="";
|
|
||||||
$catid="";
|
|
||||||
$search_company="";
|
|
||||||
$search_zipcode="";
|
|
||||||
$search_town="";
|
|
||||||
$search_code='';
|
|
||||||
$search_compta='';
|
|
||||||
$search_status='';
|
|
||||||
$search_country="";
|
|
||||||
$search_type_thirdparty='';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* view
|
|
||||||
*/
|
|
||||||
|
|
||||||
$formother=new FormOther($db);
|
|
||||||
$form = new Form($db);
|
|
||||||
$thirdpartystatic=new Societe($db);
|
|
||||||
$formcompany=new FormCompany($db);
|
|
||||||
|
|
||||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
|
||||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
|
||||||
|
|
||||||
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
|
|
||||||
$sql.= " s.datec, s.canvas";
|
|
||||||
$sql.= ",s.fk_pays";
|
|
||||||
$sql.= ",typent.code as typent_code";
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
|
||||||
// Add fields for extrafields
|
|
||||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
|
||||||
// Add fields from hooks
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
$sql.=$hookmanager->resPrint;
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
|
||||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
|
||||||
$sql.= " AND s.client IN (1, 3)";
|
|
||||||
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc";
|
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
|
||||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
|
||||||
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
|
||||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
|
||||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
|
||||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
|
||||||
if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company);
|
|
||||||
if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode);
|
|
||||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
|
||||||
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
|
|
||||||
if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta);
|
|
||||||
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
|
|
||||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
|
||||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
|
||||||
if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale;
|
|
||||||
// Add where from hooks
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
$sql.=$hookmanager->resPrint;
|
|
||||||
|
|
||||||
// Count total nb of records
|
|
||||||
$nbtotalofrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
|
||||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
|
||||||
|
|
||||||
dol_syslog('comm/list.php:', LOG_DEBUG);
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
$param = "&search_company=".htmlspecialchars($search_company);
|
|
||||||
$param.="&search_code=".htmlspecialchars($search_code);
|
|
||||||
$param.="&search_zipcode=".htmlspecialchars($search_zipcode);
|
|
||||||
$param.="&search_town=".htmlspecialchars($search_town);
|
|
||||||
if ($search_categ != '') $param.='&search_categ='.htmlspecialchars($search_categ);
|
|
||||||
if ($search_sale > 0) $param.='&search_sale='.htmlspecialchars($search_sale);
|
|
||||||
if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status);
|
|
||||||
if ($search_country != '') $param.='&search_country='.htmlspecialchars($search_country);
|
|
||||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.htmlspecialchars($search_type_thirdparty);
|
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
||||||
|
|
||||||
// Filter on categories
|
|
||||||
$moreforfilter='';
|
|
||||||
if (! empty($conf->categorie->enabled))
|
|
||||||
{
|
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
|
||||||
$moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1);
|
|
||||||
$moreforfilter.='</div>';
|
|
||||||
}
|
|
||||||
// If the user can view prospects other than his'
|
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
|
||||||
{
|
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
|
||||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
|
||||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
|
||||||
$moreforfilter.='</div>';
|
|
||||||
}
|
|
||||||
if ($moreforfilter)
|
|
||||||
{
|
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
||||||
print $moreforfilter;
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_zipcode" value="'.$search_zipcode.'" size="10">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_town" value="'.$search_town.'" size="10">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_code" value="'.$search_code.'" size="10">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td align="left" class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_compta" value="'.$search_compta.'" size="10">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print ' ';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
|
||||||
print '</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 '<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";
|
|
||||||
|
|
||||||
|
|
||||||
$var=True;
|
|
||||||
|
|
||||||
while ($i < min($num,$conf->liste_limit))
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
|
||||||
print '<td>';
|
|
||||||
$thirdpartystatic->id=$obj->rowid;
|
|
||||||
$thirdpartystatic->name=$obj->name;
|
|
||||||
$thirdpartystatic->client=$obj->client;
|
|
||||||
$thirdpartystatic->code_client=$obj->code_client;
|
|
||||||
$thirdpartystatic->canvas=$obj->canvas;
|
|
||||||
$thirdpartystatic->status=$obj->status;
|
|
||||||
$thirdpartystatic->name_alias=$obj->name_alias;
|
|
||||||
print $thirdpartystatic->getNomUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$obj->zip.'</td>';
|
|
||||||
print '<td>'.$obj->town.'</td>';
|
|
||||||
//Country
|
|
||||||
print '<td align="center">';
|
|
||||||
$tmparray=getCountry($obj->fk_pays,'all');
|
|
||||||
print $tmparray['label'];
|
|
||||||
print '</td>';
|
|
||||||
//Type ent
|
|
||||||
print '<td align="center">';
|
|
||||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
|
||||||
print $typenArray[$obj->typent_code];
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$obj->code_client.'</td>';
|
|
||||||
print '<td>'.$obj->code_compta.'</td>';
|
|
||||||
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
|
||||||
|
|
||||||
$parameters=array('obj' => $obj);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td></td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$db->free($result);
|
|
||||||
|
|
||||||
$parameters=array('sql' => $sql);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print "</table>\n";
|
|
||||||
print "</form>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -1,613 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
|
||||||
* Copyright (C) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/comm/prospect/list.php
|
|
||||||
* \ingroup prospect
|
|
||||||
* \brief Page to list prospects
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
$langs->load("propal");
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOST("socid",'int');
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
|
||||||
$result = restrictedArea($user, 'societe',$socid,'');
|
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
|
||||||
$socname = GETPOST("socname",'alpha');
|
|
||||||
$stcomm = GETPOST("stcomm",'alpha'); // code
|
|
||||||
$search_stcomm = GETPOST("search_stcomm",'int');
|
|
||||||
$search_nom = GETPOST("search_nom");
|
|
||||||
$search_zipcode = GETPOST("search_zipcode");
|
|
||||||
$search_town = GETPOST("search_town");
|
|
||||||
$search_state = GETPOST("search_state");
|
|
||||||
$search_datec = GETPOST("search_datec");
|
|
||||||
$search_categ = GETPOST("search_categ",'int');
|
|
||||||
$search_status = GETPOST("search_status",'int');
|
|
||||||
$catid = GETPOST("catid",'int');
|
|
||||||
$search_country = GETPOST("search_country",'int');
|
|
||||||
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
|
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
|
||||||
$page = GETPOST("page",'int');
|
|
||||||
if ($page == -1) { $page = 0; }
|
|
||||||
$offset = $conf->liste_limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="s.nom";
|
|
||||||
|
|
||||||
$search_level_from = GETPOST("search_level_from","alpha");
|
|
||||||
$search_level_to = GETPOST("search_level_to","alpha");
|
|
||||||
|
|
||||||
// If both parameters are set, search for everything BETWEEN them
|
|
||||||
if ($search_level_from != '' && $search_level_to != '')
|
|
||||||
{
|
|
||||||
// Ensure that these parameters are numbers
|
|
||||||
$search_level_from = (int) $search_level_from;
|
|
||||||
$search_level_to = (int) $search_level_to;
|
|
||||||
|
|
||||||
// If from is greater than to, reverse orders
|
|
||||||
if ($search_level_from > $search_level_to)
|
|
||||||
{
|
|
||||||
$tmp = $search_level_to;
|
|
||||||
$search_level_to = $search_level_from;
|
|
||||||
$search_level_from = $tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the SQL request
|
|
||||||
$sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range';
|
|
||||||
}
|
|
||||||
// If only "from" parameter is set, search for everything GREATER THAN it
|
|
||||||
else if ($search_level_from != '')
|
|
||||||
{
|
|
||||||
// Ensure that this parameter is a number
|
|
||||||
$search_level_from = (int) $search_level_from;
|
|
||||||
|
|
||||||
// Generate the SQL request
|
|
||||||
$sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range';
|
|
||||||
}
|
|
||||||
// If only "to" parameter is set, search for everything LOWER THAN it
|
|
||||||
else if ($search_level_to != '')
|
|
||||||
{
|
|
||||||
// Ensure that this parameter is a number
|
|
||||||
$search_level_to = (int) $search_level_to;
|
|
||||||
|
|
||||||
// Generate the SQL request
|
|
||||||
$sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range';
|
|
||||||
}
|
|
||||||
// If no parameters are set, dont search for anything
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sortwhere = '0 as is_in_range';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
|
||||||
dol_syslog('prospects::prospects_prospect_level',LOG_DEBUG);
|
|
||||||
$sql = "SELECT code, label, sortorder, ".$sortwhere;
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
|
||||||
$sql.= " WHERE active > 0";
|
|
||||||
$sql.= " ORDER BY sortorder";
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$tab_level = array();
|
|
||||||
$search_levels = array();
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql))
|
|
||||||
{
|
|
||||||
// Compute level text
|
|
||||||
$level=$langs->trans($obj->code);
|
|
||||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
|
||||||
|
|
||||||
// Put it in the array sorted by sortorder
|
|
||||||
$tab_level[$obj->sortorder] = $level;
|
|
||||||
|
|
||||||
// If this potentiel fit in parameters, add its code to the $search_levels array
|
|
||||||
if ($obj->is_in_range == 1)
|
|
||||||
{
|
|
||||||
$search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
|
|
||||||
// If no paramters was set, $search_levels will be empty
|
|
||||||
$search_levels = implode(',', $search_levels);
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
// Load sale and categ filters
|
|
||||||
$search_sale = GETPOST('search_sale','int');
|
|
||||||
$search_categ = GETPOST('search_categ','int');
|
|
||||||
// If the internal user must only see his prospect, force searching by him
|
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
|
|
||||||
|
|
||||||
// List of available states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
|
|
||||||
$sts = array(-1,0,1,2,3);
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
|
||||||
$contextpage='prospectlist';
|
|
||||||
$hookmanager->initHooks(array($contextpage));
|
|
||||||
$extrafields = new ExtraFields($db);
|
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
|
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$socname="";
|
|
||||||
$stcomm="";
|
|
||||||
$search_stcomm="";
|
|
||||||
$search_nom="";
|
|
||||||
$search_zipcode="";
|
|
||||||
$search_town="";
|
|
||||||
$search_state="";
|
|
||||||
$search_datec="";
|
|
||||||
$search_categ="";
|
|
||||||
$search_status="";
|
|
||||||
$search_country="";
|
|
||||||
$search_type_thirdparty="";
|
|
||||||
$search_array_options=array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($search_status=='') $search_status=1; // always display active customer first
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
if ($action == 'setstcomm')
|
|
||||||
{
|
|
||||||
$object = new Client($db);
|
|
||||||
$result=$object->fetch($socid);
|
|
||||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
|
||||||
$result=$object->set_commnucation_level($user);
|
|
||||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
|
||||||
|
|
||||||
$action=''; $socid=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$formother=new FormOther($db);
|
|
||||||
$form=new Form($db);
|
|
||||||
$formcompany=new FormCompany($db);
|
|
||||||
$prospectstatic=new Client($db);
|
|
||||||
$prospectstatic->client=2;
|
|
||||||
$prospectstatic->loadCacheOfProspStatus();
|
|
||||||
|
|
||||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
|
|
||||||
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
|
|
||||||
$sql.= " st.libelle as stcomm_label,";
|
|
||||||
$sql.= " d.nom as departement";
|
|
||||||
$sql.= " ,s.fk_pays";
|
|
||||||
$sql.= " ,typent.code as typent_code";
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
|
||||||
// Add fields for extrafields
|
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
|
||||||
// Add fields from hooks
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
$sql.=$hookmanager->resPrint;
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
|
|
||||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
|
||||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
|
||||||
$sql.= " AND s.client IN (2, 3)";
|
|
||||||
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
|
|
||||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
|
|
||||||
if ($socid) $sql.= " AND s.rowid = " .$socid;
|
|
||||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
|
||||||
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
|
||||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
|
||||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
|
||||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
|
||||||
if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom);
|
|
||||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
|
|
||||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
|
||||||
if ($search_state) $sql .= natural_search('d.nom', $search_state);
|
|
||||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
|
||||||
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
|
|
||||||
// Insert levels filters
|
|
||||||
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
|
||||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
|
||||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
|
||||||
// Insert sale filter
|
|
||||||
if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
|
|
||||||
if ($socname)
|
|
||||||
{
|
|
||||||
$sql .= natural_search('s.nom', $search_nom);
|
|
||||||
$sortfield = "s.nom";
|
|
||||||
$sortorder = "ASC";
|
|
||||||
}
|
|
||||||
// Add where from extra fields
|
|
||||||
foreach ($search_array_options as $key => $val)
|
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
|
||||||
$mode=0;
|
|
||||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
|
||||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
|
||||||
{
|
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add where from hooks
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
$sql.=$hookmanager->resPrint;
|
|
||||||
// Count total nb of records
|
|
||||||
$nbtotalofrecords = 0;
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
|
|
||||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
if ($num == 1 && $socname)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
header("Location: card.php?socid=".$obj->socid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
|
||||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
|
||||||
}
|
|
||||||
|
|
||||||
$param='&search_stcomm='.$search_stcomm;
|
|
||||||
$param.='&search_nom='.urlencode($search_nom);
|
|
||||||
$param.='&search_zipcode='.urlencode($search_zipcode);
|
|
||||||
$param.='&search_town='.urlencode($search_town);
|
|
||||||
// Store the status filter in the URL
|
|
||||||
if (isSet($search_setstcomm))
|
|
||||||
{
|
|
||||||
foreach ($search_setstcomm as $key => $value)
|
|
||||||
{
|
|
||||||
if ($value == 'true')
|
|
||||||
$param.='&search_setstcomm['.((int) $key).']=true';
|
|
||||||
else
|
|
||||||
$param.='&search_setstcomm['.((int) $key).']=false';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
|
||||||
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
|
||||||
if ($search_categ != '') $param.='&search_categ='.urlencode($search_categ);
|
|
||||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
|
||||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
|
||||||
if ($search_country != '') $param.='&search_country='.$search_country;
|
|
||||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.$search_type_thirdparty;
|
|
||||||
// Add $param from extra fields
|
|
||||||
foreach ($search_array_options as $key => $val)
|
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
|
|
||||||
|
|
||||||
|
|
||||||
// Print the search-by-sale and search-by-categ filters
|
|
||||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
|
|
||||||
// Filter on categories
|
|
||||||
$moreforfilter='';
|
|
||||||
if (! empty($conf->categorie->enabled))
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
|
||||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
|
|
||||||
$moreforfilter.='</div>';
|
|
||||||
}
|
|
||||||
// If the user can view prospects other than his'
|
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
|
||||||
{
|
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
|
||||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
|
||||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
|
||||||
$moreforfilter.='</div>';
|
|
||||||
}
|
|
||||||
if ($moreforfilter)
|
|
||||||
{
|
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
||||||
print $moreforfilter;
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"s.fk_departement","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre('');
|
|
||||||
|
|
||||||
// Extrafields
|
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_list as $key => $val)
|
|
||||||
{
|
|
||||||
if ($val)
|
|
||||||
{
|
|
||||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_nom" size="10" value="'.$search_nom.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_zipcode" size="6" value="'.$search_zipcode.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" class="flat" name="search_town" size="8" value="'.$search_town.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print '<input type="text" class="flat" name="search_state" size="8" value="'.$search_state.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="center" class="liste_titre">';
|
|
||||||
print '<input class="flat" type="text" size="6" name="search_datec" value="'.$search_datec.'">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Prospect level
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
$options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted
|
|
||||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
|
||||||
{
|
|
||||||
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
|
|
||||||
$options_from .= $langs->trans($tab_level_label);
|
|
||||||
$options_from .= '</option>';
|
|
||||||
}
|
|
||||||
array_reverse($tab_level, true); // Reverse the list
|
|
||||||
$options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order
|
|
||||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
|
||||||
{
|
|
||||||
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
|
|
||||||
$options_to .= $langs->trans($tab_level_label);
|
|
||||||
$options_to .= '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print these two select
|
|
||||||
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
|
|
||||||
print ' ';
|
|
||||||
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Prospect status
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
$arraystcomm=array();
|
|
||||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
|
||||||
{
|
|
||||||
$arraystcomm[$val['id']]=$val['label'];
|
|
||||||
}
|
|
||||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print ' ';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Extrafields
|
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_list as $key => $val)
|
|
||||||
{
|
|
||||||
if ($val)
|
|
||||||
{
|
|
||||||
$crit=$search_array_options['search_options_'.$key];
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print $extrafields->showInputField($key, $crit, '', '', 'search_', 4);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
// Status
|
|
||||||
print '<td class="liste_titre" align="right">';
|
|
||||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Print the search button
|
|
||||||
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";
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
$var=true;
|
|
||||||
|
|
||||||
while ($i < min($num,$conf->liste_limit))
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
|
||||||
print '<td>';
|
|
||||||
$prospectstatic->id=$obj->socid;
|
|
||||||
$prospectstatic->name=$obj->name;
|
|
||||||
$prospectstatic->status=$obj->status;
|
|
||||||
$prospectstatic->code_client=$obj->code_client;
|
|
||||||
$prospectstatic->client=$obj->client;
|
|
||||||
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
|
||||||
$prospectstatic->name_alias=$obj->name_alias;
|
|
||||||
print $prospectstatic->getNomUrl(1,'prospect');
|
|
||||||
print '</td>';
|
|
||||||
print "<td>".$obj->zip."</td>";
|
|
||||||
print "<td>".$obj->town."</td>";
|
|
||||||
print '<td align="center">'.$obj->departement.'</td>';
|
|
||||||
//Country
|
|
||||||
print '<td align="center">';
|
|
||||||
$tmparray=getCountry($obj->fk_pays,'all');
|
|
||||||
print $tmparray['label'];
|
|
||||||
print '</td>';
|
|
||||||
//Type ent
|
|
||||||
print '<td align="center">';
|
|
||||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
|
||||||
print $typenArray[$obj->typent_code];
|
|
||||||
print '</td>';
|
|
||||||
// Creation date
|
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datec)).'</td>';
|
|
||||||
// Level
|
|
||||||
print '<td align="center">';
|
|
||||||
print $prospectstatic->getLibProspLevel();
|
|
||||||
print "</td>";
|
|
||||||
// Statut
|
|
||||||
print '<td align="center" class="nowrap">';
|
|
||||||
print $prospectstatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
print '<td align="center" class="nowrap">';
|
|
||||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
|
||||||
{
|
|
||||||
$titlealt='default';
|
|
||||||
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
|
|
||||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$obj->socid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Extrafields
|
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_list as $key => $val)
|
|
||||||
{
|
|
||||||
if ($val)
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
$paramkey='options_'.$key;
|
|
||||||
print $extrafields->showOutputField($key, $obj->$paramkey);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
|
||||||
$parameters=array('obj' => $obj);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print '<td align="right">';
|
|
||||||
print $prospectstatic->LibStatut($prospectstatic->status,5);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td></td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
|
|
||||||
$db->free($resql);
|
|
||||||
|
|
||||||
$parameters=array('sql' => $sql);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -302,7 +302,7 @@ 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 int $type Type of categories (0=product, 1=supplier, 2=customer, 3=member, 4=contact)
|
||||||
* @param integer $selected Preselected value
|
* @param integer $selected Preselected value
|
||||||
* @param string $htmlname Name of combo list
|
* @param string $htmlname Name of combo list
|
||||||
* @param int $nocateg Show also an entry "Not categorized"
|
* @param int $nocateg Show also an entry "Not categorized"
|
||||||
|
|||||||
@ -71,9 +71,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/list.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/list.php?leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||||
-- Third parties - Contacts
|
-- Third parties - Contacts
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
|
||||||
|
|||||||
@ -590,13 +590,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||||
{
|
{
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
|
$newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
|
||||||
/* no more required, there is a filter that can do more
|
/* no more required, there is a filter that can do more
|
||||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
|
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
|
||||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
|
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
|
||||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
|
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
|
||||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
|
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
|
||||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
|
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
|
||||||
*/
|
*/
|
||||||
$newmenu->add("/societe/soc.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
|
$newmenu->add("/societe/soc.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
|
||||||
//$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
//$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
||||||
@ -606,7 +606,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||||
{
|
{
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
$newmenu->add("/comm/list.php?leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
|
$newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
|
||||||
|
|
||||||
$newmenu->add("/societe/soc.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
|
$newmenu->add("/societe/soc.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
|
||||||
//$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
//$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
||||||
|
|||||||
@ -231,8 +231,9 @@ if (empty($user->societe_id))
|
|||||||
"SuppliersInvoices",
|
"SuppliersInvoices",
|
||||||
"ExpenseReports");
|
"ExpenseReports");
|
||||||
// Dashboard Link lines
|
// Dashboard Link lines
|
||||||
$links=array(DOL_URL_ROOT.'/comm/list.php',
|
$links=array(
|
||||||
DOL_URL_ROOT.'/comm/prospect/list.php',
|
DOL_URL_ROOT.'/societe/list.php?type=c',
|
||||||
|
DOL_URL_ROOT.'/societe/list.php?type=p',
|
||||||
DOL_URL_ROOT.'/societe/list.php?type=f',
|
DOL_URL_ROOT.'/societe/list.php?type=f',
|
||||||
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
||||||
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
||||||
|
|||||||
@ -143,13 +143,13 @@ else
|
|||||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
|
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
|
||||||
{
|
{
|
||||||
$statstring = "<tr ".$bc[0].">";
|
$statstring = "<tr ".$bc[0].">";
|
||||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/comm/prospect/list.php">'.$langs->trans("Prospects").'</a></td><td align="right">'.round($third['prospect']).'</td>';
|
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td align="right">'.round($third['prospect']).'</td>';
|
||||||
$statstring.= "</tr>";
|
$statstring.= "</tr>";
|
||||||
}
|
}
|
||||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
|
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
|
||||||
{
|
{
|
||||||
$statstring.= "<tr ".$bc[1].">";
|
$statstring.= "<tr ".$bc[1].">";
|
||||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/comm/list.php">'.$langs->trans("Customers").'</a></td><td align="right">'.round($third['customer']).'</td>';
|
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td align="right">'.round($third['customer']).'</td>';
|
||||||
$statstring.= "</tr>";
|
$statstring.= "</tr>";
|
||||||
}
|
}
|
||||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS))
|
if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS))
|
||||||
|
|||||||
@ -31,10 +31,12 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("customers");
|
$langs->load("customers");
|
||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
@ -64,10 +66,14 @@ $search_country=GETPOST("search_country",'int');
|
|||||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||||
$search_type=GETPOST('search_type','alpha');
|
$search_type=GETPOST('search_type','alpha');
|
||||||
$search_status=GETPOST("search_status",'int');
|
$search_status=GETPOST("search_status",'int');
|
||||||
|
$search_level_from = GETPOST("search_level_from","alpha");
|
||||||
|
$search_level_to = GETPOST("search_level_to","alpha");
|
||||||
|
$search_stcomm=GETPOST('search_stcomm','int');
|
||||||
|
|
||||||
$type=GETPOST('type');
|
$type=GETPOST('type');
|
||||||
$optioncss=GETPOST('optioncss','alpha');
|
$optioncss=GETPOST('optioncss','alpha');
|
||||||
$mode=GETPOST("mode");
|
$mode=GETPOST("mode");
|
||||||
|
$action=GETPOST('action');
|
||||||
|
|
||||||
$sortfield=GETPOST("sortfield",'alpha');
|
$sortfield=GETPOST("sortfield",'alpha');
|
||||||
$sortorder=GETPOST("sortorder",'alpha');
|
$sortorder=GETPOST("sortorder",'alpha');
|
||||||
@ -116,6 +122,7 @@ if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp !=
|
|||||||
if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
|
if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -126,6 +133,20 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($action == 'setstcomm')
|
||||||
|
{
|
||||||
|
$object = new Client($db);
|
||||||
|
$result=$object->fetch(GETPOST('stcommsocid'));
|
||||||
|
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||||
|
$result=$object->set_commnucation_level($user);
|
||||||
|
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||||
|
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// special search
|
// special search
|
||||||
/*if ($mode == 'search')
|
/*if ($mode == 'search')
|
||||||
{
|
{
|
||||||
@ -176,20 +197,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form=new Form($db);
|
|
||||||
$formother=new FormOther($db);
|
|
||||||
$companystatic=new Societe($db);
|
|
||||||
$formcompany=new FormCompany($db);
|
|
||||||
|
|
||||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
|
||||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
|
||||||
|
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -212,14 +219,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$search_country='';
|
$search_country='';
|
||||||
$search_type_thirdparty='';
|
$search_type_thirdparty='';
|
||||||
$search_status='';
|
$search_status='';
|
||||||
|
$search_stcomm='';
|
||||||
|
$search_level_from='';
|
||||||
|
$search_level_to='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_status=='') $search_status=1; // always display active thirdparty first
|
if ($search_status=='') $search_status=1; // always display active thirdparty first
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode List
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -230,13 +241,103 @@ if ($search_status=='') $search_status=1; // always display active thirdparty fi
|
|||||||
External user socid=x + Permission to see ALL customers => Can see only himself
|
External user socid=x + Permission to see ALL customers => Can see only himself
|
||||||
External user socid=x + No permission to see ALL customers => Can see only himself
|
External user socid=x + No permission to see ALL customers => Can see only himself
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
$formother=new FormOther($db);
|
||||||
|
$companystatic=new Societe($db);
|
||||||
|
$formcompany=new FormCompany($db);
|
||||||
|
$prospectstatic=new Client($db);
|
||||||
|
$prospectstatic->client=2;
|
||||||
|
$prospectstatic->loadCacheOfProspStatus();
|
||||||
|
|
||||||
|
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||||
|
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||||
|
|
||||||
|
|
||||||
$title=$langs->trans("ListOfThirdParties");
|
$title=$langs->trans("ListOfThirdParties");
|
||||||
if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers");
|
if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers");
|
||||||
if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects");
|
if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects");
|
||||||
if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers");
|
if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers");
|
||||||
|
|
||||||
$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, ";
|
// If both parameters are set, search for everything BETWEEN them
|
||||||
$sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
if ($search_level_from != '' && $search_level_to != '')
|
||||||
|
{
|
||||||
|
// Ensure that these parameters are numbers
|
||||||
|
$search_level_from = (int) $search_level_from;
|
||||||
|
$search_level_to = (int) $search_level_to;
|
||||||
|
|
||||||
|
// If from is greater than to, reverse orders
|
||||||
|
if ($search_level_from > $search_level_to)
|
||||||
|
{
|
||||||
|
$tmp = $search_level_to;
|
||||||
|
$search_level_to = $search_level_from;
|
||||||
|
$search_level_from = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the SQL request
|
||||||
|
$sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range';
|
||||||
|
}
|
||||||
|
// If only "from" parameter is set, search for everything GREATER THAN it
|
||||||
|
else if ($search_level_from != '')
|
||||||
|
{
|
||||||
|
// Ensure that this parameter is a number
|
||||||
|
$search_level_from = (int) $search_level_from;
|
||||||
|
|
||||||
|
// Generate the SQL request
|
||||||
|
$sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range';
|
||||||
|
}
|
||||||
|
// If only "to" parameter is set, search for everything LOWER THAN it
|
||||||
|
else if ($search_level_to != '')
|
||||||
|
{
|
||||||
|
// Ensure that this parameter is a number
|
||||||
|
$search_level_to = (int) $search_level_to;
|
||||||
|
|
||||||
|
// Generate the SQL request
|
||||||
|
$sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range';
|
||||||
|
}
|
||||||
|
// If no parameters are set, dont search for anything
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sortwhere = '0 as is_in_range';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||||
|
dol_syslog('societe/list.php',LOG_DEBUG);
|
||||||
|
$sql = "SELECT code, label, sortorder, ".$sortwhere;
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||||
|
$sql.= " WHERE active > 0";
|
||||||
|
$sql.= " ORDER BY sortorder";
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$tab_level = array();
|
||||||
|
$search_levels = array();
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
// Compute level text
|
||||||
|
$level=$langs->trans($obj->code);
|
||||||
|
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||||
|
|
||||||
|
// Put it in the array sorted by sortorder
|
||||||
|
$tab_level[$obj->sortorder] = $level;
|
||||||
|
|
||||||
|
// If this potentiel fit in parameters, add its code to the $search_levels array
|
||||||
|
if ($obj->is_in_range == 1)
|
||||||
|
{
|
||||||
|
$search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
|
||||||
|
// If no paramters was set, $search_levels will be empty
|
||||||
|
$search_levels = implode(',', $search_levels);
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, ";
|
||||||
|
$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, 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,";
|
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4,";
|
||||||
$sql.= " s.fk_pays, s.tms as date_update, s.datec as date_creation,";
|
$sql.= " s.fk_pays, s.tms as date_update, s.datec as date_creation,";
|
||||||
$sql.= " typent.code as typent_code";
|
$sql.= " typent.code as typent_code";
|
||||||
@ -291,6 +392,8 @@ if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
|
|||||||
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
|
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
|
||||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||||
|
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
||||||
|
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
{
|
{
|
||||||
@ -348,6 +451,9 @@ if ($resql)
|
|||||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||||
|
if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm;
|
||||||
|
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
||||||
|
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
||||||
if ($type != '') $param.='&type='.urlencode($type);
|
if ($type != '') $param.='&type='.urlencode($type);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
@ -400,7 +506,7 @@ if ($resql)
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
|
$moreforfilter.=$formother->select_categories('customer',$search_categ,'search_categ',1);
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter.='</div>';
|
||||||
}
|
}
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
@ -419,7 +525,7 @@ if ($resql)
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1);
|
$moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1);
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter.='</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,16 +542,21 @@ if ($resql)
|
|||||||
// Define list of fields to show into list
|
// Define list of fields to show into list
|
||||||
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
|
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
|
||||||
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
||||||
$checkedcustomeraccountcode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
|
$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0);
|
||||||
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
||||||
$checkedtypetiers=1;
|
$checkedtypetiers=1;
|
||||||
|
$checkedprofid1=0;
|
||||||
|
$checkedprofid2=0;
|
||||||
|
$checkedprofid3=0;
|
||||||
$checkedprofid4=0;
|
$checkedprofid4=0;
|
||||||
$checkedprofid5=0;
|
$checkedprofid5=0;
|
||||||
$checkedprofid6=0;
|
$checkedprofid6=0;
|
||||||
//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||||
//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||||
//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||||
$arrayfields=array(
|
$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||||
|
$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||||
|
$arrayfields=array(
|
||||||
's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||||
's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
||||||
's.code_client'=>array('label'=>$langs->trans("CustomerCodeShort"), 'checked'=>$checkedcustomercode),
|
's.code_client'=>array('label'=>$langs->trans("CustomerCodeShort"), 'checked'=>$checkedcustomercode),
|
||||||
@ -456,12 +567,14 @@ if ($resql)
|
|||||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||||
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1),
|
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1),
|
||||||
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>1),
|
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2),
|
||||||
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1),
|
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>$checkedprofid3),
|
||||||
's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4),
|
's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4),
|
||||||
's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5),
|
's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5),
|
||||||
's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6),
|
's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6),
|
||||||
|
's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel),
|
||||||
|
's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm),
|
||||||
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200),
|
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200),
|
||||||
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
@ -488,7 +601,9 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre(''); // type of customer
|
print_liste_field_titre(''); // type of customer
|
||||||
// Extra fields
|
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_list as $key => $val)
|
foreach($extrafields->attribute_list as $key => $val)
|
||||||
@ -623,6 +738,7 @@ if ($resql)
|
|||||||
print '<input class="flat" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
print '<input class="flat" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type (customer/prospect/supplier)
|
// Type (customer/prospect/supplier)
|
||||||
print '<td class="liste_titre" align="middle">';
|
print '<td class="liste_titre" align="middle">';
|
||||||
print '<select class="flat" name="search_type">';
|
print '<select class="flat" name="search_type">';
|
||||||
@ -633,6 +749,48 @@ if ($resql)
|
|||||||
print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
|
print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
|
||||||
print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
|
print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
|
||||||
print '</select></td>';
|
print '</select></td>';
|
||||||
|
|
||||||
|
if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect level
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
$options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted
|
||||||
|
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||||
|
{
|
||||||
|
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
|
||||||
|
$options_from .= $langs->trans($tab_level_label);
|
||||||
|
$options_from .= '</option>';
|
||||||
|
}
|
||||||
|
array_reverse($tab_level, true); // Reverse the list
|
||||||
|
$options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order
|
||||||
|
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||||
|
{
|
||||||
|
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
|
||||||
|
$options_to .= $langs->trans($tab_level_label);
|
||||||
|
$options_to .= '</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print these two select
|
||||||
|
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
|
||||||
|
print ' ';
|
||||||
|
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($arrayfields['s.fk_stcomm']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect status
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
$arraystcomm=array();
|
||||||
|
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||||
|
{
|
||||||
|
$arraystcomm[$val['id']]=$val['label'];
|
||||||
|
}
|
||||||
|
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -671,18 +829,22 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
|
$companystatic->id=$obj->rowid;
|
||||||
|
$companystatic->name=$obj->name;
|
||||||
|
$companystatic->canvas=$obj->canvas;
|
||||||
|
$companystatic->client=$obj->client;
|
||||||
|
$companystatic->status=$obj->status;
|
||||||
|
$companystatic->fournisseur=$obj->fournisseur;
|
||||||
|
$companystatic->code_client=$obj->code_client;
|
||||||
|
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
||||||
|
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
||||||
|
$companystatic->name_alias=$obj->name_alias;
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$companystatic->id=$obj->rowid;
|
|
||||||
$companystatic->name=$obj->name;
|
|
||||||
$companystatic->canvas=$obj->canvas;
|
|
||||||
$companystatic->client=$obj->client;
|
|
||||||
$companystatic->status=$obj->status;
|
|
||||||
$companystatic->fournisseur=$obj->fournisseur;
|
|
||||||
$companystatic->code_client=$obj->code_client;
|
|
||||||
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
|
||||||
print $companystatic->getNomUrl(1,'',100);
|
print $companystatic->getNomUrl(1,'',100);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
@ -761,6 +923,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print "<td>".$obj->idprof6."</td>\n";
|
print "<td>".$obj->idprof6."</td>\n";
|
||||||
}
|
}
|
||||||
|
// Type
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$s='';
|
$s='';
|
||||||
if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||||
@ -782,6 +945,28 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
print $s;
|
print $s;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect level
|
||||||
|
print '<td align="center">';
|
||||||
|
print $companystatic->getLibProspLevel();
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['s.fk_stcomm']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect status
|
||||||
|
print '<td align="center" class="nowrap"><div class="nowrap">';
|
||||||
|
print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
|
||||||
|
print '</div> - <div class="inline-block">';
|
||||||
|
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||||
|
{
|
||||||
|
$titlealt='default';
|
||||||
|
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
|
||||||
|
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
|
||||||
|
}
|
||||||
|
print '</div></div></td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user