Look and feel v11

This commit is contained in:
Laurent Destailleur 2019-10-16 11:23:06 +02:00
parent e07e01580d
commit 517fcf45d1
2 changed files with 47 additions and 10 deletions

View File

@ -537,6 +537,26 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
}
else
{
/**
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
* 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
*/
/*public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
@ -562,14 +582,31 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
$i=10;
while ($obj = $db->fetch_object($_results))
{
// fieldname
$fieldname = $obj->Field;
// type
$type = $obj->Type;
if ($type == 'int(11)') $type='integer';
// notnull
$notnull = ($obj->Null == 'YES'?0:1);
// label
$label = preg_replace('/_/', ' ', ucfirst($fieldname));
if ($fieldname == 'rowid') $label='ID';
if ($fieldname == 'import_key') $label='ImportKey';
// visible
$visible = -1;
if ($fieldname == 'entity') $visible = -2;
if ($fieldname == 'model_pdf') $visible = 0;
// enabled
$enabled = 1;
// default
$default = '';
if ($fieldname == 'entity') $default=1;
$string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."', 'enabled'=>1, 'visible'=>-2";
$string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
if ($default != '') $string.= " 'default'=>".$default.",";
$string.= " 'enabled'=>".$enabled.",";
$string.= " 'visible'=>".$visible;
if ($notnull) $string.= ", 'notnull'=>".$notnull;
if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1";
$string.= ", 'position'=>".$i."),\n";

View File

@ -1293,9 +1293,9 @@ else
}
// Email / Web
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
print '<td colspan="3"><input type="text" name="email" id="email" value="'.$object->email.'"></td></tr>';
print '<tr><td>'.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
print '<tr><td>'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="url" id="url" value="'.$object->url.'"></td></tr>';
if (! empty($conf->socialnetworks->enabled))
@ -1335,9 +1335,9 @@ else
}
// Phone / Fax
print '<tr><td>'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td>';
print '<td><input type="text" name="phone" id="phone" class="maxwidth100onsmartphone quatrevingtpercent" value="'.$object->phone.'"></td>';
print '<td>'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth100onsmartphone quatrevingtpercent" value="'.$object->fax.'"></td></tr>';
// Prof ids
@ -1916,9 +1916,9 @@ else
}
// EMail / Web
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'</td>';
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email','alpha'), $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'</td>';
print '<td colspan="3"><input type="text" name="email" id="email" size="32" value="'.$object->email.'"></td></tr>';
print '<tr><td>'.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
print '<tr><td>'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url','alpha'), $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="url" id="url" size="32" value="'.$object->url.'"></td></tr>';
if (! empty($conf->socialnetworks->enabled))
@ -1950,9 +1950,9 @@ else
}
// Phone / Fax
print '<tr><td>'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).'</td>';
print '<td><input type="text" name="phone" id="phone" class="maxwidth100onsmartphone quatrevingtpercent" value="'.$object->phone.'"></td>';
print '<td>'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth100onsmartphone quatrevingtpercent" value="'.$object->fax.'"></td></tr>';
// Prof ids
@ -2666,7 +2666,7 @@ else
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
}
if (! empty($conf->adherent->enabled))
{
$adh = new Adherent($db);