Changes to allow invoices and receipts to work without ajax, since it may be the ajaxForm that is creating problems for Shirley on-site. Added debug prints to the invoice page as well, to get feedback on what exactly is breaking.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@835 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -25,13 +25,19 @@ Configure::write('debug', '0');
|
|||||||
beforeSubmit: verifyRequest, // pre-submit callback
|
beforeSubmit: verifyRequest, // pre-submit callback
|
||||||
success: showResponse, // post-submit callback
|
success: showResponse, // post-submit callback
|
||||||
|
|
||||||
|
url: "<?php echo $html->url(array('controller' => 'transactions',
|
||||||
|
'action' => 'postReceipt', 0)); ?>",
|
||||||
|
|
||||||
// other available options:
|
// other available options:
|
||||||
//clearForm: true, // clear all form fields after successful submit
|
//clearForm: true, // clear all form fields after successful submit
|
||||||
//resetForm: true, // reset the form after successful submit
|
//resetForm: true, // reset the form after successful submit
|
||||||
};
|
};
|
||||||
|
|
||||||
// bind form using 'ajaxForm'
|
// bind form using 'ajaxForm'
|
||||||
$('#receipt-form').ajaxForm(options);
|
if ($('#receipt-form').ajaxForm != null)
|
||||||
|
$('#receipt-form').ajaxForm(options);
|
||||||
|
else
|
||||||
|
$('#repeat, label[for=repeat]').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
// pre-submit callback
|
// pre-submit callback
|
||||||
|
|||||||
@@ -27,19 +27,34 @@ Configure::write('debug', '0');
|
|||||||
|
|
||||||
// prepare the form when the DOM is ready
|
// prepare the form when the DOM is ready
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
$("#debug").append('doc ready1' + '<BR>');
|
||||||
var options = {
|
var options = {
|
||||||
target: '#output-debug', // target element(s) to be updated with server response
|
target: '#output-debug', // target element(s) to be updated with server response
|
||||||
beforeSubmit: verifyRequest, // pre-submit callback
|
beforeSubmit: verifyRequest, // pre-submit callback
|
||||||
success: showResponse, // post-submit callback
|
success: showResponse, // post-submit callback
|
||||||
|
|
||||||
|
url: "<?php echo $html->url(array('controller' => 'transactions',
|
||||||
|
'action' => 'postInvoice', 0)); ?>",
|
||||||
|
|
||||||
// other available options:
|
// other available options:
|
||||||
//clearForm: true, // clear all form fields after successful submit
|
//clearForm: true, // clear all form fields after successful submit
|
||||||
//resetForm: true, // reset the form after successful submit
|
//resetForm: true, // reset the form after successful submit
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ($('#invoice-form').ajaxForm != null)
|
||||||
|
$("#debug").append('ajax present' + '<BR>');
|
||||||
|
else
|
||||||
|
$("#debug").append('ajax not present' + '<BR>');
|
||||||
|
|
||||||
// bind form using 'ajaxForm'
|
// bind form using 'ajaxForm'
|
||||||
$('#invoice-form').ajaxForm(options);
|
if ($('#invoice-form').ajaxForm != null) {
|
||||||
});
|
$("#debug").append('go ajax' + '<BR>');
|
||||||
|
$('#invoice-form').ajaxForm(options);
|
||||||
|
$("#debug").append('ajax set' + '<BR>');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$('#repeat, label[for=repeat]').remove();
|
||||||
|
});
|
||||||
|
|
||||||
// pre-submit callback
|
// pre-submit callback
|
||||||
function verifyRequest(formData, jqForm, options) {
|
function verifyRequest(formData, jqForm, options) {
|
||||||
@@ -116,11 +131,13 @@ function showResponse(responseText, statusText) {
|
|||||||
|
|
||||||
// Reset the form
|
// Reset the form
|
||||||
function resetForm(nocharge) {
|
function resetForm(nocharge) {
|
||||||
|
$("#debug").append('reset form: ' + nocharge + '<BR>');
|
||||||
$('#charge-entry-id').val(1);
|
$('#charge-entry-id').val(1);
|
||||||
$('#charges').html('');
|
$('#charges').html('');
|
||||||
|
|
||||||
if (!nocharge)
|
if (!nocharge)
|
||||||
addChargeSource(false);
|
addChargeSource(false);
|
||||||
|
$("#debug").append('reset form done' + '<BR>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -146,6 +163,7 @@ function onRowSelect(grid_id, lease_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onGridState(grid_id, state) {
|
function onGridState(grid_id, state) {
|
||||||
|
$("#debug").append('on grid state: ' + grid_id + '; ' + state + '<BR>');
|
||||||
if (state == 'visible') {
|
if (state == 'visible') {
|
||||||
$(".lease-selection-invalid").hide();
|
$(".lease-selection-invalid").hide();
|
||||||
$(".lease-selection-valid").hide();
|
$(".lease-selection-valid").hide();
|
||||||
@@ -159,9 +177,11 @@ function onGridState(grid_id, state) {
|
|||||||
$(".lease-selection-invalid").show();
|
$(".lease-selection-invalid").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$("#debug").append('on grid state done' + '<BR>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function addChargeSource(flash) {
|
function addChargeSource(flash) {
|
||||||
|
$("#debug").append('add charge source' + '<BR>');
|
||||||
var id = $("#charge-entry-id").val();
|
var id = $("#charge-entry-id").val();
|
||||||
addDiv('charge-entry-id', 'charge', 'charges', flash,
|
addDiv('charge-entry-id', 'charge', 'charges', flash,
|
||||||
// HTML section
|
// HTML section
|
||||||
@@ -198,10 +218,14 @@ function addChargeSource(flash) {
|
|||||||
|
|
||||||
'</FIELDSET>'
|
'</FIELDSET>'
|
||||||
);
|
);
|
||||||
|
$("#debug").append('add div complete' + '<BR>');
|
||||||
|
|
||||||
|
$("#debug").append('add datepicker1' + '<BR>');
|
||||||
datepicker("Entry"+id+"EffectiveDate");
|
datepicker("Entry"+id+"EffectiveDate");
|
||||||
|
$("#debug").append('add datepicker2' + '<BR>');
|
||||||
datepicker("Entry"+id+"ThroughDate");
|
datepicker("Entry"+id+"ThroughDate");
|
||||||
|
|
||||||
|
$("#debug").append('add charge source complete' + '<BR>');
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,6 +289,12 @@ echo $form->input("Lease.id",
|
|||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'value' => 0));
|
'value' => 0));
|
||||||
|
|
||||||
|
if (!empty($movein))
|
||||||
|
echo $form->input("Customer.id",
|
||||||
|
array('id' => 'customer-id',
|
||||||
|
'type' => 'hidden',
|
||||||
|
'value' => $customer['id']));
|
||||||
|
|
||||||
/* echo '<fieldset CLASS="invoice">' . "\n"; */
|
/* echo '<fieldset CLASS="invoice">' . "\n"; */
|
||||||
/* echo ' <legend>Invoice</legend>' . "\n"; */
|
/* echo ' <legend>Invoice</legend>' . "\n"; */
|
||||||
|
|
||||||
@@ -319,6 +349,7 @@ Configure::write('debug', '0');
|
|||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
$("#debug").append('doc ready2' + '<BR>');
|
||||||
datepicker('TransactionStamp');
|
datepicker('TransactionStamp');
|
||||||
|
|
||||||
$("#lease-id").val(0);
|
$("#lease-id").val(0);
|
||||||
@@ -331,11 +362,13 @@ Configure::write('debug', '0');
|
|||||||
|
|
||||||
<?php if (empty($movein)): ?>
|
<?php if (empty($movein)): ?>
|
||||||
|
|
||||||
|
$("#debug").append('movein empty' + '<BR>');
|
||||||
resetForm();
|
resetForm();
|
||||||
datepickerNow('TransactionStamp');
|
datepickerNow('TransactionStamp');
|
||||||
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
||||||
|
$("#debug").append('movein not empty' + '<BR>');
|
||||||
var id;
|
var id;
|
||||||
resetForm(true);
|
resetForm(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user