NEW Selection of fields is available on member list
This commit is contained in:
parent
47f27f353a
commit
3784af00ea
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -28,6 +28,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("members");
|
||||
$langs->load("companies");
|
||||
@ -43,6 +44,11 @@ $search_ref=GETPOST("search_ref");
|
||||
$search_lastname=GETPOST("search_lastname");
|
||||
$search_firstname=GETPOST("search_firstname");
|
||||
$search_login=GETPOST("search_login");
|
||||
$search_address=GETPOST("search_address");
|
||||
$search_zip=GETPOST("search_zip");
|
||||
$search_town=GETPOST("search_town");
|
||||
$search_state=GETPOST("search_state");
|
||||
$search_country=GETPOST("search_country");
|
||||
$type=GETPOST("type");
|
||||
$search_email=GETPOST("search_email");
|
||||
$search_categ = GETPOST("search_categ",'int');
|
||||
@ -50,6 +56,8 @@ $catid = GETPOST("catid",'int');
|
||||
$sall=GETPOST("sall");
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
if ($statut < -1) $statut = '';
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -88,7 +96,7 @@ $arrayfields=array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.societe'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
@ -96,8 +104,10 @@ $arrayfields=array(
|
||||
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
|
||||
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'd.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),
|
||||
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
@ -139,10 +149,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_address="";
|
||||
$search_zip="";
|
||||
$search_town="";
|
||||
$search_state="";
|
||||
$search_country='';
|
||||
$search_morphy="";
|
||||
$search_categ="";
|
||||
$catid="";
|
||||
$sall="";
|
||||
$statut='';
|
||||
}
|
||||
|
||||
|
||||
@ -160,9 +173,11 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
|
||||
$sql.= " d.datefin,";
|
||||
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
|
||||
$sql.= " t.libelle as type, t.cotisation";
|
||||
$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
|
||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
|
||||
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
|
||||
$sql.= " t.libelle as type, t.cotisation,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
@ -171,6 +186,8 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // 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 = d.country)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
|
||||
if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
|
||||
@ -180,7 +197,7 @@ if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
|
||||
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
|
||||
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($search_ref)
|
||||
{
|
||||
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
|
||||
@ -189,6 +206,10 @@ if ($search_ref)
|
||||
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
|
||||
if ($search_login) $sql.= natural_search("d.login", $search_login);
|
||||
if ($search_email) $sql.= natural_search("d.email", $search_email);
|
||||
if ($search_town) $sql.= natural_search("d.town",$search_town);
|
||||
if ($search_zip) $sql.= natural_search("d.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
|
||||
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
|
||||
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
||||
|
||||
@ -253,19 +274,23 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($statut != "") $param.="&statut=".$statut;
|
||||
if ($search_nom) $param.="&search_nom=".$search_nom;
|
||||
if ($search_firstname) $param.="&search_firstname=".$search_firstname;
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_email) $param.="&search_email=".$search_email;
|
||||
if ($search_company) $param.="&search_company=".$search_company;
|
||||
if ($search_zip) $param.="&search_zip=".$search_zip;
|
||||
if ($search_town) $param.="&search_town=".$search_town;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($type > 0) $param.="&type=".$type;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($statut != "") $param.="&statut=".urlencode($statut);
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
|
||||
if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
if ($search_email) $param.="&search_email=".urlencode($search_email);
|
||||
if ($search_company) $param.="&search_company=".urlencode($search_company);
|
||||
if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
|
||||
if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
|
||||
if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
|
||||
if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
|
||||
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
|
||||
if ($filter) $param.="&filter=".urlencode($filter);
|
||||
if ($type > 0) $param.="&type=".urlencode($type);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
@ -325,15 +350,17 @@ if ($resql)
|
||||
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.company','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -350,7 +377,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['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
@ -370,25 +397,31 @@ if ($resql)
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="4"></td>';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="12"></td>';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="7"></td>';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
@ -402,25 +435,38 @@ if ($resql)
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="7"></td>';
|
||||
print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="5"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="7"></td>';
|
||||
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="5"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="7"></td>';
|
||||
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="5"></td>';
|
||||
}
|
||||
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Email
|
||||
if (! empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="5"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.datefin']['checked']))
|
||||
@ -428,31 +474,85 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
$liststatus=array(
|
||||
'-1'=>$langs->trans("Draft"),
|
||||
'1'=>$langs->trans("Validated"),
|
||||
'0'=>$langs->trans("Resiliated")
|
||||
);
|
||||
print $form->selectarray('statut', $liststatus, $statut, -2);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin=$db->jdate($objp->datefin);
|
||||
$memberstatic->id=$objp->rowid;
|
||||
$memberstatic->ref=$objp->rowid;
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
$memberstatic->statut=$objp->statut;
|
||||
$datefin=$db->jdate($obj->datefin);
|
||||
$memberstatic->id=$obj->rowid;
|
||||
$memberstatic->ref=$obj->rowid;
|
||||
$memberstatic->lastname=$obj->lastname;
|
||||
$memberstatic->firstname=$obj->firstname;
|
||||
$memberstatic->societe=$obj->company;
|
||||
$memberstatic->statut=$obj->statut;
|
||||
$memberstatic->datefin= $datefin;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$memberstatic->socid = $obj->fk_soc;
|
||||
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$companyname=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$companyname=$objp->company;
|
||||
$companyname=$obj->company;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -463,85 +563,188 @@ if ($resql)
|
||||
print '<td align="center">'.($i+1).'</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
}
|
||||
// Lastname
|
||||
print "<td><a href=\"card.php?rowid=$objp->rowid\">";
|
||||
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
|
||||
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
|
||||
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
|
||||
print "</a></td>\n";
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
|
||||
// Type
|
||||
$membertypestatic->id=$objp->type_id;
|
||||
$membertypestatic->libelle=$objp->type;
|
||||
print '<td class="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
|
||||
// Moral/Physique
|
||||
print "<td>".$memberstatic->getmorphylib($objp->morphy)."</td>\n";
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->lastname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $companyname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Login
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print "<td>".$obj->login."</td>\n";
|
||||
}
|
||||
// Moral/Physique
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
|
||||
}
|
||||
// Type label
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
$membertypestatic->id=$obj->type_id;
|
||||
$membertypestatic->libelle=$obj->type;
|
||||
print '<td class="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
}
|
||||
// Address
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->address;
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->country,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// EMail
|
||||
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
|
||||
|
||||
$parameters=array('obj' => $obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Statut
|
||||
print '<td class="nowrap">';
|
||||
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
|
||||
print "</td>";
|
||||
|
||||
if (! empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
print "<td>".dol_print_email($obj->email,0,0,1)."</td>\n";
|
||||
}
|
||||
// End of subscription date
|
||||
if ($datefin)
|
||||
$datefin=$db->jdate($obj->datefin);
|
||||
if (! empty($arrayfields['d.datefin']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($datefin,'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
print '</td>';
|
||||
if ($datefin)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($datefin,'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($obj->cotisation == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($obj->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($objp->cotisation == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($objp->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
|
||||
}
|
||||
print ' ';
|
||||
if ($user->rights->adherent->supprimer && $objp->statut == -1)
|
||||
if ($user->rights->adherent->supprimer && $obj->statut == -1)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
|
||||
}
|
||||
if ($user->rights->adherent->supprimer && $objp->statut == 1)
|
||||
if ($user->rights->adherent->supprimer && $obj->statut == 1)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -991,6 +991,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.facture']['checked']))
|
||||
{
|
||||
print '<td align="center">'.yn($obj->billed).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
|
||||
@ -212,6 +212,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_town="";
|
||||
$search_zip="";
|
||||
$search_state="";
|
||||
$search_country='';
|
||||
$search_idprof1='';
|
||||
$search_idprof2='';
|
||||
$search_idprof3='';
|
||||
@ -219,7 +220,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_idprof5='';
|
||||
$search_idprof6='';
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_type_thirdparty='';
|
||||
$search_status='';
|
||||
$search_stcomm='';
|
||||
@ -384,6 +384,7 @@ if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss
|
||||
if ($search_town) $sql.= natural_search("s.town",$search_town);
|
||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1);
|
||||
if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2);
|
||||
if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3);
|
||||
@ -396,7 +397,6 @@ if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND
|
||||
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
||||
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 ($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_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user