Making quick add enquiry fix

This commit is contained in:
Karl Cordes 2011-07-15 16:33:31 +10:00
parent b382094091
commit 476be0674f
3 changed files with 39 additions and 44 deletions

View file

@ -77,18 +77,17 @@ class EnquiriesController extends AppController {
} }
function add() { /* function add() {
$this->set('users',$this->Enquiry->User->find('list', array('conditions'=>array('User.type'=>'user', 'User.enabled'=>true)))); $this->set('users',$this->Enquiry->User->find('list', array('conditions'=>array('User.type'=>'user', 'User.enabled'=>true))));
} }*/
/*
function add() { function add() {
if(empty($this->data)) { if(empty($this->data)) {
if(isset($this->params['named']['customerid'])) { if(isset($this->params['named']['customerid'])) {
$customer = $this->Enquiry->Cu $customer = $this->Enquiry->Customer->findById($this->params['named']['customerid']);
* stomer->findById($this->params['named']['customerid']);
} }
else { else {
$this->Session->setFlash(__('The customer must already exist in the database. Please add Enquiries to an existing Customer', true)); $this->Session->setFlash(__('The customer must already exist in the database. Please add Enquiries to an existing Customer', true));
@ -96,9 +95,9 @@ class EnquiriesController extends AppController {
} }
} }
if(isset($customer)) {*/ if(isset($customer)) {
/* Check if the customer exists in the database - otherwise send the user back to step 1*/ /* Check if the customer exists in the database - otherwise send the user back to step 1*/
/*if(!$customer) { if(!$customer) {
$this->Session->setFlash(__('The customer must already exist in the database. Please try again', true)); $this->Session->setFlash(__('The customer must already exist in the database. Please try again', true));
$this->redirect(array('action'=>'add')); $this->redirect(array('action'=>'add'));
} }
@ -150,15 +149,15 @@ class EnquiriesController extends AppController {
} }
} }
}*/ }
/* Internal function to display page 2 of the Add Enquiry Form Wizard /* Internal function to display page 2 of the Add Enquiry Form Wizard
* to help make the flow-control logic of the add function clearer. * to help make the flow-control logic of the add function clearer.
* */ * */
/* function __showPage2($customer) { */ function __showPage2($customer) {
/* Combine the first_name and last_name for the Contact Drop Down Box */ /* Combine the first_name and last_name for the Contact Drop Down Box */
/* $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id']))); $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id'])));
$contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name'));
$states = $this->Enquiry->State->find('list'); $states = $this->Enquiry->State->find('list');
$countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc')); $countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc'));
@ -169,9 +168,9 @@ class EnquiriesController extends AppController {
$customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id']))); $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id'])));
$this->set('billing_addresses', $customerAddresses); $this->set('billing_addresses', $customerAddresses);
$this->set('shipping_addresses', $customerAddresses); $this->set('shipping_addresses', $customerAddresses);
$this->set('errors', $this->Enquiry->invalidFields()); */ $this->set('errors', $this->Enquiry->invalidFields());
/* Feels like an ugly hack. But it gets the desired effect and it will do for now */ /* Feels like an ugly hack. But it gets the desired effect and it will do for now */
/*
if(isset($customerAddresses[0]['BillingAddress'])) { if(isset($customerAddresses[0]['BillingAddress'])) {
$billing_address_list[0] = "No Address Selected"; $billing_address_list[0] = "No Address Selected";
foreach ($customerAddresses as $address) { foreach ($customerAddresses as $address) {
@ -185,8 +184,7 @@ class EnquiriesController extends AppController {
$this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one');
$this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one');
} }
}*/ }
/* Add enquiry_id to the Email Queue */ /* Add enquiry_id to the Email Queue */

View file

@ -69,7 +69,8 @@ h1 {
margin: 0.1em 0; margin: 0.1em 0;
} }
h2 { h2 {
color: #e32; /*color: #e32; */
color: #045FB4;
font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif;
font-size: 190%; font-size: 190%;
margin: 0; margin: 0;
@ -77,7 +78,7 @@ h2 {
} }
h2 a { h2 a {
color: #e32; color: #045FB4;
font-weight: normal; font-weight: normal;
} }

View file

@ -66,29 +66,21 @@ $(function() {
modal: true, modal: true,
buttons: { buttons: {
"Edit Line Item": function() { "Edit Line Item": function() {
$('#LineItemDescription').ckeditor(function() { $('#LineItemDescription').ckeditor(function() {
this.updateElement(); this.updateElement();
this.destroy(); this.destroy();
}); });
var thisLineItemInputs = $('#LineItemEditForm').find('input,select,textarea'); var thisLineItemInputs = $('#LineItemEditForm').find('input,select,textarea');
$.post('/line_items/ajax_edit', thisLineItemInputs, function(data) { $.post('/line_items/ajax_edit', thisLineItemInputs, function(data) {
if(data == 'SUCCESS') { if(data == 'SUCCESS') {
$( "#editLineItemModal" ).dialog('close'); $( "#editLineItemModal" ).dialog('close');
} }
else { else {
alert("Line Item could not be saved") alert("Line Item could not be saved")
$('#LineItemDescription').ckeditor(config); $('#LineItemDescription').ckeditor(config);
} }
}); });
}, },
@ -98,6 +90,10 @@ $(function() {
} }
}, },
close: function() { close: function() {
$('#LineItemDescription').ckeditor(function() {
this.destroy();
});
loadLineItems(); loadLineItems();
} }