diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0f45491dae3..d13c7016831 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -108,18 +108,18 @@ class AdherentType extends CommonObject * Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - "rowid" => array("type" => "integer", "label" => "TechnicalID", "enabled" => "1", 'position' => 10, 'notnull' => 1, "visible" => "-1",), - "tms" => array("type" => "timestamp", "label" => "DateModification", "enabled" => "1", 'position' => 20, 'notnull' => 1, "visible" => "-1",), - "statut" => array("type" => "smallint(6)", "label" => "Statut", "enabled" => "1", 'position' => 500, 'notnull' => 1, "visible" => "-1",), - "libelle" => array("type" => "varchar(50)", "label" => "Label", "enabled" => "1", 'position' => 30, 'notnull' => 1, "visible" => "-1", "showoncombobox" => 1), - "subscription" => array("type" => "varchar(3)", "label" => "Subscription", "enabled" => "1", 'position' => 35, 'notnull' => 1, "visible" => "-1",), - "amount" => array("type" => "double(24,8)", "label" => "Amount", "enabled" => "1", 'position' => 40, 'notnull' => 0, "visible" => "-1",), - "caneditamount" => array("type" => "integer", "label" => "Caneditamount", "enabled" => "1", 'position' => 45, 'notnull' => 0, "visible" => "-1",), + "rowid" => array("type" => "integer", "label" => "Ref", "enabled" => "1", 'position' => 10, 'notnull' => 1, "visible" => "1",), + "libelle" => array("type" => "varchar(50)", "label" => "Label", "enabled" => "1", 'position' => 30, 'notnull' => 1, "visible" => "1", "showoncombobox" => 1), + "subscription" => array("type" => "varchar(3)", "label" => "Subscription", "enabled" => "1", 'position' => 35, 'notnull' => 1, "visible" => "1",), + "amount" => array("type" => "double(24,8)", "label" => "Amount", "enabled" => "1", 'position' => 40, 'notnull' => 0, "visible" => "1",), + "caneditamount" => array("type" => "integer", "label" => "Caneditamount", "enabled" => "1", 'position' => 45, 'notnull' => 0, "visible" => "1",), "vote" => array("type" => "varchar(3)", "label" => "Vote", "enabled" => "1", 'position' => 50, 'notnull' => 1, "visible" => "-1",), - "note" => array("type" => "longtext", "label" => "Note", "enabled" => "1", 'position' => 55, 'notnull' => 0, "visible" => "-1",), - "mail_valid" => array("type" => "longtext", "label" => "Mailvalid", "enabled" => "1", 'position' => 60, 'notnull' => 0, "visible" => "-1",), - "morphy" => array("type" => "varchar(3)", "label" => "Morphy", "enabled" => "1", 'position' => 65, 'notnull' => 0, "visible" => "-1",), - "duration" => array("type" => "varchar(6)", "label" => "Duration", "enabled" => "1", 'position' => 70, 'notnull' => 0, "visible" => "-1",), + "mail_valid" => array("type" => "longtext", "label" => "MailValidation", "enabled" => "1", 'position' => 60, 'notnull' => 0, "visible" => "-3",), + "morphy" => array("type" => "varchar(3)", "label" => "MembersNature", "enabled" => "1", 'position' => 65, 'notnull' => 0, "visible" => "1",), + "duration" => array("type" => "varchar(6)", "label" => "Duration", "enabled" => "1", 'position' => 70, 'notnull' => 0, "visible" => "1",), + "note" => array("type" => "longtext", "label" => "Note", "enabled" => "1", 'position' => 100, 'notnull' => 0, "visible" => "-3",), + "tms" => array("type" => "timestamp", "label" => "DateModification", "enabled" => "1", 'position' => 200, 'notnull' => 1, "visible" => "-1",), + "statut" => array("type" => "smallint(6)", "label" => "Statut", "enabled" => "1", 'position' => 500, 'notnull' => 1, "visible" => "1",), ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 2fea8182f51..b8021e18e2e 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -118,14 +118,17 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields[$tableprefix.'.'.$key] = array( 'label' => $val['label'], - 'checked' => (($visible < 0) ? 0 : 1), - 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'checked' => (($visible < 0) ? '0' : '1'), + 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)), 'position' => $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); } } +$object->fields = dol_sort_array($object->fields, 'position'); +//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); +$arrayfields = dol_sort_array($arrayfields, 'position'); // Security check $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); @@ -294,7 +297,9 @@ $totalarray = [ if (!$rowid && $action != 'create' && $action != 'edit') { //print dol_get_fiche_head([]); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote,"; + $sql .= " d.statut as status, d.morphy, d.duration,"; + $sql .= " d.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -340,9 +345,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup - $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); - // $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup + $selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : ''); + //$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -352,7 +357,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''."\n"; print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); $totalarray['nbfield']++; } @@ -388,11 +393,15 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; $totalarray['nbfield']++; } + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + $totalarray['nbfield']++; + } if (!empty($arrayfields['t.statut']['checked'])) { print ''; $totalarray['nbfield']++; } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); $totalarray['nbfield']++; } @@ -433,7 +442,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } else { print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { if ($user->hasRight('adherent', 'configurer')) { print ''; } @@ -484,10 +493,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if (!empty($arrayfields['t.vote']['checked'])) { print ''; } + if (!empty($arrayfields['t.tms']['checked'])) { + print ''; + } if (!empty($arrayfields['t.statut']['checked'])) { print ''; } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { if ($user->hasRight('adherent', 'configurer')) { print ''; } @@ -864,7 +876,7 @@ if ($rowid > 0) { // Fields title search print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print ''; - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { print '\n"; print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder); @@ -910,7 +922,7 @@ if ($rowid > 0) { print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); } print "\n"; @@ -938,7 +950,7 @@ if ($rowid > 0) { print ''; // Actions - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print '
'.$langs->trans("VoteAllowed").''.$langs->trans("DateModification").''.$langs->trans("Status").'
rowid.'">'.img_edit().''.yn($objp->vote).''.dol_print_date($db->jdate($objp->tms), 'dayhour').''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'
'; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; @@ -889,7 +901,7 @@ if ($rowid > 0) { print ' '; print ''; print '  '; @@ -900,7 +912,7 @@ if ($rowid > 0) { print "
'; if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().''; @@ -1006,7 +1018,7 @@ if ($rowid > 0) { } // Actions - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { print ''; if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().'';