aboutsummaryrefslogtreecommitdiff
path: root/include/offers.php
diff options
context:
space:
mode:
authorCamil Staps2016-07-31 09:40:25 +0200
committerCamil Staps2016-07-31 09:40:25 +0200
commit1ec8d12a7b125d41ecb723c5d83f2afef95408e9 (patch)
tree4d103ccbab48d2217e1ae13d37c229e4060e9184 /include/offers.php
parentGive new files a key (diff)
0.5.2 emails
Diffstat (limited to 'include/offers.php')
-rw-r--r--include/offers.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/offers.php b/include/offers.php
index 8be7530..dbe5df0 100644
--- a/include/offers.php
+++ b/include/offers.php
@@ -37,6 +37,7 @@ require('./header.php');
// ?toggle_payment_eligibility=<id> Toggle the payment eligibility of the offer with id <id>
// ?generate_invoice=<id> Generate an invoice for the offer with id <id>
// ?trash_invoice=<id> Trash the invoice file
+ // ?send_invoice=<id> Send invoice to contact
// ?delete=<id> Delete the offer with id <id>
//------------------------------------------------------------------------------
@@ -137,6 +138,25 @@ require('./header.php');
echo "</div>";
}
+ // Send invoice
+ if (isset($_GET['send_invoice'])) {
+ echo "<div class='col-lg-12'>";
+ $id = (int) $_GET['send_invoice'];
+ try {
+ $offer = new Offer($_pdo, $id);
+ if ($offer->send()) {
+ echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close fa fa-times' data-dismiss='alert' aria-hidden='true'></button>The invoice for offer {$id} has been sent to {$offer->getContact()->email}.</div>";
+ } else {
+ echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close fa fa-times' data-dismiss='alert' aria-hidden='true'></button>The invoice could not be sent due to an unknown error.</div>";
+ }
+ } catch (PDOException $e) {
+ echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close fa fa-times' data-dismiss='alert' aria-hidden='true'></button>The invoice could not be sent due to a PDO error.</div>";
+ } catch (Exception $e) {
+ echo "<div class='alert alert-warning alert-dismissable'><button type='button' class='close fa fa-times' data-dismiss='alert' aria-hidden='true'></button>The offer with id {$id} could not be found.</div>";
+ }
+ echo "</div>";
+ }
+
// Delete offer
if (isset($_GET['delete'])) {
echo "<div class='col-lg-12'>";