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