From ae2e40e5e760ff34d6c80dd6bfac831eaf85cb75 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Wed, 5 Apr 2017 19:06:21 +0200 Subject: [PATCH] mark expense report as paid if payement set the remaining sold to 0 --- htdocs/expensereport/payment/payment.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index ebcc1056fe4..56a5b1c7fb3 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -134,6 +134,18 @@ if ($action == 'add_payment') } } + if (!$error) { + $payment->fetch($paymentid); + if ($expensereport->total_ttc - $payment->amount == 0) { + $result = $expensereport->set_paid($expensereport->id, $user); + if (!$result > 0) { + $errmsg = $payment->error; + $error++; + } + } + + } + if (! $error) { $db->commit();