示例#1
0
    $o->istax = 0;
}
switch ($action) {
    //When user submit new organization
    case "create":
        // if the token is exist and not yet expired
        $log->showLog(4, "Accessing create record event, with tax name={$o->tax_name}");
        if ($s->check(false, $token, "CREATE_ACG")) {
            if ($o->insertTax()) {
                $latest_id = $o->getLatestTaxID();
                redirect_header("tax.php?action=edit&tax_id={$latest_id}", $pausetime, "Your data is saved, the new id={$latest_id}");
            } else {
                $token = $s->createToken($tokenlife, "CREATE_ACG");
                $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
                $o->getInputForm("new", -1, $token);
                $o->showTaxTable("WHERE tax_id>0 and organization_id={$defaultorganization_id}", "ORDER BY defaultlevel,tax_name");
            }
        } else {
            // if the token is not valid or the token is expired, it back to previous form with previous inputed data
            $token = $s->createToken($tokenlife, "CREATE_ACG");
            $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
            $o->getInputForm("new", -1, $token);
            $o->showTaxTable("WHERE tax_id>0 and organization_id={$defaultorganization_id}", "ORDER BY defaultlevel,tax_name");
        }
        break;
        //when user request to edit particular organization
    //when user request to edit particular organization
    case "edit":
        if ($o->fetchTax($o->tax_id)) {
            //create a new token for editing a form
            $token = $s->createToken($tokenlife, "CREATE_ACG");