aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/home.php4
-rw-r--r--include/offers-edit.php7
2 files changed, 7 insertions, 4 deletions
diff --git a/include/home.php b/include/home.php
index c9d0cf3..51d899b 100644
--- a/include/home.php
+++ b/include/home.php
@@ -115,7 +115,7 @@ require('./header.php');
$count = count(BusinessAdmin::getOfferIds($_pdo, array(
"`invoice_date` > '1970-01-01'",
"`invoice_date`<=CURDATE()",
- "NOT EXISTS (SELECT * FROM `".constants::db_prefix."payment` WHERE `offerId`=`".constants::db_prefix."offer`.`id` AND `date` != TIMESTAMP(0))")));
+ "NOT EXISTS (SELECT * FROM `".constants::db_prefix."payment` WHERE `offerId`=`".constants::db_prefix."offer`.`id`)")));
?>
<div class="panel panel-<?=($count==0 ? 'primary' : 'yellow')?>">
<div class="panel-heading">
@@ -242,7 +242,7 @@ require('./header.php');
$offers = BusinessAdmin::getOffers($_pdo, array(
"`invoice_date` > '1970-01-01'",
"`invoice_date`<=CURDATE()",
- "NOT EXISTS (SELECT * FROM `".constants::db_prefix."payment` WHERE `offerId`=`".constants::db_prefix."offer`.`id` AND `date` != TIMESTAMP(0))"));
+ "NOT EXISTS (SELECT * FROM `".constants::db_prefix."payment` WHERE `offerId`=`".constants::db_prefix."offer`.`id`)"));
if (count($offers) == 0) {
echo "<tr><td colspan='3'>There are no currently open invoices.</td></tr>";
} else {
diff --git a/include/offers-edit.php b/include/offers-edit.php
index 5ed95c4..225a18c 100644
--- a/include/offers-edit.php
+++ b/include/offers-edit.php
@@ -39,10 +39,13 @@ try {
break;
case 'payment_received':
$payment = $offer->getPayment();
+ $date = strtotime($_REQUEST['value']);
if (is_null($payment)) {
- $response->success = $offer->createPayment(strtotime($_REQUEST['value']));
+ $response->success = $offer->createPayment($date);
+ } elseif ($date === false) {
+ $response->success = $payment->delete();
} else {
- $response->success = $payment->setDate(strtotime($_REQUEST['value']));
+ $response->success = $payment->setDate($date);
}
break;
default: