Commit 6f2f1ec2 authored by Till Brehm's avatar Till Brehm

Improve the readOnly check of form tabs.

parent dc6e082d
......@@ -133,6 +133,8 @@ class tform extends tform_base {
function isReadonlyTab($tab, $primary_id) {
global $app, $conf;
if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true) {
// Add backticks for incomplete table names.
if(stristr($this->formDef['db_table'], '.')) {
$escape = '';
......@@ -144,11 +146,14 @@ class tform extends tform_base {
$record = $app->db->queryOneRecord($sql, $this->formDef['db_table'], $this->formDef['db_table_idx'], $primary_id);
// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
if($record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
return true;
} else {
return false;
}
} else {
return false;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment