From d1792506d279589ff6e380db0ad6bc96a63d2788 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Tue, 23 Mar 2010 10:03:03 +1100 Subject: [PATCH] Email vault coming along. Implementing jQuery powered view for next commit --- controllers/enquiries_controller.php | 2 + models/email.php | 27 ++- models/email_attachment.php | 3 +- models/enquiry.php | 345 ++++++++++++++------------- vendors/shells/vault.php | 74 ++++-- views/elements/email_table_ajax.ctp | 98 ++++---- views/enquiries/view.ctp | 248 +++++++++---------- 7 files changed, 422 insertions(+), 375 deletions(-) diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index a9221648..f9292adb 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -65,6 +65,8 @@ class EnquiriesController extends AppController { * Fix up Email Attachment icon on email box. Currently broken -KC 6/8/09 $this->set('number_of_emails', $this->Enquiry->Email->find('count', array('conditions'=>array('Email.enquiry_id'=>$id)))); */ + + $this->set('emails', $this->Enquiry->Email->find('all', 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)))); $this->set('principle_emails', $this->Enquiry->Principle->PrincipleContact->findAllByPrincipleId($enquiry['Enquiry']['principle_id'])); diff --git a/models/email.php b/models/email.php index 10462e03..7fb0e690 100755 --- a/models/email.php +++ b/models/email.php @@ -1,17 +1,18 @@ array('className' => 'Enquiry', - 'foreignKey' => 'enquiry_id')); - - var $hasMany = array( - 'EmailAttachment' => array('className' => 'EmailAttachment', - 'foreignKey' => 'email_id', - 'dependent' => false - )); - - } + var $name = 'Email'; + + var $belongsTo = array( + 'Enquiry' => array('className' => 'Enquiry', + 'foreignKey' => 'enquiry_id', + 'counterCache' => true)); + + var $hasMany = array( + 'EmailAttachment' => array('className' => 'EmailAttachment', + 'foreignKey' => 'email_id', + 'dependent' => false + )); + +} ?> diff --git a/models/email_attachment.php b/models/email_attachment.php index 58ee5e08..94793a0d 100755 --- a/models/email_attachment.php +++ b/models/email_attachment.php @@ -6,7 +6,8 @@ class EmailAttachment extends AppModel { var $belongsTo = array( 'Email' => array('className' => 'Email', 'foreignKey' => 'email_id', - 'conditions' => '', + 'counterCache' => true, + 'conditions' => '', 'fields' => '', 'order' => '' )); diff --git a/models/enquiry.php b/models/enquiry.php index 8c9b8cc1..3f38a82f 100755 --- a/models/enquiry.php +++ b/models/enquiry.php @@ -1,188 +1,191 @@ array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'User ID must be selected', - 'on' => 'create' - ), - 'customer_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Customer for this Enquiry', - 'on' => 'create' - ), - - 'contact_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Contact for this Enquiry', - //'on' => 'create' - ), - - 'customer_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Customer for this Enquiry', - 'on' => 'create' - ), + var $validate = array( + 'user_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'User ID must be selected', + 'on' => 'create' + ), + 'customer_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Customer for this Enquiry', + 'on' => 'create' + ), - 'state_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a State for this Enquiry', - 'on' => 'create' - ), - - 'country_id' => array( - 'numeric' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Country for this Enquiry', - 'on' => 'create' - ), - 'checkStates' => array( - 'rule' => array('checkStates'), - 'message' => 'Australian Enquiries must be assigned to Australian States. Overseas Enquiries must be assigned to other Countries', - 'on' => 'create')), - - 'principle_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Principle for this Enquiry', - 'on' => 'create' - ), - - 'status_id' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must choose a Status for this Enquiry' - ), - 'gst' => array( - 'rule' => 'numeric', - 'required' => true, - 'message' => 'Must select whether GST is applicable for this Enquiry', - 'on' => 'create' - ) - ); + 'contact_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Contact for this Enquiry', + //'on' => 'create' + ), - /*Custom Validation Rule to Check that Enquiries with Australian States are assigned to Australia. + 'customer_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Customer for this Enquiry', + 'on' => 'create' + ), + + 'state_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a State for this Enquiry', + 'on' => 'create' + ), + + 'country_id' => array( + 'numeric' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Country for this Enquiry', + 'on' => 'create' + ), + 'checkStates' => array( + 'rule' => array('checkStates'), + 'message' => 'Australian Enquiries must be assigned to Australian States. Overseas Enquiries must be assigned to other Countries', + 'on' => 'create')), + + 'principle_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Principle for this Enquiry', + 'on' => 'create' + ), + + 'status_id' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must choose a Status for this Enquiry' + ), + 'gst' => array( + 'rule' => 'numeric', + 'required' => true, + 'message' => 'Must select whether GST is applicable for this Enquiry', + 'on' => 'create' + ) + ); + + /*Custom Validation Rule to Check that Enquiries with Australian States are assigned to Australia. * and that Overseas enquiries are NOT assigned to Australia. * Not Portable at all. This code is only for CMC usage * Should probably change this to use RegExes. - */ - - function checkStates($data) { - if($this->data['Enquiry']['country_id'] != 1) { //This Enquiry is not for Australia. State must be set to overseas. - if($this->data['Enquiry']['state_id'] != 9) { //The State isn't set to Overseas. Return false - return FALSE; - } - else { - return TRUE; - } - } - if($this->data['Enquiry']['country_id'] == 1) { //This enquiry is for Australia. State must be for an Australian State - if($this->data['Enquiry']['state_id'] == 9) { - return FALSE; - } - else { - return TRUE; - } - } - } - - - //The Associations below have been created with all possible keys, those that are not needed can be removed - var $belongsTo = array( - 'User' => array('className' => 'User', - 'foreignKey' => 'user_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Customer' => array('className' => 'Customer', - 'foreignKey' => 'customer_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Contact' => array('className' => 'Contact', - 'foreignKey' => 'contact_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'State' => array('className' => 'State', - 'foreignKey' => 'state_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Country' => array('className' => 'Country', - 'foreignKey' => 'country_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Principle' => array('className' => 'Principle', - 'foreignKey' => 'principle_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Status' => array('className' => 'Status', - 'foreignKey' => 'status_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'BillingAddress' => array('className' => 'Address', - 'foreignKey' => 'billing_address_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'ShippingAddress' => array('className' => 'Address', - 'foreignKey' => 'shipping_address_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - - - ); + */ - var $hasMany = array( - 'Quote' => array('className' => 'Quote', - 'foreignKey' => 'enquiry_id', - 'dependent' => false, - 'conditions' => '', - 'fields' => '', - 'order' => '', - 'limit' => '', - 'offset' => '', - 'exclusive' => '', - 'finderQuery' => '', - 'counterQuery' => '' - ), - - /* 'EnquiryFile' => array('className' => 'EnquiryFile', + function checkStates($data) { + if($this->data['Enquiry']['country_id'] != 1) { //This Enquiry is not for Australia. State must be set to overseas. + if($this->data['Enquiry']['state_id'] != 9) { //The State isn't set to Overseas. Return false + return FALSE; + } + else { + return TRUE; + } + } + if($this->data['Enquiry']['country_id'] == 1) { //This enquiry is for Australia. State must be for an Australian State + if($this->data['Enquiry']['state_id'] == 9) { + return FALSE; + } + else { + return TRUE; + } + } + } + + + //The Associations below have been created with all possible keys, those that are not needed can be removed + var $belongsTo = array( + 'User' => array('className' => 'User', + 'foreignKey' => 'user_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Customer' => array('className' => 'Customer', + 'foreignKey' => 'customer_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Contact' => array('className' => 'Contact', + 'foreignKey' => 'contact_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'State' => array('className' => 'State', + 'foreignKey' => 'state_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Country' => array('className' => 'Country', + 'foreignKey' => 'country_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Principle' => array('className' => 'Principle', + 'foreignKey' => 'principle_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'Status' => array('className' => 'Status', + 'foreignKey' => 'status_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'BillingAddress' => array('className' => 'Address', + 'foreignKey' => 'billing_address_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'ShippingAddress' => array('className' => 'Address', + 'foreignKey' => 'shipping_address_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + + + ); + + var $hasMany = array( + 'Quote' => array('className' => 'Quote', + 'foreignKey' => 'enquiry_id', + 'dependent' => false, + 'conditions' => '', + 'fields' => '', + 'order' => '', + 'limit' => '', + 'offset' => '', + 'exclusive' => '', + 'finderQuery' => '', + 'counterQuery' => '' + ), + + + 'Email' => array('className' => 'Email', + 'foreignKey' => 'enquiry_id', + 'dependent' => false + ), + + + /* 'EnquiryFile' => array('className' => 'EnquiryFile', 'foreignKey' => 'enquiry_id', 'dependent' => false ),*/ - - /*'Email' => array('className' => 'Email', - 'foreignKey' => 'enquiry_id', - 'dependent' => false - ), - */ - ); - var $hasOne = array('EnquiryEmailQueue'); + + ); + + var $hasOne = array('EnquiryEmailQueue'); } ?> diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index 518f4fdb..68179e41 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -17,11 +17,17 @@ class VaultShell extends Shell { /* Setup Connection to the IMAP server */ $username = 'vault'; $password = 'xjdYOsmJWc37'; /* The password for the account to be checked */ - $email_dir = '/var/www/cakephp/app/emails/working'; + $email_dir = '/var/www/cakephp/app/emails'; $temp_filename = 'temp.eml'; + + $ripmime_path = '/usr/local/bin/ripmime'; + if($testing == 1) { - $email_dir = '/Users/karlcordes/Sites/app/emails/working'; + $email_dir = '/Users/karlcordes/Sites/quotenik/app/emails'; + + $ripmime_path = '/opt/local/bin/ripmime'; + } $mbox = imap_open("{mail.cmctechnologies.com.au:143}INBOX", $username, $password) or die("can't connect: " . imap_last_error()); @@ -33,19 +39,24 @@ class VaultShell extends Shell { if($number_of_messages == 0) { exit(0); } - exit(0); + /* Loop through the messages and sort them into ones to be processed or discarded */ - for ($i=1; $i <= $number_of_messages; $i++) { + for ($i=30000; $i <= $number_of_messages; $i++) { $this_header = imap_headerinfo($mbox, $i); $message = $this->getMessage($mbox, $i, $this_header); - echo "Checking msg number: $i \tSubject: ".$message['subject']."\n"; + //echo "Checking msg number: $i \tSubject: ".$message['subject']."\n"; $enquiry = $this->checkIfValidEnquiry($message['subject'], $testing); if($enquiry) { - + echo "Found Enquiry number: ".$enquiry['Enquiry']['title']." Processing.\n"; //Process it and store the message and its attachments. + //Generate a Uniqid for this email. + $uniqid = $this->getUniqId($email_dir); + + + $this->Email->create(); $this->data['Email']['enquiry_id'] = $enquiry['Enquiry']['id']; $this->data['Email']['to'] = $message['to']; @@ -55,27 +66,28 @@ class VaultShell extends Shell { $this->data['Email']['subject'] = $message['subject']; $this->data['Email']['body'] = ""; $this->data['Email']['plainbody'] = ""; + $this->data['Email']['uniqid'] = $uniqid; $structure = imap_fetchstructure($mbox, $i); $attachments = 1; if (empty($structure->parts)) { /* A single part message. No attachments and is plain text */ $this->data['Email']['body'] = imap_body($mbox, $i); } else { - $attachments = $this->fetchBodyAttachments($mbox, $i, $temp_filename, $email_dir); + $attachments = $this->fetchBodyAttachments($mbox, $i, $temp_filename, $email_dir, $uniqid, $ripmime_path); if($attachments != 1) { foreach ($attachments as $attachment) { if($attachment['type'] == 'text/html') { //Assuming All HTML attachments are the body of the email - if(file_exists($email_dir.'/'.$attachment['name'])) { - $filecontents = file_get_contents($email_dir.'/'.$attachment['name']); - $size = filesize($email_dir.'/'.$attachment['name']); + if(file_exists($email_dir.'/'.$uniqid.'/'.$attachment['name'])) { + $filecontents = file_get_contents($email_dir.'/'.$uniqid.'/'.$attachment['name']); + $size = filesize($email_dir.'/'.$uniqid.'/'.$attachment['name']); $this->data['Email']['body'] .= $filecontents; } } if($attachment['type'] == 'text/plain') { //Found plain text if(file_exists($email_dir.'/'.$attachment['name'])) { - $filecontents = file_get_contents($email_dir.'/'.$attachment['name']); - $size = filesize($email_dir.'/'.$attachment['name']); + $filecontents = file_get_contents($email_dir.'/'.$uniqid.'/'.$attachment['name']); + $size = filesize($email_dir.'/'.$uniqid.'/'.$attachment['name']); $this->data['Email']['plainbody'] .= $filecontents; } @@ -92,7 +104,7 @@ class VaultShell extends Shell { $email_id = $this->Email->id; if($attachments != 1) { foreach ($attachments as $attachment) { - if(file_exists($email_dir.'/'.$attachment['name']) != FALSE) { + if(file_exists($email_dir.'/'.$uniqid.'/'.$attachment['name']) != FALSE) { if( ($attachment['type'] != 'text/html') && ($attachment['type'] != 'multipart/mixed') && ($attachment['type'] != 'multipart/alternative') ) { @@ -101,7 +113,7 @@ class VaultShell extends Shell { $this->data['EmailAttachment']['name'] = $attachment['name']; $this->data['EmailAttachment']['type'] = $attachment['type']; $this->data['EmailAttachment']['size'] = filesize($email_dir.'/'.$attachment['name']); - $this->data['EmailAttachment']['data'] = file_get_contents($email_dir.'/'.$attachment['name']); + $this->data['EmailAttachment']['filename'] = $email_dir.'/'.$uniqid.'/'.$attachment['name']; if ($this->EmailAttachment->save($this->data)) { echo "Saved file successfully to database\n"; } @@ -150,7 +162,7 @@ class VaultShell extends Shell { } - $this->rmdirr($email_dir); //delete all attachments from the working directory. Easiest way to stop random files persisting + // $this->rmdirr($email_dir); //delete all attachments from the working directory. Easiest way to stop random files persisting @@ -191,11 +203,17 @@ class VaultShell extends Shell { * */ - function fetchBodyAttachments($mailbox, $msg_number, $filename, $email_dir) { + function fetchBodyAttachments($mailbox, $msg_number, $filename, $email_dir, $uniqid, $ripmime_path) { - $email_file = $email_dir.'/'.$filename; + $mkdirresult = mkdir ($email_dir.'/'.$uniqid); + if($mkdirresult == FALSE) { + echo "ERROR: Failed to make ".$email_dir.'/'.$uniqid; + return 1; + } + + $email_file = $email_dir.'/'.$uniqid.'/'.$filename; imap_savebody($mailbox, $email_file, $msg_number); - $command = "/usr/local/bin/ripmime -i $email_file -d $email_dir -v --verbose-contenttype --paranoid --prefix $msg_number"; + $command = "$ripmime_path -i $email_file -d $email_dir/$uniqid -v --verbose-contenttype --paranoid --prefix $msg_number"; $output = array(); exec($command, $output, $status); @@ -237,7 +255,7 @@ class VaultShell extends Shell { function getMessage($mbox, $msgnumber, $headers) { $subject = $headers->subject; - $subject = iconv_mime_decode($subject, 0, "ISO-8859-1"); + $subject = iconv_mime_decode($subject, 0, "ISO-8859-1//IGNORE"); $date = $headers->date; $recipients = $this->getRecipients($headers); $message['subject'] = $subject; @@ -309,7 +327,7 @@ class VaultShell extends Shell { if(isset($output[0])) { //Found a valid-looking Enquiry Number $fetched_enquirynumber = $output[0]; - echo $fetched_enquirynumber."\n"; + // echo $fetched_enquirynumber."\n"; $enquiry = $this->Enquiry->findByTitle($fetched_enquirynumber); if($enquiry) { return $enquiry; @@ -359,5 +377,21 @@ class VaultShell extends Shell { //rmdir($dirname); } + + /** + * Generate a uniq id. + * @todo Ensure the sub-directory doesn't exist to avoid collisions + * + */ + + function getUniqId($email_dir) { + $uniqid = uniqid(null,TRUE); + //while(is_dir($email_dir."/".$uniqid) == TRUE) { + // + // } + return $uniqid; + + } + } ?> diff --git a/views/elements/email_table_ajax.ctp b/views/elements/email_table_ajax.ctp index eba79ab0..ed8f6643 100755 --- a/views/elements/email_table_ajax.ctp +++ b/views/elements/email_table_ajax.ctp @@ -1,51 +1,53 @@ + + - - - - - - - - - - - - - > - - - - - - - - - - - -
image('attach.png'); ?>
0) { - echo $html->image('attach.png'); - } - ?> - - - highlight($ajax->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id']), array('update'=>'showemail')), 'Quotation'); ?> - link(__('View', true), array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); - echo $ajax->link('View', array('controller'=>'emails', 'action'=>'frame/', $email['Email']['id']), array('update' => 'showemail')); - echo $html->link('Print', array('controller' => 'emails', 'action'=>'printview/', $email['Email']['id'])); - ?> -
+ + + image('attach.png'); ?> + + + + + + + + + + > + + + 0) { + echo $html->image('attach.png'); + } + ?> + + + + highlight($ajax->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id']), array('update'=>'showemail')), 'Quotation'); ?> + + + + + + link(__('View', true), array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); + echo $ajax->link('View', array('controller'=>'emails', 'action'=>'frame/', $email['Email']['id']), array('update' => 'showemail')); + echo $html->link('Print', array('controller' => 'emails', 'action'=>'printview/', $email['Email']['id'])); + ?> + + + + diff --git a/views/enquiries/view.ctp b/views/enquiries/view.ctp index 3d920687..f58a9000 100755 --- a/views/enquiries/view.ctp +++ b/views/enquiries/view.ctp @@ -1,141 +1,145 @@
-

-
- - > - > - -   - - > - > - link($enquiry['User']['username'], array('controller'=> 'users', 'action'=>'view', $enquiry['User']['id'])); ?> -   - - > - > - link($enquiry['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiry['Customer']['id'])); ?> -   - - > - > - link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?> -   - - > - > - link($enquiry['State']['name'], array('controller'=> 'states', 'action'=>'view', $enquiry['State']['id'])); ?> -   - - > - > - link($enquiry['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $enquiry['Country']['id'])); ?> -   - - > - > - -   - - > - > - link($enquiry['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $enquiry['Principle']['id'])); ?> -   - - > - > - link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?> -   - - > - > - - - -   - - - > - > - '; - echo $enquiry['BillingAddress']['city'].' '.$billingaddress['State']['name'].' '.$enquiry['BillingAddress']['postcode'].'
'; - echo ''.$billingaddress['Country']['name'].''; - } - else { - echo 'No Billing Address Assigned for this Enquiry'; - } - ?> -   - - - > - > - '; - echo $enquiry['ShippingAddress']['city'].' '.$shippingaddress['State']['name'].' '.$enquiry['ShippingAddress']['postcode'].'
'; - echo ''.$shippingaddress['Country']['name'].''; - } - else { echo 'No Shipping Address Assigned for this Enquiry'; - } - ?> -   - - - -
+

+
-
-
    -
  • link(__('Edit Enquiry', true), array('action'=>'edit', $enquiry['Enquiry']['id'])); ?>
  • -
-
+ > + > + +   + + > + > +link($enquiry['User']['username'], array('controller'=> 'users', 'action'=>'view', $enquiry['User']['id'])); ?> +   + + > + > +link($enquiry['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiry['Customer']['id'])); ?> +   + + > + > +link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?> +   + + > + > +link($enquiry['State']['name'], array('controller'=> 'states', 'action'=>'view', $enquiry['State']['id'])); ?> +   + + > + > +link($enquiry['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $enquiry['Country']['id'])); ?> +   + + > + > + +   + + > + > +link($enquiry['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $enquiry['Principle']['id'])); ?> +   + + > + > +link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?> +   + + > + > + + + +   + + + > + > + '; + echo $enquiry['BillingAddress']['city'].' '.$billingaddress['State']['name'].' '.$enquiry['BillingAddress']['postcode'].'
'; + echo ''.$billingaddress['Country']['name'].''; + } + else { + echo 'No Billing Address Assigned for this Enquiry'; + } +?> +   + + + > + > + '; + echo $enquiry['ShippingAddress']['city'].' '.$shippingaddress['State']['name'].' '.$enquiry['ShippingAddress']['postcode'].'
'; + echo ''.$shippingaddress['Country']['name'].''; + } + else { + echo 'No Shipping Address Assigned for this Enquiry'; +} +?> +   + + + +
+ +
+
    +
  • link(__('Edit Enquiry', true), array('action'=>'edit', $enquiry['Enquiry']['id'])); ?>
  • +
+
- + ?> element('principle_contacts_email_box', array('enquirynumber' => $enquiry['Enquiry']['title'], - 'principle_emails' => $principle_emails )); ?> +'principle_emails' => $principle_emails )); ?>
+ + +

image('document.png'); ?>

+ element('enquiry_file_table', $files); ?> + +*/?> + + + +
- -

-image('internet-mail.png'); ?>

- element('email_table_ajax', $enquiry); ?> - element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?> - - - - * - */ -?> - \ No newline at end of file + + \ No newline at end of file