FIX : 1/ update_extra() function musn't be in "if(!empty(MAIN_DISABLE_CONTACTS_TAB)" test.
2/ Reindented code
This commit is contained in:
parent
e79fe7401f
commit
b3e3cc14a7
@ -1737,40 +1737,41 @@ if (empty($reshook))
|
|||||||
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
|
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
|
||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
|
||||||
$langs->load("errors");
|
|
||||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
else if ($action == 'swapstatut')
|
else if ($action == 'swapstatut')
|
||||||
{
|
{
|
||||||
if ($object->fetch($id)) {
|
if ($object->fetch($id)) {
|
||||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Efface un contact
|
||||||
|
else if ($action == 'deletecontact')
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$result = $object->delete_contact($lineid);
|
||||||
|
|
||||||
|
if ($result >= 0) {
|
||||||
|
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Efface un contact
|
|
||||||
else if ($action == 'deletecontact')
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
$result = $object->delete_contact($lineid);
|
|
||||||
|
|
||||||
if ($result >= 0) {
|
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
|
|
||||||
exit();
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1790,17 +1791,16 @@ if (empty($reshook))
|
|||||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||||
// some hooks
|
// some hooks
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
} else if ($reshook < 0)
|
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
} else if ($reshook < 0)
|
||||||
if ($error)
|
$error ++;
|
||||||
$action = 'edit_extras';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user