コード例 #1
0
ファイル: cbodb.php プロジェクト: reeleis/ohiocitycycles
function saveNewMemberPurchase($option)
{
    global $mainframe;
    $postRow = JRequest::get('post');
    if (strcmp($postRow[nameFirst], "") != 0) {
        $itemID = $postRow[itemID];
        $cash = $postRow[cash];
        $member = new CbodbMember();
        $member->setAll($postRow);
        $member->creditRate = NULL;
        // Make the rate set to default
        if ($member->emailAddress != NULL) {
            $member->emailNews = 1;
        }
        $member->timeCreated = time();
        $member->saveData();
        $transaction = new CbodbTransaction();
        $transaction->memberID = $member->id;
        $transaction->itemID = $itemID;
        $transaction->cash = $cash;
        $transaction->type = 1001;
        $transaction->dateOpen = date("Y-m-d H:i:s", time());
        $transaction->dateClosed = date("Y-m-d H:i:s", time());
        $transaction->saveData();
        CbodbItem::markTagAsSold($itemID);
        $mainframe->redirect('index.php?option=' . $option . '&task=shop&key=3b767559374f5132236f6e68256b2529#top', 'Your transaction has been recorded, thank you.');
    } else {
        HTML_cbodb::newMemberPurchase($option, $postRow);
    }
}