Better error message
This commit is contained in:
parent
5516eae056
commit
bc6249f0eb
@ -145,3 +145,4 @@ TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
|
||||
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
|
||||
ImportExportProfiles=Import and export profiles
|
||||
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required
|
||||
WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
|
||||
@ -1304,33 +1304,33 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$addfieldentry = array(
|
||||
'name'=>GETPOST('propname', 'aZ09'),
|
||||
'label'=>GETPOST('proplabel', 'alpha'),
|
||||
'type'=>GETPOST('proptype', 'alpha'),
|
||||
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
|
||||
'visible'=>GETPOST('propvisible', 'int'),
|
||||
'enabled'=>GETPOST('propenabled', 'int'),
|
||||
'position'=>GETPOST('propposition', 'int'),
|
||||
'notnull'=>GETPOST('propnotnull', 'int'),
|
||||
'index'=>GETPOST('propindex', 'int'),
|
||||
'searchall'=>GETPOST('propsearchall', 'int'),
|
||||
'isameasure'=>GETPOST('propisameasure', 'int'),
|
||||
'comment'=>GETPOST('propcomment', 'alpha'),
|
||||
'help'=>GETPOST('prophelp', 'alpha'),
|
||||
'css'=>GETPOST('propcss', 'aZ09'),
|
||||
'cssview'=>GETPOST('propcssview', 'aZ09'),
|
||||
'csslist'=>GETPOST('propcsslist', 'aZ09'),
|
||||
'default'=>GETPOST('propdefault', 'restricthtml'),
|
||||
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
|
||||
'validate' => GETPOST('propvalidate', 'int')
|
||||
);
|
||||
if (!$error) {
|
||||
$addfieldentry = array(
|
||||
'name'=>GETPOST('propname', 'aZ09'),
|
||||
'label'=>GETPOST('proplabel', 'alpha'),
|
||||
'type'=>GETPOST('proptype', 'alpha'),
|
||||
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
|
||||
'visible'=>GETPOST('propvisible', 'int'),
|
||||
'enabled'=>GETPOST('propenabled', 'int'),
|
||||
'position'=>GETPOST('propposition', 'int'),
|
||||
'notnull'=>GETPOST('propnotnull', 'int'),
|
||||
'index'=>GETPOST('propindex', 'int'),
|
||||
'searchall'=>GETPOST('propsearchall', 'int'),
|
||||
'isameasure'=>GETPOST('propisameasure', 'int'),
|
||||
'comment'=>GETPOST('propcomment', 'alpha'),
|
||||
'help'=>GETPOST('prophelp', 'alpha'),
|
||||
'css'=>GETPOST('propcss', 'aZ09'),
|
||||
'cssview'=>GETPOST('propcssview', 'aZ09'),
|
||||
'csslist'=>GETPOST('propcsslist', 'aZ09'),
|
||||
'default'=>GETPOST('propdefault', 'restricthtml'),
|
||||
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
|
||||
'validate' => GETPOST('propvalidate', 'int')
|
||||
);
|
||||
|
||||
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
|
||||
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
|
||||
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
|
||||
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,8 +1343,9 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
|
||||
// Edit the class file to write properties
|
||||
if (!$error) {
|
||||
$moduletype = 'external';
|
||||
|
||||
var_dump($addfieldentry);
|
||||
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
|
||||
|
||||
if (is_numeric($object) && $object <= 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -1363,6 +1364,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null);
|
||||
|
||||
setEventMessages($langs->trans('WarningDatabaseIsNotUpdated'), null);
|
||||
|
||||
clearstatcache(true);
|
||||
|
||||
// Make a redirect to reload all data
|
||||
|
||||
Loading…
Reference in New Issue
Block a user