Exemple #1
0
                     }
                 } else {
                     // next month child user tariff change
                     $billing->settariffnm($eachchild, $tariff);
                     log_register('CHANGE TariffNM ' . $eachchild . ' ON ' . $tariff);
                 }
             }
         }
         rcms_redirect("?module=corporate&userlink=" . $userlink . "&control=tariff");
     }
     // end of newtariff checks
 }
 //tariffs end
 if ($_GET['control'] == 'credit') {
     //group credit operations
     $allchildusers = cu_GetAllChildUsers($userlink);
     $current_credit = zb_UserGetStargazerData($parent_login);
     $current_credit = $current_credit['Credit'];
     //construct form
     $creditinputs = wf_TextInput('newcredit', 'New credit', $current_credit, true, '10');
     $creditinputs .= wf_Submit('Save');
     $creditform = wf_Form('', 'POST', $creditinputs, 'glamour');
     show_window(__('Edit credit'), $creditform);
     //if group credit change
     if (isset($_POST['newcredit'])) {
         $credit = vf($_POST['newcredit']);
         //change credit for parent user
         $billing->setcredit($parent_login, $credit);
         log_register('CHANGE Credit ' . $parent_login . ' ON ' . $credit);
         // set credit for all child users
         if (!empty($allchildusers)) {
Exemple #2
0
function bs_ProcessHash($hash)
{
    global $billing;
    $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    //corporate users handling
    if ($alterconf['USER_LINKING_ENABLED']) {
        $allparentusers = cu_GetAllParentUsers();
    }
    $query = "SELECT `id`,`summ`,`login` from `bankstaparsed` WHERE `hash`='" . $hash . "' AND `state`='0' AND `login` !=''";
    $allinprocessed = simple_queryall($query);
    if (!empty($allinprocessed)) {
        log_register("BANKSTA PROCESSING " . $hash . " START");
        foreach ($allinprocessed as $io => $eachrow) {
            //setting payment variables
            $operation = 'add';
            $cashtype = $alterconf['BS_CASHTYPE'];
            $cash = $eachrow['summ'];
            $note = mysql_real_escape_string("BANKSTA:" . $eachrow['id']);
            // CU filter subroutine
            if ($alterconf['USER_LINKING_ENABLED']) {
                if (!bs_cu_IsParent($eachrow['login'], $allparentusers)) {
                    //normal user cash
                    zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                    simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                } else {
                    //corporate user
                    $userlink = $allparentusers[$eachrow['login']];
                    $allchildusers = cu_GetAllChildUsers($userlink);
                    // adding natural payment to parent user
                    zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                    simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                    if (!empty($allchildusers)) {
                        foreach ($allchildusers as $eachchild) {
                            //adding quiet payments for child users
                            $billing->addcash($eachchild, $cash);
                            log_register("BANKSTA GROUPBALANCE " . $eachchild . " " . $operation . " ON " . $cash);
                        }
                    }
                    // end of processing with linking
                }
            } else {
                // standalone user cash push
                zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                // end of processing without linking
            }
        }
        log_register("BANKSTA PROCESSING " . $hash . " END");
    } else {
        log_register("BANKSTA PROCESSING " . $hash . " EMPTY");
    }
}