Delete paybacks and users in when deleting an invoice

This commit is contained in:
Phyks 2013-09-14 23:36:19 +02:00
parent 2fb68a035f
commit 4ff1ce890c
1 changed files with 10 additions and 0 deletions

View File

@ -495,6 +495,16 @@
if($current_user->getAdmin() || $invoice->getBuyer() == $current_user->getId()) {
$invoice->delete();
// Delete related paybacks
$paybacks = new Payback();
$paybacks = $paybacks->load(array('invoice_id'=>(int) $_GET['id']));
if($paybacks !== false) {
foreach($paybacks as $payback) {
$payback->delete();
}
}
// Clear the cache
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));