function printBusinessPermit(&$transObj, $additional_info = NULL) { $permit_type = $transObj->getPermitType(); $permit = $transObj->getPermit(); $owner = $transObj->getOwnerInfo(); $clsBus = new EBPLSEnterprise($this->m_dbLink, false); $clsBus->view($transObj->getData(TRANS_BUSINESS_ID)); // header $header_template = $this->m_strTemplatesPath . "bus/header.html"; // footer $footer_template = $this->m_strTemplatesPath . "bus/footer.html"; // body // item 1 -> onwer info $infoPath = $this->m_strTemplatesPath . "bus/business_info.html"; $strContent = constructTemplate($infoPath, $owner->getData()); // item 2 -> business info $strContent = constructTemplate($strContent, $clsBus->getData(), false); // item 3 -> line of business $strLOBTemplatePath = $this->m_strTemplatesPath . "bus/line_of_business_record.html"; $arrLOB = $transObj->getLineOfBusiness(); for ($i = 0; $i < count($arrLOB); $i++) { $arrLOB[$i]->data_elems[TRANS_BUSNATURE_CAPITAL_INVESTMENT] = number_format($arrLOB[$i]->getData(TRANS_BUSNATURE_CAPITAL_INVESTMENT), 2); $arrLOB[$i]->data_elems[TRANS_BUSNATURE_LAST_GROSS] = number_format($arrLOB[$i]->getData(TRANS_BUSNATURE_LAST_GROSS), 2); $tmpRec = constructTemplate($strLOBTemplatePath, $arrLOB[$i]->getData()) . "\n"; $arrLOBRec[] = $tmpRec; } // ctc info // payables taxes/fees $strFeesTemplatePath = $this->m_strTemplatesPath . "bus/fees_record.html"; $arrFees = $transObj->getFeesList(); $total_fees = 0; for ($i = 0; $i < count($arrFees); $i++) { $total_fees += $arrFees[$i]->getData(TF_TAX_TOTAL_AMOUNT_DUE); $arrFees[$i]->data_elems[TF_TAX_TOTAL_AMOUNT_DUE] = number_format($arrFees[$i]->getData(TF_TAX_TOTAL_AMOUNT_DUE), 2); $tmpRec = constructTemplate($strFeesTemplatePath, $arrFees[$i]->getData()) . "\n"; $arrFeesData[] = $tmpRec; } // create template header $strHeader = constructTemplate($header_template, $additional_info); // create template footer $strFooter = constructTemplate($footer_template, $additional_info); $strContent = str_replace("[REPORTS_HEADER]", $strHeader, $strContent); $strContent = str_replace("[REPORTS_FOOTER]", $strFooter, $strContent); $strContent = str_replace("[RECORDS_LOB]", join("\n", $arrLOBRec), $strContent); $strContent = str_replace("[RECORDS_FEES]", join("\n", $arrFeesData), $strContent); $strContent = str_replace("[TOTAL_FEES]", number_format($total_fees, 2), $strContent); echo $strContent; }
/** * Adds new occ permit application, creates an instance of EBPLSTransaction class, accessible using getTransaction of EBPLSPermit class. * Instance of EBPLSTransaction class identifies the Permit application status and requirements status in the system. * */ function newApplication($creator, $user_level) { if ($this->m_dbLink) { $clsOwner = new EBPLSOwner($this->m_dbLink); unset($this->data_elems[BE_BUSINESS_PERMIT_ID]); $owner_id = $this->data_elems[BE_OWNER_ID]; if ($clsOwner->view($owner_id) <= 0) { $this->debug("Onwer with owner id {$owner_id} not found."); return -1; } // check business id $bus_id = $this->data_elems[BE_BUSINESS_ID]; $clsEnterprise = new EBPLSEnterprise($this->m_dbLink); $ret = $clsEnterprise->view($bus_id); if ($ret < 0) { $this->debug("Business with bus id {$bus_id} not found."); return -1; } $owner_id = $this->data_elems[BE_OWNER_ID]; if ($clsOwner->view($owner_id) <= 0) { $this->debug("Onwer with owner id {$owner_id} not found."); return -1; } $this->setOwner($clsOwner); if (($error_num = $this->validateData()) > 0) { // create reg ts $ts = time(); $nYear = date("Y", $ts); $dt = date("Y-m-d H:i:s", $ts); $this->data_elems[BE_APPLICATION_DATE] = $dt; $this->data_elems[BE_FOR_YEAR] = $nYear; $this->setPermitRegistrationDates($dt, $dt, $nYear); $strValues = $this->data_elems; // create permit $ret = ebpls_insert_data($this->m_dbLink, EBPLS_BUSINESS_PERMIT_TABLE, $strValues); if ($ret < 0) { $this->debug("CREATE BUS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); $this->setError($ret, get_db_error()); } else { $this->debug("CREAT BUS OK {$ret}"); $this->data_elems[BE_BUSINESS_PERMIT_ID] = $ret; $this->m_strPermitNo = $ret; $this->m_strPermitType = PERMIT_TYPE_BUSINESS; } return $ret; } else { $this->debug("CREATE BUS PERMIT FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $error_num; } } else { $this->debug("CREATE BUS FAILED INVALID DB LINK {$this->m_dbLink}"); $this->setError($ret, "Invalid Db link {$this->m_dbLink}"); return -1; } }
/** * * **/ function update($bus_id, $admin, $user_level) { $bus_id = $bus_id == NULL ? $this->getData(BUSINESS_ID) : $bus_id; $this->data_elems[BUSINESS_ID] = $bus_id; if (!is_numeric($bus_id) || $bus_id == NULL || $bus_id == "" || $bus_id <= 0) { $this->debug("Update failed, invalid business id value = {$bus_id}."); return -2; } $clsTmp = new EBPLSEnterprise($this->m_dbLink, $this->m_bDebug); if ($clsTmp->view($bus_id) < 0) { $this->debug("Update failed, business with id '{$bus_id}' not found."); return -1; } if ($this->m_arrBusinessNatureDelete != NULL) { $this->debug("UPDATE BUS ENTERPRISE DELETE Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureDelete); $i++) { $clsENature = new EBPLSEnterpriseNature($this->m_dbLink, $this, $this->m_bDebug); $clsENature->setData(NATURE_BUSINESS_NATURE_CODE, $this->m_arrBusinessNatureDelete[$i]); $clsENature->delete(); } } else { $this->debug("UPDATE BUS ENTERPRISE DELETE Nature NOT EXECUTED"); } if ($this->m_arrBusinessNatureUpdate != NULL) { $this->debug("UPDATE BUS ENTERPRISE UPDATE Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureUpdate); $i++) { $clsENature = $this->m_arrBusinessNatureUpdate[$i]; $clsENature->update(); } } else { $this->debug("UPDATE BUS ENTERPRISE UPDATE Nature NOT EXECUTED"); } if ($this->m_arrBusinessNatureAdd != NULL) { $this->debug("UPDATE BUS ENTERPRISE ADD Nature"); for ($i = 0; $i < count($this->m_arrBusinessNatureAdd); $i++) { $clsNature = $this->m_arrBusinessNatureAdd[$i]; $clsNature->setData(NATURE_BUSINESS_ID, $bus_id); $clsNature->add($admin); } } else { $this->debug("UPDATE BUS ENTERPRISE ADD Nature NOT EXECUTED"); } // exclude those not changed $arrData = $this->getData(); foreach ($arrData as $key => $value) { if ($arrData[$key] != NULL) { // remove keys using index number, bug on view method on this class if (!is_numeric($key)) { $strValues[$key] = $value; } } } if (($error_num = $this->validateData(true)) > 0) { $strWhere[BUSINESS_ID] = $bus_id; $ret = ebpls_update_data($this->m_dbLink, EBPLS_BUSINESS_TABLE, $strValues, $strWhere); if ($ret < 0) { $this->setError($ret, get_db_error()); $this->debug("UPDATE BUS ENTERPRISE FAILED [error:{$ret},msg=" . get_db_error() . "]"); return $ret; } else { $this->debug("UPDATE BUSINESS ENTERPRISE SUCCESSFULL [{$ret}]"); return $ret; } } else { $this->debug("UPDATE BUSINESS ENTERPRISE FAILED [error:{$ret},msg=" . get_db_error() . "]"); return -1; } }
$HTTP_POST_VARS["ctc_first_name"] = $clsOwner->getData(OWNER_FIRST_NAME); $HTTP_POST_VARS["ctc_middle_name"] = $clsOwner->getData(OWNER_MIDDLE_NAME); $HTTP_POST_VARS["ctc_last_name"] = $clsOwner->getData(OWNER_LAST_NAME); $HTTP_POST_VARS["ctc_tin_no"] = $clsOwner->getData(OWNER_TIN_NO); $HTTP_POST_VARS["ctc_birth_date"] = $clsOwner->getData(OWNER_BIRTH_DATE); $HTTP_POST_VARS["ctc_civil_status"] = strtoupper($clsOwner->getData(OWNER_CIVIL_STATUS)); $HTTP_POST_VARS["ctc_citizenship"] = $clsOwner->getData(OWNER_CITIZENSHIP); $HTTP_POST_VARS["ctc_gender"] = $clsOwner->getData(OWNER_GENDER); $HTTP_POST_VARS["ctc_address"] = $clsOwner->getData(OWNER_HOUSE_NO) . " " . $clsOwner->getData(OWNER_STREET); //$HTTP_POST_VARS["ctc_icr_no"] = $clsOwner->getData(OWNER_ICR_NO); $HTTP_POST_VARS["ctc_owner_id"] = $clsOwner->getData(OWNER_ID); $ctc_type = "INDIVIDUAL"; if (intval($ctc_business_id)) { $ctc_type = "BUSINESS"; // load business enterprise info $clsBus = new EBPLSEnterprise($dbLink); $clsBus->view($ctc_business_id); $HTTP_POST_VARS["ctc_company"] = $clsBus->getData(BUSINESS_NAME); $HTTP_POST_VARS["ctc_tin_no"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_place_of_incorporation"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_company_address "] = $clsBus->getData(BUSINESS_LOT_NO) . " " . $clsBus->getData(BUSINESS_STREET); $HTTP_POST_VARS["ctc_place_issued"] = $clsBus->getData(BUSINESS_TIN_REG_NO); $HTTP_POST_VARS["ctc_date_issued"] = $clsBus->getData(BUSINESS_DATE_ESTABLISHED); $HTTP_POST_VARS["ctc_business_id"] = $clsBus->getData(BUSINESS_ID); } } } ?> <div align="CENTER"> <!---// start of the table //--> <table border=0 cellspacing=0 cellpadding=0 width='100%'>
$permit_type = trim($permit_type); $permit_no = trim($permit_no); $owner_id = trim($owner_id); $method_of_application = trim($method_of_application); $is_new = true; //--- check first the method method_of_application NEW $submit_button_name = 'S U B M I T'; if (!strcasecmp($child_reload, 'reload')) { //log_err("refresh"); //--- get the owner $clsOwner = new EBPLSOwner($dbLink, $debug); $clsOwner->view(trim($child_reload_owner_id)); $owner_datarow = $clsOwner->getData(); //--- get the business name if (strlen(trim($child_reload_permit_no)) > 0) { $clsEnterprise = new EBPLSEnterprise($dbLink, $debug); $permit_id = $clsEnterprise->view(trim($child_reload_permit_no)); $datarow = $clsEnterprise->getData(); //--- get the business_nature_list $business_nature_list = $clsEnterprise->getBusinessNatureList($datarow[BUSINESS_ID]); } } //--- chk the sublevels /*if( ! is_valid_sublevels(27) or ! is_valid_sublevels(28) ) { setUrlRedirect('index.php?part=999'); } */ ?> <link rel="stylesheet" href="stylesheets/default.css" type="text/css"/>
function setTransactionStatus($trans_id, $status, $creator, $user_level) { switch ($status) { case TRANS_STATUS_ASSESSMENT: if ($user_level != TRANS_LEVEL_APPLICATION_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("setTransactionStatus Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "setTransactionStatus Failed, user level {$user_level} of {$admin} is not allowed."); return -1; } if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("setTransactionStatus Failed, transaction not loaded, load by invoking loadTransaction."); $this->setError(-1, "setTransactionStatus Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if ($this->getData(TRANS_TRANSACTION_STATUS) != TRANS_STATUS_APPLICATION) { $this->debug("setTransactionStatus Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); $this->setError(-1, "setTransactionStatus Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); return -1; } // NOTE : additional checking should be done here if all requirements have been submitted $pen_req_list = $this->getRequirementList(REQUIREMENT_STATUS_PENDING); //print_r($pen_req_list); if ($pen_req_list != -1 && count($pen_req_list) > 0) { $this->debug("setTransactionStatus Failed, pending requirements not yet submitted."); $this->setError(-1, "setTransactionStatus Failed, pending requirements not yet submitted."); return -1; } ebpls_start_transaction($this->m_dbLink); $ass_code = get_next_system_code($this->m_dbLink, CODES_ASS_COL); $strWhere[TRANS_ID] = $trans_id; $strValue[TRANS_TRANSACTION_STATUS] = TRANS_STATUS_ASSESSMENT; $strValue[TRANS_ASSESSMENT_CODE] = $ass_code; $strValue[TRANS_ASSESSMENT_DATE] = date("Y-m-d H:i:s"); $strValue[TRANS_APPLICATION_DATE_PROCESSED] = date("Y-m-d H:i:s"); $strValue[TRANS_ADMIN_USER] = $creator; $ret = ebpls_update_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValue, $strWhere); if ($ret < 0) { $this->debug("Promotion of transaction to ASSESSMENT stage failed."); $this->setError(-1, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); } else { $this->debug("Promotion of transaction to ASSESSMENT stage ok."); $ret_app_code = update_system_code($this->m_dbLink, CODES_ASS_COL, $ass_code); } ebpls_commit_transaction($this->m_dbLink); break; case TRANS_STATUS_PAYMENT: if ($user_level != TRANS_LEVEL_ASSESSMENT_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("assessTransaction Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "assessTransaction Failed, user level {$user_level} of {$admin} is not allowed."); return -1; } if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("assessTransaction Failed, transaction not loaded, load by invoking loadTransaction."); $this->setError(-1, "assessTransaction Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if ($this->getData(TRANS_TRANSACTION_STATUS) != TRANS_STATUS_ASSESSMENT) { $this->debug("assessTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); $this->setError(-1, "assessTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); return -1; } // NOTE : check if payment mode have beens set if (!$this->isPaymentModeSet()) { $this->setError(-1, "Payment not yet set, please set payment mode before setting transaction for payment status."); return -1; } ebpls_start_transaction($this->m_dbLink); $pay_code = get_next_system_code($this->m_dbLink, CODES_PAY_COL); $strWhere[TRANS_ID] = $trans_id; $strValue[TRANS_TRANSACTION_STATUS] = TRANS_STATUS_PAYMENT; $strValue[TRANS_PAYMENT_CODE] = $pay_code; $strValue[TRANS_PAYMENT_DATE] = date("Y-m-d H:i:s"); $strValue[TRANS_ASSESSMENT_DATE_PROCESSED] = date("Y-m-d H:i:s"); $strValue[TRANS_ADMIN_USER] = $creator; $ret = ebpls_update_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValue, $strWhere); if ($ret < 0) { $this->debug("Promotion of transaction to ASSESSMENT stage failed."); $this->setError(-1, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); } else { $this->debug("Promotion of transaction to ASSESSMENT stage ok."); $ret_app_code = update_system_code($this->m_dbLink, CODES_PAY_COL, $pay_code); } ebpls_commit_transaction($this->m_dbLink); break; case TRANS_STATUS_APPROVAL: if ($user_level != TRANS_LEVEL_PAYMENT_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("paymentTransaction Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "paymentTransaction Failed, user level {$user_level} of {$admin} is not allowed."); return -1; } if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("paymentTransaction Failed, transaction not loaded, load by invoking loadTransaction."); $this->setError(-1, "paymentTransaction Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if ($this->getData(TRANS_TRANSACTION_STATUS) != TRANS_STATUS_PAYMENT) { $this->debug("paymentTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); $this->setError(-1, "paymentTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); return -1; } // ebpls_start_transaction($this->m_dbLink); $apr_code = get_next_system_code($this->m_dbLink, CODES_APR_COL); $strWhere[TRANS_ID] = $trans_id; $strValue[TRANS_TRANSACTION_STATUS] = TRANS_STATUS_APPROVAL; $strValue[TRANS_APPROVAL_CODE] = $apr_code; $strValue[TRANS_APPROVAL_DATE] = date("Y-m-d H:i:s"); $strValue[TRANS_PAYMENT_DATE_PROCESSED] = date("Y-m-d H:i:s"); $strValue[TRANS_ADMIN_USER] = $creator; $ret = ebpls_update_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValue, $strWhere); if ($ret < 0) { $this->debug("Promotion of transaction to ASSESSMENT stage failed."); $this->setError(-1, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); } else { $this->debug("Promotion of transaction to ASSESSMENT stage ok."); $ret_app_code = update_system_code($this->m_dbLink, CODES_APR_COL, $apr_code); } ebpls_commit_transaction($this->m_dbLink); break; case TRANS_STATUS_RELEASING: if ($user_level != TRANS_LEVEL_APPROVAL_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("approveTransaction Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "approveTransaction Failed, user level {$user_level} of {$admin} is not allowed."); return -1; } if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("approveTransaction Failed, transaction not loaded, load by invoking loadTransaction."); $this->setError(-1, "approveTransaction Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if ($this->getData(TRANS_TRANSACTION_STATUS) != TRANS_STATUS_APPROVAL) { $this->debug("setStatusForReleasing Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); $this->setError(-1, "setStatusForReleasing Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); return -1; } ebpls_start_transaction($this->m_dbLink); $rel_code = get_next_system_code($this->m_dbLink, CODES_REL_COL); $strWhere[TRANS_ID] = $trans_id; $strValue[TRANS_TRANSACTION_STATUS] = TRANS_STATUS_RELEASING; $strValue[TRANS_RELEASE_CODE] = $rel_code; $strValue[TRANS_RELEASE_DATE] = date("Y-m-d H:i:s"); $strValue[TRANS_APPROVAL_DATE_PROCESSED] = date("Y-m-d H:i:s"); $strValue[TRANS_ADMIN_USER] = $creator; $ret = ebpls_update_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValue, $strWhere); if ($ret < 0) { $this->debug("Promotion of transaction to ASSESSMENT stage failed."); $this->setError(-1, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); } else { $this->debug("Promotion of transaction to ASSESSMENT stage ok."); $ret_app_code = update_system_code($this->m_dbLink, CODES_REL_COL, $rel_code); } ebpls_commit_transaction($this->m_dbLink); break; case TRANS_STATUS_RELEASED: case TRANS_STATUS_REJECTED: if ($user_level != TRANS_LEVEL_RELEASING_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("releaseTransaction Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "releaseTransaction Failed, user level {$user_level} of {$admin} is not allowed."); return -1; } if (!is_numeric($this->getData(TRANS_ID))) { $this->debug("releaseTransaction Failed, transaction not loaded, load by invoking loadTransaction."); $this->setError(-1, "releaseTransaction Failed, transaction not loaded, load by invoking loadTransaction."); return -1; } if ($this->getData(TRANS_TRANSACTION_STATUS) != TRANS_STATUS_RELEASING) { $this->debug("releaseTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); $this->setError(-1, "releaseTransaction Failed, transaction status already " . $this->getData(TRANS_TRANSACTION_STATUS)); return -1; } // get permit no $permit_type = $this->getPermitType(); $permit_id = $this->getPermitId(); switch ($permit_type) { case PERMIT_TYPE_BUSINESS: $key = CODES_PERMIT_BUS_COL; break; case PERMIT_TYPE_OCCUPATIONAL: $key = CODES_PERMIT_OCCUPATIONAL_COL; break; case PERMIT_TYPE_PEDDLER: $key = CODES_PERMIT_PEDDLER_COL; break; case PERMIT_TYPE_FRANCHISE: $key = CODES_PERMIT_FRANCHISE_BUS_COL; break; case PERMIT_TYPE_MOTORIZED: $key = CODES_PERMIT_MOTORIZED_COL; break; case PERMIT_TYPE_FISHERY: $key = CODES_PERMIT_FISHERY_COL; break; default: $this->debug("Invalid Transaction permit type {$permit_type}, can't process release of transaction."); return -1; break; } ebpls_start_transaction($this->m_dbLink); $strWhere[TRANS_ID] = $trans_id; $strValue[TRANS_TRANSACTION_STATUS] = $status; $strValue[TRANS_RELEASE_DATE_PROCESSED] = date("Y-m-d H:i:s"); $strValue[TRANS_ADMIN_USER] = $creator; if ($status == TRANS_STATUS_RELEASED && ($this->getData(TRANS_TYPE) == TRANS_TYPE_NEW || $this->getData(TRANS_TYPE) == TRANS_TYPE_RENEW)) { $permit_code = get_next_system_code($this->m_dbLink, $key); $strValue[TRANS_PERMIT_CODE] = $permit_code; } // use ebplsPermit as a factory class to retrieve proper class reference with the right type // of EBPLSPermit subclass $clsPermit = new EBPLSPermit($this->m_dbLink, false); $clsPermitToUpdate = $clsPermit->createPermit($this->m_dbLink, $permit_id, $permit_type, false); if ($clsPermitToUpdate != null) { // update transaction with permit code of permit $ret = ebpls_update_data($this->m_dbLink, EBPLS_TRANSACTION_TABLE, $strValue, $strWhere); if ($ret < 0) { $this->debug("Promotion of transaction to {$status} stage failed."); $this->setError(-1, get_db_error()); ebpls_rollback_transaction($this->m_dbLink); } else { // update permit of table $clsPermitToUpdate->assignPermitCode($permit_code); if ($status == TRANS_STATUS_RELEASED && ($this->getData(TRANS_TYPE) == TRANS_TYPE_NEW || $this->getData(TRANS_TYPE) == TRANS_TYPE_RENEW)) { $ret_app_code = update_system_code($this->m_dbLink, $key, $permit_code); } $this->debug("Promotion of transaction to {$status} stage ok."); } // set permit status if ($permit_type == PERMIT_TYPE_BUSINESS) { $clsBus = new EBPLSEnterprise($this->m_dbLink); $clsBus->_updateBusinessNatureApplication($nature_code, NULL, NULL, NULL, "PROCESSED"); } ebpls_commit_transaction($this->m_dbLink); } else { $this->debug("Promotion of transaction to {$status} stage failed, unable to create class permit to assigne permit code."); ebpls_rollback_transaction($this->m_dbLink); } break; default: $this->debug("Unrecognized status {$status} value passed."); break; } $this->data_elem[TRANS_TRANSACTION_STATUS] = $status; return $ret; }