diff --git a/controllers/addresses_controller.php b/controllers/addresses_controller.php
index 7799b1a1..faf03861 100755
--- a/controllers/addresses_controller.php
+++ b/controllers/addresses_controller.php
@@ -60,19 +60,24 @@ class AddressesController extends AppController {
}
if (!empty($this->data)) {
if ($this->Address->save($this->data)) {
+ $id = $this->Address->id;
+ $address = $this->Address->findById($id);
$this->Session->setFlash(__('The Address has been saved', true));
- $this->redirect(array('action'=>'index'));
+ $this->redirect(array('controller' => 'customers', 'action'=>'view/'.$address['Address']['customer_id']));
} else {
$this->Session->setFlash(__('The Address could not be saved. Please, try again.', true));
}
}
- if (empty($this->data)) {
- $this->data = $this->Address->read(null, $id);
- }
- $customers = $this->Address->Customer->find('list');
+
+ $address = $this->Address->read(null, $id);
+ $customer = $this->Address->Customer->findById($address['Address']['customer_id']);
$states = $this->Address->State->find('list');
$countries = $this->Address->Country->find('list');
- $this->set(compact('customers','states','countries'));
+ $this->set(compact('customer','states','countries', 'address'));
+ if (empty($this->data)) {
+ $this->data = $address;
+ }
+
}
diff --git a/controllers/emails_controller.php b/controllers/emails_controller.php
index f99a8d16..6747c929 100644
--- a/controllers/emails_controller.php
+++ b/controllers/emails_controller.php
@@ -2,8 +2,8 @@
class EmailsController extends AppController {
var $name = 'Emails';
- var $helpers = array('Html', 'Form');
-
+ var $helpers = array('Html', 'Form', 'Number', 'Ajax', 'Text', 'Link');
+ var $components = array('RequestHandler');
function index() {
$this->Email->recursive = 0;
$this->set('emails', $this->paginate());
@@ -31,36 +31,23 @@ class EmailsController extends AppController {
$this->set(compact('enquiries'));
}
- function edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid Email', true));
- $this->redirect(array('action'=>'index'));
- }
- if (!empty($this->data)) {
- if ($this->Email->save($this->data)) {
- $this->Session->setFlash(__('The Email has been saved', true));
- $this->redirect(array('action'=>'index'));
- } else {
- $this->Session->setFlash(__('The Email could not be saved. Please, try again.', true));
- }
- }
- if (empty($this->data)) {
- $this->data = $this->Email->read(null, $id);
- }
- $enquiries = $this->Email->Enquiry->find('list');
- $this->set(compact('enquiries'));
+ function frame($id = null) {
+ $this->set('id', $id);
}
- function delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for Email', true));
- $this->redirect(array('action'=>'index'));
+ function show($id = null) {
+ $this->layout = 'minimal';
+ $this->set('email', $this->Email->read(null, $id));
+
}
- if ($this->Email->del($id)) {
- $this->Session->setFlash(__('Email deleted', true));
- $this->redirect(array('action'=>'index'));
+ /* Violates DRY. Should probably clean this up at some point */
+ function printview($id = null) {
+ $this->layout = 'minimal';
+ $this->set('email', $this->Email->read(null, $id));
+
}
- }
+
+
}
-?>
\ No newline at end of file
+?>
diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php
index 5f121b44..3e982edf 100755
--- a/controllers/enquiries_controller.php
+++ b/controllers/enquiries_controller.php
@@ -4,7 +4,7 @@ App::import('Core', 'Sanitize');
class EnquiriesController extends AppController {
var $name = 'Enquiries';
- var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number');
+ var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number', 'Text');
var $paginate = array(
'limit' => 250,
@@ -30,6 +30,7 @@ class EnquiriesController extends AppController {
$this->set('number_of_emails', $this->Enquiry->Email->find('count', array('conditions'=>array('Email.enquiry_id'=>$id))));
$this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id))));
$this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id))));
+
if($enquiry['Enquiry']['billing_address_id'] != 0) {
$this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id']));
}
diff --git a/views/addresses/edit.ctp b/views/addresses/edit.ctp
index 6ce2ee1b..790f19f8 100755
--- a/views/addresses/edit.ctp
+++ b/views/addresses/edit.ctp
@@ -4,12 +4,12 @@
input('id');
- echo $form->input('name');
echo $form->input('address');
echo $form->input('city');
+ echo $form->input('postcode');
echo $form->input('state_id');
echo $form->input('country_id');
- echo $form->input('customer_id');
+ echo $form->input('customer_id', array('type' => 'hidden', 'value' => $customer['Customer']['id']));
echo $form->input('type', array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing')));
?>
diff --git a/views/elements/email/html/enquiry_added.ctp b/views/elements/email/html/enquiry_added.ctp
index 78e8a52f..8f229cb2 100644
--- a/views/elements/email/html/enquiry_added.ctp
+++ b/views/elements/email/html/enquiry_added.ctp
@@ -14,7 +14,7 @@ Please see below for the contact details we have for this enquiry and advise if
Mobile: Fax:
-Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your application is more complex, it may take longer.
+Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your enquiry is non-standard, it may take a little longer.
Sincerely,
diff --git a/views/elements/email/text/enquiry_added.ctp b/views/elements/email/text/enquiry_added.ctp
index 75085ffd..ee2a36d0 100644
--- a/views/elements/email/text/enquiry_added.ctp
+++ b/views/elements/email/text/enquiry_added.ctp
@@ -18,7 +18,7 @@ Mobile:
Fax:
-Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your application is more complex, it may take longer.
+Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your enquiry is non-standard, it may take a little longer.
Sincerely,
diff --git a/views/elements/email_table.ctp b/views/elements/email_table.ctp
index 226a8929..a49b4630 100644
--- a/views/elements/email_table.ctp
+++ b/views/elements/email_table.ctp
@@ -1,11 +1,12 @@
-