public function insertDonation($userid, $amount, $paypal_txn_id, $completed = true) { // Insert the orders table $order = new stdClass(); $order->id = NULL; $order->userid = $userid; $order->amount = $amount; $order->completed = $completed ? 1 : 0; $order->paypal_txn_id = $paypal_txn_id; $order->donationdate = JTrinityCoreUtilities::getCurrentDatetime(); if (!$this->_db->insertObject('#__jtc_donations', $order, 'id')) { JLog::add("insertDonation(): Error inserting jtc_donations. userid=" . $userid . " points=" . $points, JLog::ERROR); return false; } return true; }
public static function insertOrderTable($userid, $productid, $description, $cost, $donationtype, $charid = null, $realmid = null, $db = null) { // Insert the orders table $order = new stdClass(); $order->id = NULL; $order->userid = $userid; $order->description = $description; $order->productid = $productid; $order->points = $cost; if ($charid) { $order->charid = $charid; } if ($realmid) { $order->realmid = $realmid; } $order->ordertype = $donationtype; $order->orderdate = JTrinityCoreUtilities::getCurrentDatetime(); if (!$db) { $db = JFactory::getDbo(); } if (!$db->insertObject('#__jtc_orders', $order, 'id')) { JLog::add("insertOrderTable(): Error inserting jtc_orders. Userid=" . $userid . " producti=" . $productid, JLog::ERROR); return false; } return true; }