function txn_load_full($db, $id) { $txn = txn_load($db, $id); $items = txn_load_items($db, $id); $payments = txn_load_payments($db, $id); $notes = txn_load_notes($db, $id); if ($txn['person']) { $person = person_load($db, $txn['person']); } return array('txn' => $txn, 'items' => $items, 'payments' => $payments, 'person' => $person, 'notes' => $notes); }
<?php include '../scat.php'; include '../lib/txn.php'; $id = (int) $_REQUEST['id']; if (!$id) { die_jsonp("No transaction specified."); } $note = $_REQUEST['note']; if (!$note) { die_jsonp("No note given."); } $note = $db->escape($note); $q = "INSERT INTO txn_note SET entered = NOW(), txn = {$id}, content = '{$note}'"; $db->query($q) or die_query($db, $q); echo jsonp(array('txn' => txn_load($db, $id), 'notes' => txn_load_notes($db, $id)));