can't able to add a field in table.

A place for users and developers of the Xataface to discuss and receive support.

can't able to add a field in table.

Postby samhans » Wed Feb 22, 2012 10:49 am

hai Steve and all,

i can't able to add a new fields in my table demand.

when i add a field and clicks on the demand table . error pops up saying it can't find the field specified. but actualy the field is there.

my demand .php is below:








<?php

class tables_demand {




// here permission of demand table is set for demande and approver,admin is by default
function getPermissions(&$record){
//if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
$auth =&Dataface_AuthenticationTool::getInstance();
$user =& $auth ->getLoggedInUser();
if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
if ( isAdmin() ) return Dataface_PermissionsTool::ALL();
$role = $user->val('Role');
if($user->val('Role') == 'DEMANDE' ) return Dataface_PermissionsTool::getRolePermissions($role);
if($user->val('Role') == 'APPROVER' ) return Dataface_PermissionsTool::getRolePermissions($role);
if($user->val('Role') == 'LOAN INCHARGE' ) return Dataface_PermissionsTool::getRolePermissions($role);
//if ( isAdmin() ) return Dataface_PermissionsTool::ALL();
return Dataface_PermissionsTool::NO_ACCESS();

}


//this create the role column in demand table,this is a grafted column.
function __sql__(){
$user_id = getcurrentUsername();
return "select demand.*,if(owner_id='".addslashes($user_id)."','owner',if(approver='".addslashes($user_id)."','approver', null)) as role from demand";

}


function init(&$table){
$user = getUser();
if($user and $user->val('Role')!='ADMIN'){
$table->setSecurityFilter(array('role'=>'>'));
}return array();
}


// field level permission starts from here.

function sec_commander__permissions(&$record) {
$auth = & Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
$role = $user->val('Role');

if(isAdmin()){
return Dataface_PermissionsTool::ALL();
} elseif($user->val('Role') == 'APPROVER' ) {
return Dataface_PermissionsTool::getRolePermissions($role);
} else return Dataface_PermissionsTool::NO_ACCESS();
}


}

moreover i have created a grafted field role. when i delete it every thing runs fine

please help.
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: can't able to add a field in table.

Postby shannah » Wed Feb 22, 2012 12:24 pm

What is the exact error message? And when/where does the error appear?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: can't able to add a field in table.

Postby samhans » Wed Feb 22, 2012 4:08 pm

the error comes while clicking on the demand table to list. it shows demand.demand_name field is not there. but actually the field specified is present. when i delete it every thing runs fine..
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 18 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved