Skip to content

Commit

Permalink
Merge pull request #8816 from atm-gauthier/6.0_fix_test_before_delete…
Browse files Browse the repository at this point in the history
…_invoice

FIX : test is_erasable() must be done before call function delete()
  • Loading branch information
eldy committed May 25, 2018
2 parents 5451339 + 0a581e4 commit b25c7e4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions htdocs/compta/facture/card.php
Expand Up @@ -186,13 +186,17 @@
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}

$result = $object->delete($user, 0, $idwarehouse);
if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php');
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action='';
if ($object->is_erasable()) {

$result = $object->delete($user, 0, $idwarehouse);
if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php');
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}

}
}

Expand Down

0 comments on commit b25c7e4

Please sign in to comment.