Converting Quote to OrderAck fills in the addresses from the Enquiry
This commit is contained in:
parent
9d3de7620a
commit
ef825ebdc7
|
|
@ -245,12 +245,6 @@ class DocumentsController extends AppController {
|
||||||
$newDoc['DocPage'][$index]['document_id'] = null;
|
$newDoc['DocPage'][$index]['document_id'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!empty($document['PurchaseOrder']['id'])) {
|
else if (!empty($document['PurchaseOrder']['id'])) {
|
||||||
|
|
@ -357,6 +351,18 @@ class DocumentsController extends AppController {
|
||||||
$newDoc['Document']['revision'] = 0; //No revisions for Order Acks. I have decreed it!
|
$newDoc['Document']['revision'] = 0; //No revisions for Order Acks. I have decreed it!
|
||||||
$newDoc['Document']['type'] = 'orderAck';
|
$newDoc['Document']['type'] = 'orderAck';
|
||||||
|
|
||||||
|
if(isset($enquiry['BillingAddress']['id'])) {
|
||||||
|
$newDoc['Document']['bill_to'] = '<b>'.$customer['Customer']['name'].'</b><br/>';
|
||||||
|
$newDoc['Document']['bill_to'] .= $this->Document->OrderAcknowledgement->Enquiry->formatAddress($enquiry['BillingAddress']['id'], 'BillingAddress');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($enquiry['ShippingAddress']['id'])) {
|
||||||
|
$newDoc['Document']['ship_to'] = '<b>'.$customer['Customer']['name'].'</b><br/>';
|
||||||
|
$newDoc['Document']['ship_to'] .= $this->Document->OrderAcknowledgement->Enquiry->formatAddress($enquiry['ShippingAddress']['id'], 'ShippingAddress');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Copy the LineItems from this Document. Applies to all of the Document Types */
|
/** Copy the LineItems from this Document. Applies to all of the Document Types */
|
||||||
if(!empty($originalDoc['LineItem'])) {
|
if(!empty($originalDoc['LineItem'])) {
|
||||||
$newDoc['LineItem'] = $originalDoc['LineItem'];
|
$newDoc['LineItem'] = $originalDoc['LineItem'];
|
||||||
|
|
@ -555,5 +561,7 @@ class DocumentsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -192,7 +192,33 @@ class Enquiry extends AppModel {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function formatAddress($id, $type) {
|
||||||
|
|
||||||
|
if($type == 'BillingAddress' || $type == 'ShippingAddress') {
|
||||||
|
$address = $this->$type->find('first', array('conditions'=>array("$type.id"=>$id),'recursive'=>1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($address[$type]['country_id'] == 1) { //Australian Address
|
||||||
|
$formatted = <<<ENDADDRESS
|
||||||
|
{$address[$type]['address']}<br/>
|
||||||
|
{$address[$type]['city']}<br/>
|
||||||
|
{$address['State']['shortform']} {$address[$type]['postcode']}<br/>
|
||||||
|
ENDADDRESS;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$formatted = <<<ENDADDRESS
|
||||||
|
{$address[$type]['address']}<br/>
|
||||||
|
{$address[$type]['city']}<br/>
|
||||||
|
{$address[$type]['postcode']}<br/>
|
||||||
|
{$address['Country']['name']}<br/>
|
||||||
|
ENDADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $formatted;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
2
vendors/pdfdoc.php
vendored
2
vendors/pdfdoc.php
vendored
|
|
@ -16,7 +16,7 @@ class PDFDOC extends FPDI {
|
||||||
function pageContent($content) {
|
function pageContent($content) {
|
||||||
|
|
||||||
$this->SetTextColor(0);
|
$this->SetTextColor(0);
|
||||||
$this->SetFontSize(12);
|
$this->SetFontSize(11); //Changed from 12
|
||||||
$this->SetFont('times', '');
|
$this->SetFont('times', '');
|
||||||
|
|
||||||
//$this->setY(50);
|
//$this->setY(50);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue