Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur 2015-10-22 10:18:05 +02:00
commit 8bdbed69c9
8 changed files with 109 additions and 397 deletions

View File

@ -44,14 +44,14 @@ if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE
{
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
$arrayresult['searchintothirdparty']=$langs->trans("SearchIntoThirdparties", $search_boxvalue);
$arrayresult['searchintothirdparty']=img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue);
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
$arrayresult['searchintocontact']=$langs->trans("SearchIntoContacts", $search_boxvalue);
$arrayresult['searchintocontact']=img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue);
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
@ -59,7 +59,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
{
$langs->load("products");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
$arrayresult['searchintoproduct']=$langs->trans("SearchIntoProductsOrServices", $search_boxvalue);
$arrayresult['searchintoproduct']=img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue);
}
/*if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled)
@ -73,14 +73,14 @@ if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_
{
$langs->load("members");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
$arrayresult['searchintomember']=$langs->trans("SearchIntoMembers", $search_boxvalue);
$arrayresult['searchintomember']=img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue);
}
if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire)
{
$langs->load("projects");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
$arrayresult['searchintoprojects']=$langs->trans("SearchIntoProjects", $search_boxvalue);
$arrayresult['searchintoprojects']=img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue);
}
// Execute hook printSearchForm

View File

@ -69,7 +69,7 @@ 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', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, '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', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 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__, '/fourn/list.php?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', __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', 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__);

View File

@ -616,10 +616,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
$langs->load("suppliers");
$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
//$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
//$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
}
// Contacts
@ -1146,7 +1144,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Security check
$newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/list.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/societe/list.php?type=f",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
}

View File

@ -1,333 +0,0 @@
<?php
/* Copyright (C) 2001-2006 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 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
*
* 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/fourn/list.php
* \ingroup fournisseur
* \brief Home page of supplier area
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load("suppliers");
$langs->load("orders");
$langs->load("companies");
$socname = GETPOST("socname");
$search_name = GETPOST("search_name");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_supplier_code = GETPOST("search_supplier_code");
$search_supplier_accounting = GETPOST("search_supplier_accounting");
$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');
$optioncss = GETPOST('optioncss','alpha');
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$socid,'');
$page = GETPOST('page','int');
$sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha');
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplierlist'));
$extrafields = new ExtraFields($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$socname="";
$search_name="";
$search_zipcode="";
$search_town="";
$search_supplier_code="";
$search_supplier_accounting="";
$search_datec="";
$search_categ="";
$search_status='';
$catid="";
$search_country="";
$search_type_thirdparty="";
}
if ($search_status=='') $search_status=1; // always display activ customer first
$extrafields->fetch_name_optionals_label('thirdparty');
/*
* 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');
/*
* View
*/
$form=new Form($db);
$htmlother=new FormOther($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 as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, ";
$sql.= "code_fournisseur, code_compta_fournisseur";
$sql.= ",s.fk_pays";
$sql.= ",typent.code as typent_code";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
// 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";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef ON ef.fk_object = s.rowid";
$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_fournisseur as cf ON s.rowid = cf.fk_soc"; // We need this table joined to the select in order to filter by categ
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc";
if ($socid) $sql .= " AND s.rowid = ".$socid;
if ($socname) {
$sql .= natural_search('s.nom', $socname);
$sortfield = "s.nom";
$sortorder = "ASC";
}
if ($search_name) $sql .= natural_search(array('s.nom', 's.name_alias'), $search_name);
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'";
if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'";
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cf.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cf.fk_categorie IS NULL";
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
// 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);
//print $sql;
dol_syslog('fourn/list.php:', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$param = "&amp;search_name=".htmlspecialchars($search_name);
$param.="&amp;search_supplier_code=".htmlspecialchars($search_supplier_code);
$param.="&amp;search_zipcode=".htmlspecialchars($search_zipcode);
$param.="&amp;search_town=".htmlspecialchars($search_town);
if ($search_categ != '') $param.='&amp;search_categ='.htmlspecialchars($search_categ);
if ($search_status != '') $param.='&amp;search_status='.htmlspecialchars($search_status);
if ($search_country != '') $param.='&amp;search_country='.htmlspecialchars($search_country);
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.htmlspecialchars($search_type_thirdparty);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');
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))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1);
$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,'valign="middle"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'valign="middle"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'valign="middle"',$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("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.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"><input type="text" size="10" class="flat" name="search_name" value="'.$search_name.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_town" value="'.$search_town.'"></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="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_supplier_code" value="'.$search_supplier_code.'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_supplier_accounting" value="'.$search_supplier_accounting.'">';
print '</td>';
print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$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 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>\n";
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql);
$var=!$var;
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->status=$obj->status;
$thirdpartystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">";
print '<td>';
print $thirdpartystatic->getNomUrl(1,'supplier');
print "</td>\n";
print '<td>'.$obj->zip.'</td>'."\n";
print '<td>'.$obj->town.'</td>'."\n";
//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 align="left">'.$obj->code_fournisseur.'&nbsp;</td>';
print '<td align="left">'.$obj->code_compta_fournisseur.'&nbsp;</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).'</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
print "</table>\n";
print "</form>\n";
$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);
}
$db->close();
llxFooter();

