Standardize code

This commit is contained in:
Laurent Destailleur 2024-10-04 19:09:00 +02:00
parent ab5575e0c2
commit 3f0aef062e
4 changed files with 53 additions and 9 deletions

View file

@ -143,6 +143,28 @@ class AdherentType extends CommonObject
public $multilangs = array();
// BEGIN MODULEBUILDER PROPERTIES
/**
* @inheritdoc
* 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",),
"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",),
);
// END MODULEBUILDER PROPERTIES
/**
* Constructor
*

View file

@ -100,6 +100,25 @@ $hookmanager->initHooks(array('membertypecard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Definition of array of fields for columns
$tableprefix = 't';
$arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$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)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
// Security check
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
@ -420,16 +439,18 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$i++;
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
/*$colspan = 1;
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
//if (!empty($val['checked'])) {
$colspan++;
}
}*/
$colspan = 9;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
//}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";

View file

@ -99,8 +99,8 @@ SubscriptionRequiredDesc=If subscription is required, a subscription with a star
DeleteType=Delete
VoteAllowed=Vote allowed
Physical=Individual
Moral=Corporation
MorAndPhy=Corporation and Individual
Moral=Legal entty
MorAndPhy=Legal entity and Individual
Reenable=Re-enable
ExcludeMember=Exclude a member
Exclude=Exclude

View file

@ -3887,10 +3887,11 @@ a.tabTitle {
.imgTabTitle {
max-height: 14px;
}
/*
div.tabs div.tabsElem:first-of-type a.tab {
margin-left: 0px !important;
}
*/
a.tabunactive {
color: var(--colortextlink) !important;
}