From c50a323c25a0787ba2051b19721983776a229615 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 5 Feb 2015 00:40:47 +0100 Subject: Initial commit --- include/offers-new.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/offers-new.php (limited to 'include/offers-new.php') diff --git a/include/offers-new.php b/include/offers-new.php new file mode 100644 index 0000000..46bec3b --- /dev/null +++ b/include/offers-new.php @@ -0,0 +1,39 @@ +. + */ + +require_once('./conf.php'); + +$response = new response(); + +try { + $contact = new contact($_pdo, $_REQUEST['contactId']); + + $offer = $contact->createOffer(); + $response->success = true; + $response->message = "Offer #{$offer->getId()} has been succesfully created. Refresh the page."; +} catch (PDOException $e) { + $response->http_response_code(500); + $response->success = false; + $response->message = "The offer could not be created due to a PDO error ({$e->getMessage()})."; +} catch (Exception $e) { + $response->http_response_code(404); + $response->success = false; + $response->message = "The offer could not be created due to an error."; +} +echo $response->getJson(); \ No newline at end of file -- cgit v1.2.3