Added PO sending fix from live server debug
This commit is contained in:
parent
c2649eb739
commit
93a24c6b62
|
|
@ -867,12 +867,16 @@ ENDINSTRUCTIONS;
|
|||
$primary_contact = $this->Document->User->find('first', array('conditions'=>array('User.principle_id' => $document['PurchaseOrder']['principle_id'],'User.primary_contact' => 1)));
|
||||
if(empty($primary_contact)) {
|
||||
|
||||
$this->Session->setFlash(__('Unable to sent. No primary Principle Contact', true));
|
||||
$this->Session->setFlash(__('Unable to send. No primary Principle Contact', true));
|
||||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||
return;
|
||||
}
|
||||
$this->Email->subject = 'CMC Technologies Purchase Order: '.$document['PurchaseOrder']['title'];
|
||||
|
||||
$this->Email->to = $primary_contact['User']['email'];
|
||||
$this->Email->replyTo = null;
|
||||
$this->Email->cc = null;
|
||||
|
||||
$this->set('job', $this->Document->PurchaseOrder->Job->find('first', array('conditions'=>array('Job.id'=>$document['OrderAcknowledgement']['job_id']))));
|
||||
break;
|
||||
case 'orderAck':
|
||||
|
|
@ -894,6 +898,7 @@ ENDINSTRUCTIONS;
|
|||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||
}
|
||||
else {
|
||||
print_r($this->Email->smtpError);
|
||||
$this->set('smtp_errors', $this->Email->smtpError);
|
||||
$this->Session->setFlash(__('The Email has NOT been sent. Something went wrong.', true));
|
||||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||
|
|
|
|||
|
|
@ -164,5 +164,38 @@ class ProductsController extends AppController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Finish this maybe. This project has wasted years of my life.
|
||||
function autocomplete() {
|
||||
|
||||
$query = strtolower($_GET["term"]);
|
||||
|
||||
if($query == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
App::import('Core', 'Sanitize');
|
||||
|
||||
$query = Sanitize::clean($query);
|
||||
|
||||
$products = $this->Product->find('list', array(
|
||||
'conditions' => array(
|
||||
'Product.title LIKE' => '%'.$query.'%'
|
||||
),
|
||||
'fields' => array('Product.title'),
|
||||
'order' => array('Product.title ASC')
|
||||
));
|
||||
|
||||
//Cakephp. You are awful. Past Karl was an idiot
|
||||
|
||||
$products_json = json_encode($products);
|
||||
|
||||
$this->set('products_json', $products_json);
|
||||
|
||||
$this->layout = 'ajax';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1 @@
|
|||
<script type="text/javascript">
|
||||
$('#productSelect').select2();
|
||||
</script>
|
||||
<?=$form->input('product', array('label'=>'Product', 'id'=>'productSelect', 'empty'=>'Choose Products', 'options'=>$products));?>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
<? echo $form->input('Product.principle_id', array('id'=>'principleSelect', 'label'=>'Principle','empty'=>'Select Principle'));?>
|
||||
<div id="productsDiv"></div>
|
||||
<div id="productDetails"></div>
|
||||
<?php /*
|
||||
FUCK
|
||||
<br><br>
|
||||
<div class="autocomplete">
|
||||
<span>OR search for product</span>
|
||||
<label for="productAutocomplete">Product title</label>
|
||||
<input id="productAutocomplete"/>
|
||||
|
||||
</div> */
|
||||
?>
|
||||
|
||||
<div id="lineItemDetails">
|
||||
<?
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ echo $javascript->link('global');
|
|||
echo $javascript->link('search');
|
||||
echo $javascript->link('jquery.jeditable.mini');
|
||||
echo $javascript->link('jquery.validate');
|
||||
echo $javascript->link('select2');
|
||||
|
||||
echo $scripts_for_layout;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,11 @@ $(function() {
|
|||
$("#productSelect").live('change',function() {
|
||||
|
||||
var productID = getSelectedID('#productSelect');
|
||||
getProductDetails(productID);
|
||||
|
||||
});
|
||||
|
||||
function getProductDetails(productID) {
|
||||
$.get('/documents/getProductDetails/'+productID, function(data) {
|
||||
|
||||
$("#lineItemDetails").show();
|
||||
|
|
@ -319,8 +323,18 @@ $(function() {
|
|||
|
||||
|
||||
}, "json");
|
||||
});
|
||||
}
|
||||
|
||||
//Autocomplete product title for adding lineItem
|
||||
$( "#productAutocomplete" ).live('focus', function() {
|
||||
$(this).autocomplete({
|
||||
source: "/products/autocomplete",
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
console.log(ui);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Initialize the editor.
|
||||
// Callback function can be passed and executed after full instance creation.
|
||||
|
|
|
|||
Loading…
Reference in a new issue