function update() { $vals = $this->toArray(); //$vals['id'] = $this->get('id'); //$vals['subject'] = $this->get('subject'); //$vals['body'] = $this->get('body'); unset($vals['emailParams']); unset($vals['contentVars']); $vals['params'] = oseJson::encode($this->get('params')); return oseDB::update($this->table, 'id', $vals); }
public static function save($params) { $result = array(); $result['success'] = true; //oseExit($params); if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.1'); return $result; } unset($params['allow_work']); if( $params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $payment= oseRegistry :: call('payment'); $orderInfo= $payment->getInstance('Order')->getOrder(array("order_id = {$order_id}"), 'obj'); $orderInfoParams = oseJson::decode($orderInfo->params); $array = array(); $array['id'] = $orderInfoParams->coupon_user_id; if(!empty($array['id'])) { $array['paid'] = 1; $array['user_id'] = $member_id; $updated = oseDB::update('#__osemsc_coupon_user','id',$array); } return $result; }
function save() { $result = array(); $post = JRequest::get('post'); $post = oseMscAddon::getPost('licseat_', $post); if (!isset($post['contact_send'])) { $post['contact_send'] = 0; } if (!isset($post['internal_contact_send'])) { $post['internal_contact_send'] = 0; } $db = oseDB::instance(); $msc_id = JRequest::getInt('msc_id', 0); $member_id = JRequest::getInt('member_id', 0); //$member = oseRegistry::call('member'); //$member->instance($member_id); //$memInfo = $member->getMembership($msc_id,'obj'); //$memInfoParams = oseObject::getParams($memInfo); $mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id, 'lic', 'obj'); $mscLicInfoParams = oseObject::getParams($mscLicInfo); $where = array(); $where[] = "license_user_id = '{$member_id}'"; $post['id'] = $item->id; $post['license_user_id'] = $member_id; if (empty($post['id'])) { $updated = oseDB::insert('#__oselic_license_seat', $post); } else { $updated = oseDB::update('#__oselic_license_seat', 'id', $post); } if (!$updated) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Fail Saving OSEMSC User Info.'); $result['member_id'] = ''; } else { $result['success'] = true; $result['title'] = 'Done'; $result['content'] = JText::_('Saved Joomla User Info.'); } return $result; }
function save() { $id = JRequest::getInt('id', 0); //$domain = JRequest::getString('domain','','post', JREQUEST_ALLOWRAW); $domain = JRequest::getString('domain'); $user_id = JRequest::getInt('user_id'); $msc_id = JRequest::getInt('msc_id'); $start_date = JRequest::getString('start_date'); //$start_date = date('Y-m-d H:i:s',strtotime($start_date));; $end_date = JRequest::getString('end_date'); //$end_date = date('Y-m-d H:i:s',strtotime($end_date));; //$data = JRequest::getString('data'); $vals = array(); $vals['id'] = $id; $vals['userID'] = $user_id; $vals['domain'] = $domain; $vals['mscID'] = $msc_id; $vals['start_date'] = $start_date; $vals['end_date'] = $end_date; if (empty($id)) { unset($vals['id']); $updated = oseDB::insert($this->table, $vals); } else { $updated = oseDB::update($this->table, 'id', $vals); } if ($updated) { $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('Saved'); } else { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('Fail Saving'); } $result = oseJSON::encode($result); oseExit($result); }
$emailObj->subject= $mailsubject; $emailObj->body= $mailbody; $apiEmail->sendToAdminGroup($emailObj, $oseMscConfig->admin_group); } else { $ini_txn_id = $process->get('init_txn_id'); if(!empty($ini_txn_id)) { $transactions = oseJson::decode(oseObject::getValue($orderInfo,'transactions','[]')); $transactions[] = $process->get('init_txn_id'); $transactions = oseJson::encode($transactions); oseDB::update('#__osemsc_order','order_id',array( 'order_id'=>$order_id ,'order_status'=>'confirmed','transactions'=>$transactions )); //$paymentOrder->updateOrder($order_id, "confirmed",array('transactions'=>$transactions)); //$oseMscConfig = oseMscConfig::getConfig('payment','obj'); if(oseObject::getValue($oseMscConfig,'paypal_pro_access','instant') == 'instant') { // confirm //self::confirmOrder($order_id, $params); } else { // confirm until paid $paymentOrder->confirmOrder($order_id); } $process->set('txn_id',$process->get('recurring_payment_id'));
function update() { $vals = $this->getProperties(); return oseDB::update($this->_table, 'id', $vals); }
public static function save() { $result = array(); $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Saved User Billing Info.'); $post = JRequest::get('post'); $user = oseMscPublic::getUser(); $member_id = $user->id; if(!empty($post['juser_firstname'])) { $post['bill_firstname'] = $post['juser_firstname']; } if(!empty($post['juser_lastname'])) { $post['bill_lastname'] = $post['juser_lastname']; } $billinfo = array(); foreach($post as $key => $value) { if(strstr($key,'bill_')) { $billKey = str_replace('bill_','',$key); $billinfo[$billKey] = $value; } } if(empty($billinfo)) { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Nothing need to save!'); } //oseExit($billinfo); $db = oseDB::instance(); //$member_id = JRequest::getInt('member_id',0); $query = " SELECT count(*) FROM `#__osemsc_billinginfo` WHERE user_id='{$member_id}'"; $db->setQuery($query); $num = $db->loadResult(); $fields = $db->getTableFields('#__osemsc_billinginfo'); foreach($billinfo as $key => $value) { $my = JFactory::getUser(); if(!isset($fields['#__osemsc_billinginfo'][$key])) { if(oseMscPublic::isUserAdmin($my)) { $query = "ALTER TABLE `#__osemsc_billinginfo` ADD `{$key}` TEXT NULL DEFAULT NULL"; $db->setQuery($query); if (!oseDB::query()) { $result['success'] = false; $result['title'] = JText::_('Error'); $result['content'] = JText::_('Fail Saving Joomla User Info.'); } } else { //unset($billinfo[$key]); } } } if (empty ($num)) { $keys = array_keys($billinfo); $keys = '`'.implode('`,`',$keys).'`'; /* foreach($billinfo as $key => $value) { $billinfo[$key] = $db->Quote($value); } $values = implode(',',$billinfo); if (empty($values)) { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Nothing need to save!'); } $query = "INSERT INTO `#__osemsc_billinginfo` (`user_id`,{$keys}) VALUES ('{$member_id}',{$values});"; $db->setQuery($query); */ $billinfo['user_id'] = $user->id; if (!oseDB::insert('#__osemsc_billinginfo',$billinfo)) { $result['success'] = false; $result['title'] = JText::_('Error'); $result['content'] = JText::_('Fail Saving Joomla User Info.'); } } else { if(count($billinfo) > 0) { /* foreach($billinfo as $key => $value) { $billinfo[$key] = "`{$key}`=".$db->Quote($value); } $values = implode(',',$billinfo); $query = " UPDATE `#__osemsc_billinginfo` SET {$values}" ." WHERE `user_id` ={$member_id}" ; $db->setQuery($query); */ $billinfo['user_id'] = $user->id; if (!oseDB::update('#__osemsc_billinginfo','user_id',$billinfo)) { $result['success'] = false; $result['title'] = JText::_('Error'); $result['content'] = JText::_('Fail Saving Joomla User Info.'); } } } //echo $query;exit; return $result; }
public static function save($params) { $result = array(); if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_("Error"); return $result; } unset($params['allow_work']); //oseExit($params); $db = oseDB::instance(); $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $msc_id = $params['msc_id']; $member_id = $params['member_id']; if(empty($msc_id)) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_("Join Msc: No Msc ID"); return $result; } $query = " SELECT * FROM `#__osemsc_order`" ." WHERE `order_id` = '{$order_id}'" ; $db->setQuery($query); $order = oseDB::loadItem('obj'); $oParams = oseJson::decode($order->params); //$msc_option = $oParams->msc_option; $query = " SELECT * FROM `#__osemsc_order_item`" ." WHERE `order_id` = '{$order_id}'" ; $db->setQuery($query); $order_item = oseDB::loadItem('obj'); $iParams = oseJson::decode($order_item->params); $msc_option = $iParams->msc_option; if(oseGetValue($oParams,'isLicensee',0)) { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_("Done"); return $result; } $query = " SELECT * FROM `#__osemsc_ext`" ." WHERE `id` = '{$msc_id}' AND `type` = 'oselic'" ; $db->setQuery($query); $data = oseDB::loadItem('obj'); $data = oseJson::decode($data->params); $data = oseObject::getValue($data,$msc_option,array()); if( oseObject::getValue($data,'enable_license') ) { oseRegistry :: register('user2', 'user2'); oseRegistry :: register('lic', 'lic'); oseRegistry :: register('email', 'email'); oseRegistry :: register('locale', 'locale'); $user = oseCall('user2')->instance( $member_id,'lic'); $user->join( $data->license_id ); $query = " SELECT * FROM `#__oselic_type_license`" ." WHERE `user_id` = '{$member_id}'" ." ORDER BY `id` DESC" ." LIMIT 1" ; $db->setQuery($query); $license = oseDB::loadItem('obj'); $oParams->license_id = $license->id; $vals = array(); $vals['order_id'] = $order_id; $vals['params'] = oseJson::encode($oParams); oseDB::update('#__osemsc_order','order_id',$vals); if( oseObject::getValue($data,'member_expiry_mode') == 1 ) { $query = " SELECT * FROM `#__osemsc_member`" ." WHERE `msc_id` = '{$msc_id}' AND `member_id` = '{$member_id}'" ; $db->setQuery($query); $memInfo = oseDB::loadItem('obj'); $vals = array(); $vals['id'] = $license->id; $vals['expiry_date'] = $memInfo->expired_date; oseDB::update('#__oselic_type_license','id',$vals); } elseif( oseObject::getValue($data,'member_expiry_mode') == 2 ) { $vals = array(); $vals['id'] = $license->id; $vals['expiry_date'] = oseObject::getValue($data,'expiry_date'); oseDB::update('#__oselic_type_license','id',$vals); } } $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_("Done"); return $result; }
public static function save($app = 'msc', $config_type, $vals) { $db = oseDB::instance(); $config = self::load($app, $config_type, 'obj'); $updated = true; foreach ($vals as $k => $v) { $where = array(); $where[] = '`app`=' . $db->Quote($app); $where[] = '`type`=' . $db->Quote($config_type); $where[] = '`key`=' . $db->Quote($k); $where = oseDB::implodeWhere($where); $query = " SELECT COUNT(id) FROM `#__ose_app_config`" . $where; $db->setQuery($query); $total = $db->loadResult(); if ($total > 0) { $iVals = array(); $iVals['id'] = $total; $iVals['value'] = $v; $updated = oseDB::update('#__ose_app_config', 'id', $iVals); } else { $iVals = array(); $iVals['app'] = $app; $iVals['type'] = $config_type; $iVals['key'] = $k; $iVals['value'] = $v; $updated = oseDB::insert('#__ose_app_config', $iVals); } } return $updated; }
function update($var) { //$db = oseDB::instance(); return oseDB::update('#__osemsc_acl', 'id', $var); }
function markuseless() { $db = oseDB::instance(); $result = array(); $id = JRequest::getInt('id'); $vals = array(); $vals['order_id'] = $id; $vals['order_status'] = 'expired'; oseDB::update('#__osemsc_order', 'order_id', $vals); $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('SUCCESS'); oseExit(oseJson::encode($result)); }
function saveState() { $db = oseDB::instance(); $post = JRequest::get('post'); $state_id = JRequest::getInt('state_id', 0); $country_id = JRequest::getInt('country_id', 0); $state_name = JRequest::getCmd('state_name', null); $state_3_code = JRequest::getCmd('state_3_code', null); $state_2_code = JRequest::getCmd('state_2_code', null); $where = array(); //$where[] = '`State_3_code` ='.$db->Quote($State_3_code); //$where[] = '`State_2_code` ='.$db->Quote($State_2_code); $where[] = '`state_id` =' . $db->Quote($state_id); $where = oseDB::implodeWhere($where); $query = "SELECT * FROM `#__osemsc_state`" . $where . ' LIMIT 1'; $db->setQuery($query); $item = oseDB::loadItem('obj'); if (!empty($item)) { $id = $item->state_id; } else { $id = $state_id; } if (empty($id)) { $updated = oseDB::insert('#__osemsc_state', $post); } else { $updated = oseDB::update('#__osemsc_state', 'state_id', $post); } if ($updated) { $result['success'] = true; $result['title'] = JText::_('DONE'); $result['content'] = JText::_('SAVE_SUCCESSFULLY'); } else { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); } $result = oseJson::encode($result); oseExit($result); }
function update() { $vals = $this->toArray(); $vals['params'] = oseJson::encode($vals['params']); return oseDB::update($this->table, 'id', $vals); }
function updateMemRecurrence() { $result = array(); $db = oseDB::instance(); $msc_member_id = JRequest::getInt('msc_member_id', 0); $startDate = JRequest::getString('start_date', 0); $startTime = JRequest::getString('start_time', 0); $expDate = JRequest::getString('exp_date', 0); $expTime = JRequest::getString('exp_time', 0); $start_date = date_create($startDate . $startTime); $expired_date = date_create($expDate . $expTime); $start_date = date_format($start_date, 'Y-m-d H:i:s'); $expired_date = date_format($expired_date, 'Y-m-d H:i:s'); $now = date_create(oseHtml::getDateTime()); $now = date_format($now, 'Y-m-d H:i:s'); $vals = array(); if ($now > $expired_date) { $vals['status'] = 0; $query = "SELECT * FROM `#__osemsc_member` WHERE `id` = " . $msc_member_id; $db->setQuery($query); $obj = oseDB::loadItem('obj'); $msc_id = $obj->msc_id; $member_id = $obj->member_id; $member = oseRegistry::call('member'); $member->instance($member_id); $userInfo = $member->getUserInfo('obj'); $params = $member->getAddonParams($msc_id, $member_id, 0, $params = array()); $list = oseMscAddon::getAddonList('join', true, 1, 'obj'); foreach ($list as $addon) { $result = oseMscAddon::runAction('join.' . $addon->name . '.cancel', $params); if (!$result['success']) { return $result; } } $msc = oseRegistry::call('msc'); $ext = $msc->getExtInfo($msc_id, 'msc', 'obj'); if (!empty($ext->exp_email)) { $order_id = $params['order_id']; $email = $member->getInstance('email'); $emailTempDetail = $email->getDoc($ext->exp_email, 'obj'); $variables = $email->getEmailVariablesExpire($member_id, $msc_id); $emailParams = $email->buildEmailParams($emailTempDetail->type); $emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams); $email->sendEmail($emailDetail, $userInfo->email); $emailConfig = oseMscConfig::getConfig('email', 'obj'); if ($emailConfig->sendExp2Admin) { $email->sendToAdminGroup($emailDetail, $emailConfig->admin_group); } } } else { $vals['status'] = 1; } $db = oseDB::instance(); $vals['start_date'] = $start_date; $vals['expired_date'] = $expired_date; $vals['id'] = $msc_member_id; /*$query = " UPDATE `#__osemsc_member`" ." SET start_date = {$start_date}, expired_date = {$expired_date}" ." WHERE id = {$msc_member_id}" ; $db->setQuery($query);*/ //if(oseDB::query()) if (oseDB::update('#__osemsc_member', 'id', $vals)) { $result['success'] = true; $result['title'] = JText::_('DONE'); $result['content'] = JText::_('UPDATED'); } else { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('FAIL_UPDATING'); } return $result; }
protected function apiCheck($oItem) { $result = array(); $db = oseDB::instance(); static $arb; $oseMscConfig = oseMscConfig::getConfig('payment', 'obj'); // Authorize setting if (!defined('AUTHORIZENET_API_LOGIN_ID')) { define("AUTHORIZENET_API_LOGIN_ID", oseObject::getValue($oseMscConfig, 'an_loginid')); } if (!defined('AUTHORIZENET_TRANSACTION_KEY')) { define("AUTHORIZENET_TRANSACTION_KEY", oseObject::getValue($oseMscConfig, 'an_transkey')); } if (!$arb instanceof AuthnetARB) { $arb = new AuthnetARB(); $arb->url = "apitest.authorize.net"; $arb->login = AUTHORIZENET_API_LOGIN_ID; $arb->transkey = AUTHORIZENET_TRANSACTION_KEY; } // End // init Beanstream // End $oParams = oseJson::decode($oItem->params); if ($oItem->payment_method == 'paypal') { $user = JFactory::getUser($oItem->user_id); $postVar = array(); //$start_time_o = '2012-05-01 00:00:00'; $start_time = strtotime("-1 year"); $iso_start = date('Y-m-d\\T00:00:00\\Z', $start_time); $end_time = strtotime('2011-04-01 00:00:00'); $iso_end = date('Y-m-d\\T24:00:00\\Z', $end_time); $postVar['METHOD'] = 'TransactionSearch'; $postVar['STARTDATE'] = $iso_start; //$postVar['INVNUM'] = $oItem->order_number; $postVar['EMAIL'] = empty($oItem->email) ? $user->email : $oItem->email; //oseExit($postVar); $postString = null; foreach ($postVar as $key => $val) { $postString .= "&" . urlencode($key) . "=" . urlencode($val); } $resArray = self::PaypalAPIConnect($postString); //$resArray1= self :: PaypalAPIConnect1($postString); //if( in_array('Failure',array($resArray['ACK'],$resArray1['ACK']) )) if (in_array('Failure', array($resArray['ACK']))) { $result['finish'] = false; $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = urldecode($resArray['L_LONGMESSAGE0']); return $result; } /*if(!empty($resArray['L_STATUS0'])) { if( !empty($resArray1['L_STATUS0']) ) { $ed = date_create( urldecode($resArray['L_TIMESTAMP0'] )); $ed = date_format($ed, 'Y-m-d H:i:s'); $ed1 = date_create( urldecode($resArray1['L_TIMESTAMP0'] )); $ed1 = date_format($ed1, 'Y-m-d H:i:s'); if($ed < $ed1) { $resArray = $resArray1; } } } elseif( !empty($resArray1['L_STATUS0']) ) { $resArray = $resArray1; }*/ //oseExit($resArray); if (!empty($resArray['L_STATUS0'])) { $trnArray = array(); foreach ($resArray as $k => $v) { if (strpos($k, 'L_STATUS') !== false) { $trnArray[$k] = $v; } else { continue; } } $success = false; $next = false; foreach ($trnArray as $k => $v) { if ($next) { $next = false; continue; } $nk = str_replace('L_STATUS', '', $k); if ($v == 'Completed' || $v == 'Unclaimed') { $success = true; $expDate = urldecode($resArray['L_TIMESTAMP' . $nk]); $expDate = new DateTime($expDate); $expired_date = $expDate->format('Y-m-d H:i:s'); $recurrence_num = oseObject::getValue($oParams, 'p3'); $recurrence_unit = oseObject::getValue($oParams, 't3'); $expired_date = " DATE_ADD('{$expired_date}' ,INTERVAL {$recurrence_num} {$recurrence_unit}) "; $query = " UPDATE `#__osemsc_member` " . " SET `eternal`=0, `expired_date` = {$expired_date}" . " WHERE `id` = '{$oItem->member_id}'"; $db->setQuery($query); $updated = oseDB::query(); $query = " UPDATE `#__osemsc_member` " . " SET `status` = 1 " . " WHERE `id` = '{$oItem->member_id}' AND `expired_date` > NOW()"; $db->setQuery($query); $updated = oseDB::query(); $ofVals = array(); $ofVals['id'] = $oItem->fix_id; $ofVals['status'] = 'fixed'; oseDB::update("#__osemsc_order_fix", 'id', $ofVals); $ofVals = array(); $ofVals['order_id'] = $oItem->order_id; $query = " SELECT COUNT(*) FROM `#__osemsc_member`" . " WHERE `id` = '{$oItem->member_id}' AND `expired_date` > NOW()"; $db->setQuery($query); $needChanged = $db->loadResult(); if ($needChanged > 0 && $v == 'Completed') { $ofVals['order_status'] = 'confirmed'; } elseif ($v == 'Unclaimed') { $ofVals['order_status'] = 'confirmed'; } else { $ofVals['order_status'] = 'skipped'; } oseDB::update("#__osemsc_order", 'order_id', $ofVals); $result['finish'] = true; $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('SUCCESS'); break; } elseif ($v == 'Unclaimed1') { if ($k == 0) { $ofVals = array(); $ofVals['order_id'] = $oItem->order_id; $ofVals['order_status'] = 'skipped'; oseDB::update("#__osemsc_order", 'order_id', $ofVals); } continue; } else { if ($k == 0) { $ofVals = array(); $ofVals['order_id'] = $oItem->order_id; $ofVals['order_status'] = 'skipped'; //oseDB::update("#__osemsc_order",'order_id',$ofVals); } continue; $next = true; } } if (!$success) { $vals['id'] = $obj->id; $vals['virtual_status'] = 0; //$vals['status'] = 0; $vals['eternal'] = 0; $vals['expired_date'] = oseHtml::getDateTime(); //oseDB::update('#__osemsc_member','id',$vals); $result['finish'] = true; $result['success'] = false; $result['title'] = JText::_('ERROR'); if (count($trnArray) > 3) { $result['content'] = JText::_('Maybe the subscription is cancelled'); } elseif (count($trnArray) == 3) { $result['content'] = JText::_('Maybe the first payment is cancelled'); } else { $vals = array(); $vals['id'] = $oItem->member_id; $vals['virtual_status'] = 0; //$vals['status'] = 0; $vals['eternal'] = 0; //$vals['expired_date'] = oseHtml::getDateTime(); oseDB::update('#__osemsc_member', 'id', $vals); $result['content'] = JText::_('No Success Payment has been searched from ') . $start_time; } } /* if( $resArray['L_STATUS0'] == 'Completed' ) { $expDate = urldecode($resArray['L_TIMESTAMP0']); $expDate = new DateTime($expDate); $expired_date = $expDate->format('Y-m-d H:i:s'); $recurrence_num = oseObject::getValue($oParams, 'p3'); $recurrence_unit = oseObject::getValue($oParams, 't3'); $expired_date = " DATE_ADD('{$expired_date}' ,INTERVAL {$recurrence_num} {$recurrence_unit}) "; //oseExit($expired_date); $query = " UPDATE `#__osemsc_member` " ." SET `status` = 1 ,`eternal`=0, `expired_date` = {$expired_date}" ." WHERE `id` = '{$oItem->member_id}'" ; $db->setQuery($query); $updated = oseDB::query(); $ofVals = array(); $ofVals['id'] = $oItem->fix_id; $ofVals['status'] = 'fixed'; oseDB::update("#__osemsc_order_fix",'id',$ofVals); $result['finish'] = false; $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('SUCCESS'); } // mark it expired else { $vals['id'] = $obj->id; $vals['virtual_status'] = 0; //$vals['status'] = 0; $vals['eternal'] = 0; $vals['expired_date'] = oseHtml::getDateTime(); //oseDB::update('#__osemsc_member','id',$vals); $result['finish'] = true; $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('SUCCESS'); }*/ } else { // mark it expired $vals['id'] = $obj->id; $vals['virtual_status'] = 0; //$vals['status'] = 0; $vals['eternal'] = 0; $vals['expired_date'] = oseHtml::getDateTime(); //oseDB::update('#__osemsc_member','id',$vals); $result['finish'] = true; $result['success'] = true; $result['title'] = JText::_('SUCCESS'); $result['content'] = JText::_('SUCCESS'); } return $result; } else { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('Only Support Paypal Recurring Payment'); return $result; } }
private function updateCoupon($item,$coupon_number = null) { $db = oseDB::instance(); $user = oseMscPublic::getUser(); $coupon_id = oseObject::getValue($item,'id',0); $where = array(); if($user->guest) { $where[] = "coupon_number = '{$coupon_number}'"; } else { $where[] = "user_id = '{$user->id}'"; } $where[] = "`coupon_id` = '{$coupon_id}'"; $where[] = "`paid` = 0"; $where = oseDB::implodeWhere($where); $query = " SELECT * FROM `#__osemsc_coupon_user`" . $where ." ORDER BY `id` DESC" ; $db->setQuery($query); $obj = oseDB::loadItem('obj'); $array = array(); if(empty($obj)) { $array['coupon_id'] = $coupon_id; $array['user_id'] = $user->id; $array['msc_id'] = 0; $array['coupon_number'] = $coupon_number; $updated = oseDB::insert('#__osemsc_coupon_user',$array); $coupon_user_id = $updated; if(!$updated) { return false; } if(oseObject::getValue($item,'amount_infinity') == 0) { $couponParams = oseJson::decode($item->params); $couponParams->amount_left--; $couponParams = oseJson::encode($couponParams); $array = array(); $array['id'] = $coupon_id; $array['params'] = $couponParams; //oseExit($couponParams); $updated = oseDB::update('#__osemsc_coupon','id',$array); if(!$updated) { return false; } } } else { $array['id'] = $obj->id; $array['coupon_id'] = $coupon_id; $array['user_id'] = $user->id; $array['msc_id'] = 0; $coupon_user_id = $obj->id; $updated = oseDB::update('#__osemsc_coupon_user','id',$array); } if($updated) { $updated = $coupon_user_id; } return $updated; }
function update() { $vals = $this->getProperties(); $updated = oseDB::update($this->_table, 'plan_id', $vals); return $updated; }
function update() { $vals = $this->getProperties(); $updated = oseDB::update($this->_table, 'id', $vals); if ($updated) { return true; } else { return false; } }
function update() { $vals = $this->getProperties(); $vals['params'] = oseJson::encode($vals['params']); return oseDB::update($this->_table, 'id', $vals); }