Add Enquiry and job title to Order Acknowledgement email subject
Closes #47
This commit is contained in:
parent
6e00981ed0
commit
027680093f
|
|
@ -860,6 +860,28 @@ EOT;
|
|||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
function orderack_email_subject($document) {
|
||||
$id = $document['Document']['id'];
|
||||
//print_r($document);
|
||||
$q = <<<EOT
|
||||
SELECT j.title as job_title, e.title as enquiry_title
|
||||
FROM order_acknowledgements oa
|
||||
JOIN enquiries e ON oa.enquiry_id = e.id
|
||||
JOIN jobs j on oa.job_id = j.id
|
||||
WHERE oa.document_id = $id;
|
||||
EOT;
|
||||
$titles = $this->Document->query($q);
|
||||
|
||||
if count($titles) < 1 {
|
||||
// This probably shouldn't happen, but who knows.
|
||||
$subject = 'CMC Technologies Order Acknowledgement';
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$subject = 'CMC Technologies Order Acknowledgement: '.$titles[0]['e']['enquiry_title'].' '.$titles[0]['j']['job_title'];
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email the PDF(document + attachments) for this Document to a Recipient (Customer or Principle).
|
||||
|
|
@ -935,7 +957,7 @@ EOT;
|
|||
$this->set('job', $this->Document->PurchaseOrder->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id']))));
|
||||
break;
|
||||
case 'orderAck':
|
||||
$subject .= " Order Acknowledgement";
|
||||
$subject = $this->orderack_email_subject($document);
|
||||
$this->set('job', $this->Document->OrderAcknowledgement->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id']))));
|
||||
if ($document['OrderAcknowledgement']['signature_required']) {
|
||||
$template = 'orderAck_email_signature_required';
|
||||
|
|
|
|||
Loading…
Reference in a new issue