add functionality to enter quantity on resource booking

This commit is contained in:
Cornelius Weiß 2005-09-06 21:45:37 +00:00
parent a4b3f4fecb
commit dd2b005a7d
4 changed files with 23 additions and 10 deletions

View File

@ -6,7 +6,6 @@ TODO:
- list
select all button --> add actions for selected: move to other cat,...
popup on picture --> show
make button-alignment nicer
add show-calender button
- edit/add

View File

@ -68,8 +68,17 @@ class bo_resources
$rows = $this->so->search($criteria,$read_onlys,$order_by,'','',$empty=False,$op='OR',$start,$filter,$join='',$need_full_no_count=false);
$nr = $this->so->total;
// We don't need the readonly checkes if we only show bookable resources
if($query['show_bookable']) return $nr;
// we are called to serve bookable resources (e.g. calendar-dialog)
if($query['show_bookable'])
{
// This is somehow ugly, i know...
foreach($rows as $num => $resource)
{
$rows[$num]['default_qty'] = 1;
}
// we don't need all the following testing
return $nr;
}
foreach((array)$rows as $num => $resource)
{
@ -240,7 +249,7 @@ class bo_resources
/**
* returns info about resource for calender
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss<egw@von-und-zu-weiss.de>
* @param int/array $res_id single id or array $num => $res_id
* @return array
*/

View File

@ -341,10 +341,15 @@ class ui_resources
openerid='resources_selectbox';
id='exec[nm][rows][selectbox]';
function addOption(label,value)
function addOption(label,value,button_id,useable)
{
quantity = document.getElementById(button_id+'[default_qty]').value;
if(quantity>useable) {
alert('".lang('You chose more resources than available')."');
return false;
}
label = label+'['+quantity+'/'+useable+']';
openerSelectBox = opener.document.getElementById(openerid);
if (openerSelectBox) {
select = '';
for(i=0; i < openerSelectBox.length; i++) {
@ -355,7 +360,7 @@ class ui_resources
}
}
select += (select ? ',' : '')+value;
opener.selectbox_add_option(openerid,label,value,0);
opener.selectbox_add_option(openerid,label,value+':'+quantity,0);
}
selectBox = document.getElementById(id);
if (selectBox) {

File diff suppressed because one or more lines are too long