Exemplo n.º 1
0
function newProvisionalTransaction($option, $fromTransaction = FALSE)
{
    // checkmarked transaction?
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    $id = $cid[0];
    if ($id) {
        if ($fromTransaction) {
            // id refers to transaction id. get member from transaction
            $oldTransaction = new CbodbTransaction($id);
            $member_id = $oldTransaction->memberID;
        } else {
            // id refers to member id
            $member_id = $id;
        }
    } else {
        // if that fails, try getting member_id from post var
        $member_id = JRequest::getVar('list_query_member_id', 0, '', 'INT');
    }
    $member = new CbodbMember($member_id);
    $memberCredits = $member->getMemberInfo();
    $transaction = new CbodbTransaction();
    $transaction->itemID = JRequest::getVar('itemID', 0, '', 'INT');
    $transaction->cash = JRequest::getVar('cash', '', '', 'string');
    $transaction->comment = JRequest::getVar('comment', '', '', 'string');
    $transaction->type = JRequest::getVar('type', '', '', 'INT');
    //  John Mikolich   December 30, 2010
    //  This is the first (and so far, the only working) example
    //  of the addition of a statement to set the timezone
    //  prior to the call to the PHP date function as a
    //  resolution to the 'timezone issue'.  With the addition
    //  of the statement below (marked by the 'NEW!!' decoration),
    //  any new provisional transactions in
    //  the Joomla back-end is started with the correct timezone.
    date_default_timezone_set(getConfigValue("timeZone"));
    // NEW!!
    $transaction->dateOpen = date("Y-m-d H:i:s", time());
    $transaction->dateClosed = date("Y-m-d H:i:s", time());
    HTML_cbodb::newProvisionalTransaction($option, $transaction, $member, $memberCredits);
}