From 390251ac43ca889a318369342b4663ef928349d8 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 27 Jul 2016 21:06:48 +0200 Subject: Contact: use Model --- include/assignments-overview.php | 4 ++-- include/clients-view.php | 18 +++++++++--------- include/contacts-edit.php | 15 ++++++++------- include/contacts-new.php | 2 +- include/contacts-overview.php | 26 +++++++++++++------------- include/contacts.php | 6 +++--- include/discounts-overview.php | 4 ++-- include/home.php | 2 +- include/offers-overview.php | 4 ++-- include/offers-view.php | 2 +- 10 files changed, 42 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/include/assignments-overview.php b/include/assignments-overview.php index 9fa226f..e10323b 100644 --- a/include/assignments-overview.php +++ b/include/assignments-overview.php @@ -47,7 +47,7 @@ require_once('./login.php'); {$assignment->id} #{$assignment->getOffer()->getId()} to - {$assignment->getOffer()->getContact()->getName()} + {$assignment->getOffer()->getContact()->name} ({$assignment->getOffer()->getContact()->getClient()->name}) {$assignment->title}
@@ -86,7 +86,7 @@ require_once('./login.php'); diff --git a/include/clients-view.php b/include/clients-view.php index 2472a80..6648026 100644 --- a/include/clients-view.php +++ b/include/clients-view.php @@ -40,18 +40,18 @@ $_client = new Client($_pdo, $_id); $contacts = $_client->getContacts(); foreach ($contacts as $contact) { echo " - {$contact->getId()} - {$contact->getName()} + {$contact->id} + {$contact->name} - {$contact->getAddress()}
- {$contact->getPostalCode()} - {$contact->getCity()}
- {$contact->getCountry()} + {$contact->address}
+ {$contact->postal_code} + {$contact->city}
+ {$contact->country} - {$contact->getLanguage()} + {$contact->language} - - + + "; } diff --git a/include/contacts-edit.php b/include/contacts-edit.php index ead27d9..a0ffdee 100644 --- a/include/contacts-edit.php +++ b/include/contacts-edit.php @@ -21,6 +21,7 @@ require_once('./conf.php'); require_once('./login-ajax.php'); $response = new Response(); +$response->success = true; try { $contact = new Contact($_pdo, $_REQUEST['pk']); @@ -29,25 +30,25 @@ try { $what_to_edit = $name[count($name) - 1]; switch ($what_to_edit) { case 'name': - $response->success = $contact->setName($_REQUEST['value']); + $contact->name = $_REQUEST['value']; break; case 'email': - $response->success = $contact->setEmail($_REQUEST['value']); + $contact->email = $_REQUEST['value']; break; case 'address': - $response->success = $contact->setAddress($_REQUEST['value']); + $contact->address = $_REQUEST['value']; break; case 'postal_code': - $response->success = $contact->setPostalCode($_REQUEST['value']); + $contact->postal_code = $_REQUEST['value']; break; case 'city': - $response->success = $contact->setCity($_REQUEST['value']); + $contact->city = $_REQUEST['value']; break; case 'country': - $response->success = $contact->setCountry($_REQUEST['value']); + $contact->country = $_REQUEST['value']; break; case 'language': - $response->success = $contact->setLanguage($_REQUEST['value']); + $contact->language = $_REQUEST['value']; break; default: $response->http_response_code(404); diff --git a/include/contacts-new.php b/include/contacts-new.php index c75298c..b671be4 100644 --- a/include/contacts-new.php +++ b/include/contacts-new.php @@ -35,7 +35,7 @@ try { $_REQUEST['country'] ); $response->success = true; - $response->message = "Contact {$contact->getName()} has been succesfully created. Refresh the page."; + $response->message = "Contact {$contact->name} has been succesfully created. Refresh the page."; } catch (PDOException $e) { $response->http_response_code(500); $response->success = false; diff --git a/include/contacts-overview.php b/include/contacts-overview.php index 4f2e6cf..fcd788e 100644 --- a/include/contacts-overview.php +++ b/include/contacts-overview.php @@ -39,28 +39,28 @@ require_once('./login.php'); $contacts = BusinessAdmin::getContacts($_pdo); foreach ($contacts as $contact) { echo " - {$contact->getId()} + data-mixer-order-id='{$contact->id}' + data-mixer-order-name='{$contact->name}'> + {$contact->id} - {$contact->getName()}
+ {$contact->name}
({$contact->getClient()->name}) - {$contact->getEmail()}
+ {$contact->email}

- {$contact->getAddress()}
- " . ($contact->getAddress_2() != '' ? "{$contact->getAddress_2()}
" : "") . " - {$contact->getPostalCode()} - {$contact->getCity()}
- {$contact->getCountry()} + {$contact->address}
+ " . ($contact->address_2 != '' ? "{$contact->address_2}
" : "") . " + {$contact->postal_code} + {$contact->city}
+ {$contact->country} - {$contact->getLanguage()} + {$contact->language} - - + + "; } diff --git a/include/contacts.php b/include/contacts.php index 1231e24..28656c9 100644 --- a/include/contacts.php +++ b/include/contacts.php @@ -46,7 +46,7 @@ require('./header.php'); $id = (int) $_GET['id']; try { $contact = new Contact($_pdo, $id); - $header = "Contacts / {$contact->getName()}"; + $header = "Contacts / {$contact->name}"; $show_individual = $id; } catch (PDOException $e) { $alert = "
The contact with id $id could not be found.
"; @@ -66,9 +66,9 @@ require('./header.php'); try { $contact = new Contact($_pdo, $id); if ($contact->delete()) { - echo "
The contact with name {$contact->getName()} has been removed.
"; + echo "
The contact with name {$contact->name} has been removed.
"; } else { - echo "
The contact with name {$contact->getName()} could not be removed. Perhaps it's already removed?
"; + echo "
The contact with name {$contact->name} could not be removed. Perhaps it's already removed?
"; } } catch (PDOException $e) { echo "
The contact could not be removed due to a PDO error.
"; diff --git a/include/discounts-overview.php b/include/discounts-overview.php index 0b0534d..5253fd2 100644 --- a/include/discounts-overview.php +++ b/include/discounts-overview.php @@ -45,7 +45,7 @@ require_once('./login.php'); {$discount->id} #{$discount->getOffer()->getId()} to - {$discount->getOffer()->getContact()->getName()} + {$discount->getOffer()->getContact()->name} ({$discount->getOffer()->getContact()->getClient()->name}) {$discount->title}
@@ -83,7 +83,7 @@ require_once('./login.php'); diff --git a/include/home.php b/include/home.php index 3b461bc..f90d9d3 100644 --- a/include/home.php +++ b/include/home.php @@ -280,7 +280,7 @@ require('./header.php'); foreach ($offers as $offer) { $temp = array( 'id' => $offer->getId(), - 'contact' => $offer->getContact()->getName(), + 'contact' => $offer->getContact()->name, 'assignments' => '', 'assignments_header' => '' ); diff --git a/include/offers-overview.php b/include/offers-overview.php index 2c5b483..b172629 100644 --- a/include/offers-overview.php +++ b/include/offers-overview.php @@ -43,7 +43,7 @@ require_once('./login.php'); echo " {$offer->getId()} - {$offer->getContact()->getName()} + {$offer->getContact()->name} "; foreach ($offer->getAssignments() as $assignment) { echo "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(assignment::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(assignment::TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; @@ -120,7 +120,7 @@ require_once('./login.php'); diff --git a/include/offers-view.php b/include/offers-view.php index 9a2978f..aba4c26 100644 --- a/include/offers-view.php +++ b/include/offers-view.php @@ -35,7 +35,7 @@ $_offer = new Offer($_pdo, $_id); $temp = array( 'id' => $_offer->getId(), - 'contact' => $_offer->getContact()->getName(), + 'contact' => $_offer->getContact()->name, 'assignments' => '', 'assignments_header' => '' ); -- cgit v1.2.3