From 7aba21dd3e194ef49ed7dfee466856b345717085 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 14 Jan 2023 17:05:45 +0100 Subject: [PATCH 1/2] Update list.php --- htdocs/adherents/list.php | 67 +++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b9cbb252144..39a4d993221 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -73,7 +73,7 @@ $search_categ = GETPOST("search_categ", 'int'); $search_filter = GETPOST("search_filter", 'alpha'); $search_status = GETPOST("search_status", 'intcomma'); $search_morphy = GETPOST("search_morphy", 'alpha'); -$search_import_key = trim(GETPOST("search_import_key", "alpha")); +$search_import_key = trim(GETPOST("search_import_key", 'alpha')); $catid = GETPOST("catid", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); $socid = GETPOST('socid', 'int'); @@ -141,6 +141,7 @@ $fieldstosearchall = array( if ($db->type == 'pgsql') { unset($fieldstosearchall['d.rowid']); } + $arrayfields = array( 'd.ref'=>array('label'=>"Ref", 'checked'=>1), 'd.civility'=>array('label'=>"Civility", 'checked'=>0), @@ -169,6 +170,7 @@ $arrayfields = array( 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), ); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -317,7 +319,11 @@ $formother = new FormOther($db); $membertypestatic = new AdherentType($db); $memberstatic = new Adherent($db); -$title = $langs->trans("Members"); +// Page Header +$title = $langs->trans("Members")." - ".$langs->trans("List");; +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; +llxHeader('', $title, $help_url); + $now = dol_now(); @@ -335,12 +341,14 @@ $sql .= " s.nom,"; $sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,"; $sql .= " t.libelle as type, t.subscription,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; + // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "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 @@ -349,13 +357,16 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total -$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; +// SQL Aliase adherent +$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } $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 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; + +// SQL Aliase adherent_type $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid"; @@ -525,8 +536,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; -llxHeader('', $title, $help_url); if ($search_type > 0) { $membertype = new AdherentType($db); @@ -534,6 +543,7 @@ if ($search_type > 0) { $title .= " (".$membertype->label.")"; } +// $parameters $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); @@ -613,6 +623,7 @@ if ($search_type > 0) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -705,6 +716,7 @@ print ''; + // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; } + // Line numbering if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; @@ -723,32 +736,45 @@ if (!empty($arrayfields['d.ref']['checked'])) { print ''; print ''; } + +// Civility if (!empty($arrayfields['d.civility']['checked'])) { print ''; } + +// First Name if (!empty($arrayfields['d.firstname']['checked'])) { print ''; } + +// Last Name if (!empty($arrayfields['d.lastname']['checked'])) { print ''; } + +// Gender if (!empty($arrayfields['d.gender']['checked'])) { print ''; } + +// Company if (!empty($arrayfields['d.company']['checked'])) { print ''; } + +// Login if (!empty($arrayfields['d.login']['checked'])) { print ''; } + // Nature if (!empty($arrayfields['d.morphy']['checked'])) { print ''; } + +// Member Type if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } @@ -766,51 +794,62 @@ if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } +// Address - Street if (!empty($arrayfields['d.address']['checked'])) { print ''; } +// ZIP if (!empty($arrayfields['d.zip']['checked'])) { print ''; } + +// Town/City if (!empty($arrayfields['d.town']['checked'])) { print ''; } -// State + +// State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print ''; } + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } + // Phone pro if (!empty($arrayfields['d.phone']['checked'])) { print ''; } + // Phone perso if (!empty($arrayfields['d.phone_perso']['checked'])) { print ''; + print ''; } + // Phone mobile if (!empty($arrayfields['d.phone_mobile']['checked'])) { print ''; } + // Email if (!empty($arrayfields['d.email']['checked'])) { print ''; } + // End of subscription date if (!empty($arrayfields['d.datefin']['checked'])) { print ''; } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -826,21 +866,25 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; $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 ''; } + // Birthday if (!empty($arrayfields['d.birth']['checked'])) { print ''; } + // Date modification if (!empty($arrayfields['d.tms']['checked'])) { print ''; } + // Status if (!empty($arrayfields['d.statut']['checked'])) { print ''; } + +// Import Key if (!empty($arrayfields['d.import_key']['checked'])) { print ''; } + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { // Action column print ''; } - + // Technical ID if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; if (!$i) { $totalarray['nbfield']++; } } - // Ref if (!empty($arrayfields['d.ref']['checked'])) { print "\n"; if (!$i) { From cb84d7797f2291824c4d62a835e81ac00e1cc1bd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 14 Jan 2023 16:06:39 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 39a4d993221..d06d91cbea6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -358,7 +358,7 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total // SQL Aliase adherent -$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d +$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; }
'; @@ -712,6 +724,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print $searchpicto; print ' '; print ''; print ''; print ''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother")); print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print ''; print ''; print ''; @@ -756,6 +782,8 @@ if (!empty($arrayfields['d.morphy']['checked'])) { print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print ''; print ''; print ''; print ''; print ''; print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; print ''; - print ''; print ''; print ''; @@ -819,6 +858,7 @@ if (!empty($arrayfields['d.datefin']['checked'])) { print $form->selectarray('search_filter', $selectarray, $search_filter); print ''; print ''; print ''; print ''; @@ -853,11 +897,14 @@ if (!empty($arrayfields['d.statut']['checked'])) { print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; print ''; print ''; @@ -938,6 +985,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $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.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); } @@ -1025,14 +1073,13 @@ while ($i < min($num, $limit)) { } print ''.$obj->rowid.'"; @@ -1142,7 +1189,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // State + // State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."