mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
show calendar icon makes only sense if resource is bookable :-)
readonly fix for select-resources widget
This commit is contained in:
parent
c22a34ef12
commit
484297c45a
@ -97,6 +97,7 @@ class bo_resources
|
||||
if (!$resource['bookable'] /* && calender-acl viewable */)
|
||||
{
|
||||
$readonlys["bookable[$resource[res_id]]"] = true;
|
||||
$readonlys["calendar[$resource[res_id]]"] = true;
|
||||
}
|
||||
if (!$resource['buyable'])
|
||||
{
|
||||
|
@ -59,6 +59,16 @@
|
||||
*/
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
{
|
||||
if ($cell['readonly'] && !is_array($value))
|
||||
{
|
||||
// no acl check here cause names are allways viewable
|
||||
list($res_id,$quantity) = explode(':',$value);
|
||||
$data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id);
|
||||
$cell['type'] = 'label';
|
||||
$value = $data[0]['name']. ($data[0]['useable'] > 1 ? ' ['. ($quantity > 1 ? $quantity : 1). '/'. $data[0]['useable']. ']' : '');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['resources'])
|
||||
{
|
||||
$cell = $tmpl->empty_cell();
|
||||
@ -69,9 +79,9 @@
|
||||
// keep the editor away from the generated tmpls
|
||||
$tpl->no_onclick = true;
|
||||
|
||||
if (is_array($value))
|
||||
if ($value)
|
||||
{
|
||||
foreach($value as $id)
|
||||
foreach((array)$value as $id)
|
||||
{
|
||||
list($res_id,$quantity) = explode(':',$id);
|
||||
$data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id);
|
||||
@ -80,13 +90,6 @@
|
||||
}
|
||||
$tpl->set_cell_attribute('resources','sel_options',$sel_options);
|
||||
}
|
||||
elseif ($value);
|
||||
{
|
||||
// list($res_id,$quantity) = explode(':',$value);
|
||||
// $data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id);
|
||||
// $sel_options = $data[0]['name'].' ['.($quantity > 1 ? $quantity : 1).'/'.$data[0]['useable'].']';
|
||||
// $tpl->set_cell_attribute('resources','sel_options',$sel_options);
|
||||
}
|
||||
|
||||
$tpl->set_cell_attribute('resources','size',(int)$cell['size'].'+');
|
||||
$tpl->set_cell_attribute('resources','label',$cell['label']);
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user