Fix GL journal save, edit, detail view and list filters
Send journal lines, gl_id and list filters inside the ajax data payload where ajax_request reads them, select period when replacing a manual journal, and show ledger amounts to two decimals.
This commit is contained in:
+12
-6
@@ -216,11 +216,17 @@
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'manage',
|
||||
gl_id: document.getElementById('gl_id').value || 0,
|
||||
journal_date: jdate,
|
||||
reference: document.getElementById('reference').value,
|
||||
description: document.getElementById('description').value,
|
||||
lines: JSON.stringify(lines),
|
||||
// Payload fields must go inside `data` — ajax_request() ignores unknown
|
||||
// top-level options. As siblings of `url`, `lines` was never sent (it is
|
||||
// not a form field, so autoPrepare could not pick it up either) and every
|
||||
// save was refused with "At least two journal lines are required."
|
||||
data: {
|
||||
gl_id: document.getElementById('gl_id').value || 0,
|
||||
journal_date: jdate,
|
||||
reference: document.getElementById('reference').value,
|
||||
description: document.getElementById('description').value,
|
||||
lines: JSON.stringify(lines)
|
||||
},
|
||||
onSuccess: function() {
|
||||
window.location.href = server_url + 'journal/index.php';
|
||||
}
|
||||
@@ -238,7 +244,7 @@
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
gl_id: <?php echo (int)$_GET['gl_id']; ?>,
|
||||
data: { gl_id: <?php echo (int)($_GET['gl_id'] ?? 0); ?> },
|
||||
onSuccess: function(res) {
|
||||
var d = res.output;
|
||||
var h = d.header;
|
||||
|
||||
Reference in New Issue
Block a user