From b3e3cc14a7ebcc0c01fbbf31081414c62b83b656 Mon Sep 17 00:00:00 2001 From: Gauthier <gauthier.verdol@atm-consulting.fr> Date: Thu, 15 Oct 2015 17:26:16 +0200 Subject: [PATCH] FIX : 1/ update_extra() function musn't be in "if(!empty(MAIN_DISABLE_CONTACTS_TAB)" test. 2/ Reindented code --- htdocs/compta/facture.php | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b96edc31b2c..de0a591cf98 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1737,40 +1737,41 @@ if (empty($reshook)) $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); } - if ($result >= 0) { - header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); - exit(); - } else { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + if ($result >= 0) { + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); + exit(); } 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 - else if ($action == 'swapstatut') - { - if ($object->fetch($id)) { - $result = $object->swapContactStatus(GETPOST('ligne')); - } else { - dol_print_error($db); + + // bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id)) { + $result = $object->swapContactStatus(GETPOST('ligne')); + } 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); } - } - - // 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 // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); - if ($result < 0) { - $error ++; - } - } else if ($reshook < 0) + $result = $object->insertExtraFields(); + if ($result < 0) { $error ++; - } - - if ($error) - $action = 'edit_extras'; + } + } else if ($reshook < 0) + $error ++; } + + if ($error) + $action = 'edit_extras'; } } -- GitLab