From 7dcf7f970ece01ee9d3804b8e66f23a1cc977f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Wed, 14 Sep 2005 21:28:41 +0000 Subject: [PATCH] make qty working in opener-box --- .../inc/class.resources_select_widget.inc.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/resources/inc/class.resources_select_widget.inc.php b/resources/inc/class.resources_select_widget.inc.php index 1605fb254c..a27881ffa2 100644 --- a/resources/inc/class.resources_select_widget.inc.php +++ b/resources/inc/class.resources_select_widget.inc.php @@ -68,15 +68,26 @@ $tpl =& new etemplate('resources.resource_selectbox'); // keep the editor away from the generated tmpls $tpl->no_onclick = true; - - if ($value) + + if (is_array($value)) { - foreach(ExecMethod('resources.bo_resources.get_calendar_info',$value) as $data) + foreach($value as $id) { - $sel_options[$data['res_id']] = $data['name']; + list($res_id,$quantity) = explode(':',$id); + $data = ExecMethod('resources.bo_resources.get_calendar_info',$res_id); + $sel_options[$data[0]['res_id'].($quantity > 1 ? (':'.$quantity) : '')] = + $data[0]['name'].' ['.($quantity > 1 ? $quantity : 1).'/'.$data[0]['useable'].']'; } $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']); $tpl->set_cell_attribute('resources','id','resources_selectbox');