<?php
/**
* @author Prakash Khanchandani
* @copyright 2013
* @program bnkMstr01.php
* @description bank master maintenance
* @specialities - programming override to check whether delete allowed
*/
session_start();
require_once ("classes.php");
function createTableObject()
{
$obj = new bnkMstrTbl;
if ($obj->getListAndColumns() === false)
return false;
else
return $obj;
}
#
#
#
#
#
class bnkMstrTbl extends mstrTable
{
function getListAndColumns()
{
$this->tableName = 'bnkMstr';
$this->orderByClause = 'bank';
/*
generate the list with auto determined columns, ie., dont pass any parameters. */
$result = parent::getListAndColumns();
return $result;
}
function canDelete()
{
/* if the bnkMstr record is used in brnchMstr, cannot delete. Otherwise, can.
Funciton returns a 'no' for cannot delete and a 'yes' for can delete. You
cannot return true/false since that is used for returning error condition */
$id = $this->getColDefsId('bank');
$val = $this->colDefs[$id]['colValu'];
$script = new mstrScripts;
// check if bank is used in brnchMstr
$result = $script->readMasterRecord("brnchMstr", "bank='$val'", "limit 1");
if ($result === false) {
addToErrorMsg($script->getErrorMsg());
return false;
}
if (count($result) > 0)
return "no";
else
return "yes";
}
}
#
#
#
#
#
if (!isset($_REQUEST['actn'])) {
$obj = createTableObject();
} else {
/* if the user has taken some action, handle it. */
$obj = handleRequestOption();
}
$form = new mstrFH($obj);
$form->setDemoNotes(bnk01Notes());
$form->displayForm();
?>
|