2
0
forked from Wavyzz/dolibarr

Enhance code for select field list feature.

Add gender and employee on user list.
This commit is contained in:
Laurent Destailleur
2015-11-11 17:05:18 +01:00
parent f7f3e16679
commit 59a79442b0
6 changed files with 214 additions and 161 deletions

View File

@@ -96,6 +96,23 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
if ($result < 0) dol_print_error($db);
}
// Definition of fields for list
$arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
@@ -267,22 +284,6 @@ if ($resql)
print '</div>';
}
$arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

View File

@@ -122,6 +122,34 @@ $fieldstosearchall = array(
's.nom'=>"ThirdParty",
);
// Definition of fields for list
$arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
/*
* Actions
@@ -386,35 +414,10 @@ if ($result)
print '</div>';
}
$arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
// Ligne des titres
print '<tr class="liste_titre">';

View File

@@ -112,7 +112,31 @@ if (! empty($conf->barcode->enabled)) {
$fieldstosearchall['p.barcode']='Gencod';
}
// Definition of fields for lists
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))),
'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))),
'p.sellprice'=>array('label'=>$titlesellprice, 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Purchases").')', 'checked'=>1, 'position'=>1000)
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
}
}
/*
* Actions
*/
@@ -364,31 +388,10 @@ else
}
}
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))),
'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))),
'p.sellprice'=>array('label'=>$titlesellprice, 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Purchases").')', 'checked'=>1, 'position'=>1000)
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder);

View File

