peculiar problem with grafted field

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

peculiar problem with grafted field

Postby samhans » Wed Feb 22, 2012 2:20 am

HAI STEVE AND ALL,

a peculiar problem arrived, when i put a grafted field in my table delegate class. every thing worked fine but when i added a column in my table demand the page displays error "there is no column demand.demd_qty................."

the demd_qty is the new filed i added. when i delete this grafted field from my delegate class everything worked fine. I cant able to know what is the issue??


my demand.php is like this

<?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();
}


}


what is the problem , i have deleted and created a fresh table also, but to no avail. please help
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: peculiar problem with grafted field

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

You may need to delete all of the cache views that dataface creates. These are the views with names line dataface__view_xxxxxxxxxx

When using custom __sql__ dataface creates these for performance reasons... but if you then add fields, you may need to clear them.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 22 guests

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