/** * Update the order's status flag to a new value * If the new status isn't really new, the order is unchanged and "true" * is returned. If this is called by some automated process, $log can * be set to "false" to avoid logging the change, such as during order * creation. * * @uses Log() * @param string $newstatus New order status * @param boolean $log True to log the change, False to not * @return boolean True on success or no change */ public function UpdateStatus($newstatus, $log = true) { global $_TABLES, $_PP_CONF; // Need to get the order statuses to see if we should notify // the buyer USES_paypal_class_orderstatus(); $OrdStat = new ppOrderStatus(); $order_id = $this->order_id; $oldstatus = $this->status; $this->status = $newstatus; $db_order_id = DB_escapeString($order_id); $log_user = $this->log_user; // If the status isn't really changed, don't bother updating anything // and just treat it as successful // if ($oldstatus == $newstatus) return true; $sql = "UPDATE {$_TABLES['paypal.orders']}\r\n SET status = '" . DB_escapeString($newstatus) . "'\r\n WHERE order_id = '{$db_order_id}'"; //echo $sql;die; DB_query($sql); if (DB_error()) { return false; } if ($log) { self::Log("Status changed from {$oldstatus} to {$newstatus}", $order_id, $log_user); } if ($_PP_CONF['orderstatus'][$newstatus]['notify_buyer'] == 1) { $this->Notify($newstatus); } return true; }
/** * Plugin-specific functions for the Paypal plugin for glFusion. * Based on the gl-paypal Plugin for Geeklog CMS by Vincent Furia. * * @author Lee Garner <*****@*****.**> * @author Vincent Furia <vinny01@users.sourceforge.net * @copyright Copyright (c) 2009-2012 Lee Garner * @copyright Copyright (C) 2005-2006 Vincent Furia * @package paypal * @version 0.5.2 * @license http://opensource.org/licenses/gpl-2.0.php * GNU Public License v2 or later * @filesource */ USES_paypal_class_orderstatus(); /** * Order History View. * Displays the purchase history for the current user. Admins * can view any user's histor, or all users * * @param boolean $admin True if called for admin access, False otherwise * @param integer $uid User ID to view, current user by default * @return string HTML for order list */ function PAYPAL_orders($admin = false, $uid = '') { global $_CONF, $_PP_CONF, $_TABLES, $LANG_PP, $_USER; if (!$admin) { $uid = $_USER['uid']; }