Error management after extrafield update
This commit is contained in:
parent
0b120dd1a9
commit
f24204c79a
@ -186,8 +186,12 @@ if (empty($reshook))
|
|||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) $error++;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($error) $action = 'edit_extras';
|
if ($error) $action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1176,7 +1176,11 @@ if (empty($reshook))
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) $error++;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($error) $action = 'edit_extras';
|
if ($error) $action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1226,7 +1226,9 @@ if (empty($reshook))
|
|||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
|
|||||||
@ -2041,8 +2041,10 @@ if (empty($reshook))
|
|||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
$error ++;
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|||||||
@ -386,22 +386,16 @@ if (empty($reshook))
|
|||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
|
$result = $object->insertExtraFields();
|
||||||
$result = $object->insertExtraFields();
|
if ($result < 0)
|
||||||
if ($result < 0) {
|
{
|
||||||
$error ++;
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
$error++;
|
||||||
} else if ($reshook < 0)
|
}
|
||||||
$error ++;
|
}
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
$action = 'edit_extras';
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
|
|||||||
@ -821,21 +821,19 @@ if (empty($reshook))
|
|||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
|
$result = $object->insertExtraFields();
|
||||||
$result = $object->insertExtraFields();
|
if ($result < 0)
|
||||||
if ($result < 0) {
|
{
|
||||||
$error ++;
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
$error++;
|
||||||
} else if ($reshook < 0)
|
}
|
||||||
$error ++;
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($action=='setref_supplier')
|
elseif ($action=='setref_supplier')
|
||||||
|
|||||||
@ -151,10 +151,10 @@ $langs->load("modulebuilder");
|
|||||||
<tr><td>
|
<tr><td>
|
||||||
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param','alpha'); ?></textarea>
|
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param','alpha'); ?></textarea>
|
||||||
</td><td>
|
</td><td>
|
||||||
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></span>
|
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0,'', 0, 2, 'helpvalue1')?></span>
|
||||||
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
|
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?></span>
|
||||||
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span>
|
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?></span>
|
||||||
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?></span>
|
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?></span>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -173,9 +173,11 @@ if (empty($reshook))
|
|||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
$error++;
|
{
|
||||||
}
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,9 +191,11 @@ if (empty($reshook))
|
|||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
$error++;
|
{
|
||||||
}
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -296,9 +296,11 @@ if (empty($reshook))
|
|||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
$error++;
|
{
|
||||||
}
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,7 +207,9 @@ if ($action == 'update_extras')
|
|||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
|
|||||||
@ -136,9 +136,11 @@ if (empty($reshook))
|
|||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
$error++;
|
{
|
||||||
}
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
} else if ($reshook < 0)
|
} else if ($reshook < 0)
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,11 +290,17 @@ if (empty($reshook))
|
|||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) $error++;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) $action = 'edit_extras';
|
if ($error) $action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -930,11 +930,17 @@ if (empty($reshook))
|
|||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) $error++;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) $action = 'edit_extras';
|
if ($error) $action = 'edit_extras';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user