@@ -121,6 +121,55 @@ if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp !=
if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6';
if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
// Define list of fields to show into list
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0);
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedtypetiers=1;
$checkedprofid1=0;
$checkedprofid2=0;
$checkedprofid3=0;
$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);
$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.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_fournisseur'=>array('label'=>$langs->trans("SupplierCodeShort"), 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))),
's.code_compta'=>array('label'=>$langs->trans("CustomerAccountancyCodeShort"), 'checked'=>$checkedcustomeraccountcode),
's.code_compta_fournisseur'=>array('label'=>$langs->trans("SupplierAccountancyCodeShort"), 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))),
'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'=>$checkedtypetiers),
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1),
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2),
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>$checkedprofid3),
'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.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel),
's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm),
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
/*
@@ -489,56 +538,9 @@ if ($resql)
print '</div>';
}
// Define list of fields to show into list
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0);
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
$checkedtypetiers=1;
$checkedprofid1=0;
$checkedprofid2=0;
$checkedprofid3=0;
$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);
$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.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_fournisseur'=>array('label'=>$langs->trans("SupplierCodeShort"), 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))),
's.code_compta'=>array('label'=>$langs->trans("CustomerAccountancyCodeShort"), 'checked'=>$checkedcustomeraccountcode),
's.code_compta_fournisseur'=>array('label'=>$langs->trans("SupplierAccountancyCodeShort"), 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))),
'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'=>$checkedtypetiers),
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1),
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2),
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>$checkedprofid3),
'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.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel),
's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm),
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';

View File

@@ -194,7 +194,8 @@ if (empty($reshook)) {
$object->note = GETPOST("note");
$object->ldap_sid = GETPOST("ldap_sid");
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
$object->employee = GETPOST('employee');
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
@@ -324,7 +325,8 @@ if (empty($reshook)) {
$object->accountancy_code = GETPOST("accountancy_code");
$object->openid = GETPOST("openid");
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
$object->employee = GETPOST('employee');
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';

View File

@@ -40,21 +40,6 @@ $socid=0;
if ($user->societe_id > 0)
$socid = $user->societe_id;
$sall=GETPOST('sall','alpha');
$search_user=GETPOST('search_user','alpha');
$search_login=GETPOST('search_login','alpha');
$search_lastname=GETPOST('search_lastname','alpha');
$search_firstname=GETPOST('search_firstname','alpha');
$search_accountancy_code=GETPOST('search_accountancy_code','alpha');
$search_email=GETPOST('search_email','alpha');
$search_statut=GETPOST('search_statut','alpha');
$search_thirdparty=GETPOST('search_thirdparty','alpha');
$search_supervisor=GETPOST('search_supervisor','alpha');
$search_previousconn=GETPOST('search_previousconn','alpha');
$optioncss = GETPOST('optioncss','alpha');
if ($search_statut == '') $search_statut='1';
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
@@ -89,6 +74,53 @@ $fieldstosearchall = array(
'u.note'=>"Note"
);
// Definition of fields for list
$arrayfields=array(
'u.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
'u.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'u.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'u.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0),
'u.employee'=>array('label'=>$langs->trans("Employee"), 'checked'=>0),
'u.accountancy_code'=>array('label'=>$langs->trans("AccountancyCode"), 'checked'=>0),
'u.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1),
'u.datelastlogin'=>array('label'=>$langs->trans("LastConnexion"), 'checked'=>1, 'position'=>100),
'u.datepreviouslogin'=>array('label'=>$langs->trans("PreviousConnexion"), 'checked'=>0, 'position'=>110),
'u.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'u.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'u.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
// Init search fields
$sall=GETPOST('sall','alpha');
$search_user=GETPOST('search_user','alpha');
$search_login=GETPOST('search_login','alpha');
$search_lastname=GETPOST('search_lastname','alpha');
$search_firstname=GETPOST('search_firstname','alpha');
$search_gender=GETPOST('search_gender','alpha');
$search_employee=GETPOST('search_employee','alpha');
$search_accountancy_code=GETPOST('search_accountancy_code','alpha');
$search_email=GETPOST('search_email','alpha');
$search_statut=GETPOST('search_statut','alpha');
$search_thirdparty=GETPOST('search_thirdparty','alpha');
$search_supervisor=GETPOST('search_supervisor','alpha');
$search_previousconn=GETPOST('search_previousconn','alpha');
$optioncss = GETPOST('optioncss','alpha');
// Default search
if ($search_statut == '') $search_statut='1';
/*
* Actions
@@ -106,6 +138,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
$search_login="";
$search_lastname="";
$search_firstname="";
$search_gender="";
$search_employee="";
$search_accountancy_code="";
$search_email="";
$search_statut="";
@@ -130,7 +164,7 @@ $buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($sear
print load_fiche_titre($langs->trans("ListOfUsers"), $buttonviewhierarchy);
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.photo,";
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,";
$sql.= " u.datelastlogin, u.datepreviouslogin,";
$sql.= " u.ldap_sid, u.statut, u.entity,";
$sql.= " u.tms as date_update, u.datec as date_creation,";
@@ -161,6 +195,8 @@ if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_third
if ($search_login != '') $sql.= natural_search("u.login", $search_login);
if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname);
if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname);
if ($search_gender != '' && $search_gender != '-1') $sql.= " AND u.gender = '".$search_gender."'";
if ($search_employee >= 0) $sql.= natural_search("u.employee", $search_employee);
if ($search_accountancy_code != '') $sql.= natural_search("u.accountancy_code", $search_accountancy_code);
if ($search_email != '') $sql.= natural_search("u.email", $search_email);
if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")";
@@ -197,6 +233,8 @@ if ($result)
if ($search_login != '') $param.="&search_login=".$search_login;
if ($search_lastname != '') $param.="&search_lastname=".$search_lastname;
if ($search_firstname != '') $param.="&search_firstname=".$search_firstname;
if ($search_gender != '') $param.="&search_gender=".$search_gender;
if ($search_employee != '') $param.="&search_employee=".$search_employee;
if ($search_accountancy_code != '') $param.="&search_accountancy_code=".$search_accountancy_code;
if ($search_email != '') $param.="&search_email=".$search_email;
if ($search_supervisor > 0) $param.="&search_supervisor=".$search_supervisor;
@@ -224,36 +262,16 @@ if ($result)
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
$arrayfields=array(
'u.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
'u.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'u.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'u.accountancy_code'=>array('label'=>$langs->trans("AccountancyCode"), 'checked'=>0),
'u.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1),
'u.datelastlogin'=>array('label'=>$langs->trans("LastConnexion"), 'checked'=>1, 'position'=>100),
'u.datepreviouslogin'=>array('label'=>$langs->trans("PreviousConnexion"), 'checked'=>0, 'position'=>110),
'u.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'u.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'u.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste">';
print '<tr class="liste_titre">';
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titre($langs->trans("Gender"),$_SERVER['PHP_SELF'],"u.gender",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre($langs->trans("Employee"),$_SERVER['PHP_SELF'],"u.employee",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER['PHP_SELF'],"u.accountancy_code",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER['PHP_SELF'],"u.email",$param,"","",$sortfield,$sortorder);
if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder);
@@ -297,6 +315,19 @@ if ($result)
{
print '<td><input type="text" name="search_firstname" size="6" value="'.$search_firstname.'"></td>';
}
if (! empty($arrayfields['u.gender']['checked']))
{
print '<td>';
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>';
}
if (! empty($arrayfields['u.employee']['checked']))
{
print '<td>';
print $form->selectyesno('search_employee', $search_employee, 1, false, 1);
print '</td>';
}
if (! empty($arrayfields['u.accountancy_code']['checked']))
{
print '<td><input type="text" name="search_accountancy_code" size="4" value="'.$search_accountancy_code.'"></td>';
@@ -382,6 +413,7 @@ if ($result)
$userstatic->societe_id=$obj->fk_soc;
$userstatic->firstname=$obj->firstname;
$userstatic->lastname=$obj->lastname;
$userstatic->employee=$obj->employee;
$userstatic->photo=$obj->photo;
$li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login');
@@ -409,7 +441,17 @@ if ($result)
{
print '<td>'.$obj->firstname.'</td>';
}
if (! empty($arrayfields['u.accountancy_code']['checked']))
if (! empty($arrayfields['u.gender']['checked']))
{
print '<td>';
if ($obj->gender) print $langs->trans("Gender".$obj->gender);
print '</td>';
}
if (! empty($arrayfields['u.employee']['checked']))
{
print '<td>'.yn($obj->employee).'</td>';
}
if (! empty($arrayfields['u.accountancy_code']['checked']))
{
print '<td>'.$obj->accountancy_code.'</td>';
}