Better error message

This commit is contained in:
Laurent Destailleur 2022-03-10 22:17:04 +01:00
parent 5516eae056
commit bc6249f0eb
2 changed files with 30 additions and 26 deletions

View File

@ -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

View File

@ -1304,7 +1304,6 @@ 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(
@ -1333,6 +1332,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
} }
} }
}
/*if (GETPOST('regeneratemissing')) /*if (GETPOST('regeneratemissing'))
{ {
@ -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