Merge pull request #8816 from atm-gauthier/6.0_fix_test_before_delete_invoice

FIX : test is_erasable() must be done before call function delete()
This commit is contained in:
Laurent Destailleur 2018-05-25 11:05:20 +02:00 committed by GitHub
commit b25c7e44d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,6 +186,8 @@ if (empty($reshook))
$qualified_for_stock_change = $object->hasProductsOrServices(1); $qualified_for_stock_change = $object->hasProductsOrServices(1);
} }
if ($object->is_erasable()) {
$result = $object->delete($user, 0, $idwarehouse); $result = $object->delete($user, 0, $idwarehouse);
if ($result > 0) { if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php');
@ -194,6 +196,8 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action=''; $action='';
} }
}
} }
// Delete line // Delete line