FIX : test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url

This commit is contained in:
gauthier 2018-05-18 15:20:16 +02:00
parent 7de812d2ed
commit 4c3f9d6d5e

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