Revert "Add Enquiry and job title to Order Acknowledgement email subject"

Reopen #47
This reverts commit 027680093f.
This commit is contained in:
Karl Cordes 2022-06-25 17:12:46 +10:00
parent 31aa49855f
commit 11eb56ed56

View file

@ -860,28 +860,6 @@ EOT;
return $subject; 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). * Email the PDF(document + attachments) for this Document to a Recipient (Customer or Principle).
@ -957,7 +935,7 @@ EOT;
$this->set('job', $this->Document->PurchaseOrder->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id'])))); $this->set('job', $this->Document->PurchaseOrder->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id']))));
break; break;
case 'orderAck': case 'orderAck':
$subject = $this->orderack_email_subject($document); $subject .= " Order Acknowledgement";
$this->set('job', $this->Document->OrderAcknowledgement->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id'])))); $this->set('job', $this->Document->OrderAcknowledgement->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id']))));
if ($document['OrderAcknowledgement']['signature_required']) { if ($document['OrderAcknowledgement']['signature_required']) {
$template = 'orderAck_email_signature_required'; $template = 'orderAck_email_signature_required';