Allow to include an extra group in event participants

This commit is contained in:
Nathan Gray 2012-04-12 23:04:49 +00:00
parent 340628e721
commit 62a98e50be
2 changed files with 17 additions and 3 deletions

View File

@ -45,8 +45,10 @@ class resources_reserve {
$content = array(
'resource' => key($data['participant_types']['r']),
'date' => $data['start'],
'time' => $data['start'] - mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start']))
'time' => $data['start'] - mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])),
'quantity' => 0
);
calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role);
$data['msg']= '<div class="confirm">'.lang('Registration confirmed %1', egw_time::to($data['start'])) .'</div>';
} else {
$data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>';
@ -71,6 +73,7 @@ class resources_reserve {
$preserve['contact_form'] = $arguments['contact_form'] ? $arguments['contact_form'] : $content['contact_form'];
$preserve['link'] = $arguments['link'] ? $arguments['link'] : $content['link'];
$preserve['email_message'] = $arguments['email_message'] ? $arguments['email_message'] : $content['email_message'];
$preserve['include_group'] = $arguments['include_group'] ? $arguments['include_group'] : $content['include_group'];
// Check for valid time
if($data['date'] && $content['book'])
@ -81,7 +84,7 @@ class resources_reserve {
{
$preferences = new preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user']));
$preferences = $preferences->read_repository();
$duration = $preferences['calendar']['defaultlength'];
$duration = $preferences['calendar']['defaultlength'] * 60;
}
else
{
@ -133,6 +136,10 @@ class resources_reserve {
$contact => calendar_so::combine_status('U', $data['quantity'], 'REQ-PARTICIPANT')
)
);
if($preserve['include_group'])
{
$event['participants'][$preserve['include_group']] = calendar_so::combine_status('U', 1, 'REQ-PARTICIPANT');
}
$cal_bo = new calendar_boupdate();
$result = $cal_bo->update($event);

View File

@ -65,6 +65,13 @@ class module_resources_reservation extends sitemgr_module
'' => lang('None'),
)+registration_bo::get_allowed_addressbooks(registration_bo::CONFIRMED)
),
'include_group' => array(
'type' => 'select',
'label' => lang('Add group to event participants'),
'options' => array(
'' => lang('None'),
) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'])
)
);
}
@ -79,7 +86,7 @@ class module_resources_reservation extends sitemgr_module
// Add resources from selected category
$bo = new resources_bo();
$bo->get_rows($query, $list, $readonlys);
foreach($list as $resource)
foreach($list as $resource)
{
$this->arguments['resource']['options'][$resource['res_id']] = $resource['name'];
}