View File

@ -233,7 +233,7 @@ if (empty($user->societe_id))
// Dashboard Link lines
$links=array(DOL_URL_ROOT.'/comm/list.php',
DOL_URL_ROOT.'/comm/prospect/list.php',
DOL_URL_ROOT.'/fourn/list.php',
DOL_URL_ROOT.'/societe/list.php?type=f',
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=1&mainmenu=products',

View File

@ -155,7 +155,7 @@ else
if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS))
{
$statstring2 = "<tr ".$bc[0].">";
$statstring2.= '<td><a href="'.DOL_URL_ROOT.'/fourn/list.php">'.$langs->trans("Suppliers").'</a></td><td align="right">'.round($third['supplier']).'</td>';
$statstring2.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td align="right">'.round($third['supplier']).'</td>';
$statstring2.= "</tr>";
}
print $statstring;

View File

@ -57,13 +57,15 @@ $search_idprof3=trim(GETPOST('search_idprof3'));
$search_idprof4=trim(GETPOST('search_idprof4'));
$search_idprof5=trim(GETPOST('search_idprof5'));
$search_idprof6=trim(GETPOST('search_idprof6'));
$search_sale=trim(GETPOST("search_sale"));
$search_categ=trim(GETPOST("search_categ"));
$search_sale=trim(GETPOST("search_sale",'int'));
$search_categ=trim(GETPOST("search_categ",'int'));
$search_type=trim(GETPOST('search_type'));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_type=GETPOST('search_type','alpha');
$search_status=GETPOST("search_status",'int');
$type=GETPOST('type');
$optioncss=GETPOST('optioncss','alpha');
$mode=GETPOST("mode");
@ -79,6 +81,15 @@ $pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='thirdpartylist';
/*if ($search_type == '1,3') { $contextpage='customerlist'; $type='c'; }
if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; }
if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; }
*/
if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; }
if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; }
if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
@ -109,10 +120,14 @@ if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
* 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');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// special search
if ($mode == 'search')
/*if ($mode == 'search')
{
$sql = "SELECT s.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -159,7 +174,7 @@ if ($mode == 'search')
$db->free($result);
}
}
*/
/*
@ -167,7 +182,7 @@ if ($mode == 'search')
*/
$form=new Form($db);
$htmlother=new FormOther($db);
$formother=new FormOther($db);
$companystatic=new Societe($db);
$formcompany=new FormCompany($db);
@ -216,6 +231,9 @@ if ($search_status=='') $search_status=1; // always display active thirdparty fi
External user socid=x + No permission to see ALL customers => Can see only himself
*/
$title=$langs->trans("ListOfThirdParties");
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 == '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, ";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
@ -308,29 +326,35 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
$param = "&amp;sall=".urlencode($sall);
$param.= "&amp;search_nom=".urlencode($search_nom);
$param.= "&amp;search_town=".urlencode($search_town);
$param.= "&amp;search_zip=".urlencode($search_zip);
$param.= "&amp;search_customer_code=".urlencode($search_customer_code);
$param.= "&amp;search_supplier_code=".urlencode($search_supplier_code);
$param.= "&amp;search_account_customer_code=".urlencode($search_account_customer_code);
$param.= "&amp;search_account_supplier_code=".urlencode($search_account_supplier_code);
$param.= ($search_barcode?"&amp;sbarcode=".urlencode($search_barcode):"");
$param.= '&amp;search_idprof1='.urlencode($search_idprof1);
$param.= '&amp;search_idprof2='.urlencode($search_idprof2);
$param.= '&amp;search_idprof3='.urlencode($search_idprof3);
$param.= '&amp;search_idprof4='.urlencode($search_idprof4);
if ($sall != '') $param = "&amp;sall=".urlencode($sall);
if ($search_categ != '') $param.='&amp;search_categ='.urlencode($search_categ);
if ($search_sale > 0) $param.='&amp;search_sale='.urlencode($search_sale);
if ($search_nom != '') $param.= "&amp;search_nom=".urlencode($search_nom);
if ($search_town != '') $param.= "&amp;search_town=".urlencode($search_town);
if ($search_zip != '') $param.= "&amp;search_zip=".urlencode($search_zip);
if ($search_country != '') $param.= "&amp;search_country=".urlencode($search_country);
if ($search_customer_code != '') $param.= "&amp;search_customer_code=".urlencode($search_customer_code);
if ($search_supplier_code != '') $param.= "&amp;search_supplier_code=".urlencode($search_supplier_code);
if ($search_account_customer_code != '') $param.= "&amp;search_account_customer_code=".urlencode($search_account_customer_code);
if ($search_account_supplier_code != '') $param.= "&amp;search_account_supplier_code=".urlencode($search_account_supplier_code);
if ($search_barcode != '') $param.= "&amp;sbarcode=".urlencode($search_barcode);
if ($search_idprof1 != '') $param.= '&amp;search_idprof1='.urlencode($search_idprof1);
if ($search_idprof2 != '') $param.= '&amp;search_idprof2='.urlencode($search_idprof2);
if ($search_idprof3 != '') $param.= '&amp;search_idprof3='.urlencode($search_idprof3);
if ($search_idprof4 != '') $param.= '&amp;search_idprof4='.urlencode($search_idprof4);
if ($search_idprof5 != '') $param.= '&amp;search_idprof5='.urlencode($search_idprof5);
if ($search_idprof6 != '') $param.= '&amp;search_idprof6='.urlencode($search_idprof6);
if ($search_country != '') $param.='&amp;search_country='.urlencode($search_country);
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
if ($search_status != '') $params.='&amp;search_status='.urlencode($search_status);
if ($search_status != '') $param.='&amp;search_status='.urlencode($search_status);
if ($type != '') $param.='&amp;type='.urlencode($type);
// 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);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');
@ -368,39 +392,59 @@ if ($resql)
}
// Filter on categories
/* Not possible in this page because list is for ALL third parties type
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categories::TYPE_CUSTOMER,$search_categ,'search_categ');
$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.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.='</div>';
}
*/
if ($type == 'c' || $type == 'p')
{
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 ($type == 'f')
{
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_SUPPLIER,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
}
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$parameters=array('type'=>$type);
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
// Define list of fields to show into list
$checkedcustomercode=1;
$checkedsuppliercode=1;
$checkedcustomeraccountcode=0;
$checkedsupplieraccountcode=0;
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedcustomeraccountcode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedtypetiers=1;
$checkedprofid4=0;
$checkedprofid5=0;
$checkedprofid6=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);
//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
$arrayfields=array(
's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
@ -411,19 +455,19 @@ if ($resql)
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>1),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1),
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>1),
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1),
's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0)),
's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0)),
's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0)),
's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4),
's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5),
's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6),
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200),
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
@ -459,7 +503,7 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
@ -596,7 +640,7 @@ if ($resql)
if (! empty($arrayfields['s.status']['checked']))
{
// Status
print '<td class="liste_titre" align="right">';
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>';
}
@ -614,6 +658,7 @@ if ($resql)
}
// Action column
print '<td class="liste_titre" align="right">';
if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<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>';
@ -744,7 +789,7 @@ if ($resql)
// Status
if (! empty($arrayfields['s.status']['checked']))
{
print '<td align="right">'.$companystatic->getLibStatut(5).'</td>';
print '<td align="center">'.$companystatic->getLibStatut(3).'</td>';
}
if (! empty($arrayfields['s.datec']['checked']))
{
@ -786,4 +831,3 @@ else
llxFooter();
$db->close();

View File

@ -1146,7 +1146,10 @@ div.vmenu, td.vmenu {
<?php } ?>
}
.menu_contenu { padding-top: 3px; padding-top: 2px; }
.menu_contenu {
padding-top: 3px;
padding-bottom: 2px;
}
#menu_contenu_logo { padding-right: 4px; }
a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:<?php print $fontsize ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: bold; }