// if the token is exist and not yet expired $log->showLog(4, "Accessing create record event, with financialyear name={$o->financialyear_name}"); if ($s->check(true, $token, "CREATE_ACG")) { if ($o->isValid($o->periodfrom_id, $o->periodto_id)) { if ($o->insertFinancialYear()) { $latest_id = $o->getLatestFinancialYearID(); $l->createFinancialYearLine($latest_id, $o->periodfrom_id, $o->periodto_id); $o->periodqty = $l->createdline + $o->periodqty; $o->updateFinancialYear(); redirect_header("financialyear.php?action=edit&financialyear_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->periodfromctrl = $ctrl->getSelectPeriod($o->periodfrom_id, 'N', "", "periodfrom_id"); $o->periodtoctrl = $ctrl->getSelectPeriod($o->periodto_id, 'N', "", "periodto_id"); $o->getInputForm("new", -1, $token); $o->showFinancialYearTable("WHERE financialyear_id>0 and organization_id={$defaultorganization_id}", "ORDER BY f.financialyear_name"); } } else { $log->showLog(1, "Error: Record cannot create, please verified your input!"); $token = $s->createToken($tokenlife, "CREATE_ACG"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->periodfromctrl = $ctrl->getSelectPeriod($o->periodfrom_id, 'N', "", "periodfrom_id"); $o->periodtoctrl = $ctrl->getSelectPeriod($o->periodto_id, 'N', "", "periodto_id"); $o->getInputForm("new", -1, $token); $o->showFinancialYearTable("WHERE financialyear_id>0 and organization_id={$defaultorganization_id}", "ORDER BY f.financialyear_name"); } } else { // if the token is not valid or the token is expired, it back to previous form with previous inputed data $log->showLog(1, "Error: Record cannot create, due to token expired!"); $token = $s->createToken($tokenlife, "CREATE_ACG");