mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Use sitemgr user's default appointment duration for booking time blocks
This commit is contained in:
parent
4aa875b885
commit
340628e721
@ -75,8 +75,18 @@ class resources_reserve {
|
||||
// Check for valid time
|
||||
if($data['date'] && $content['book'])
|
||||
{
|
||||
$start_time = $data['date'] + $data['time'];
|
||||
$duration = ($GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60);
|
||||
$start_time = $data['date'] + (is_array($data['time']) ? $data['time']['hour']*3600 + $data['time']['minute']*60 : $data['time']);
|
||||
// Use sitemgr's default appointment length
|
||||
if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
|
||||
{
|
||||
$preferences = new preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user']));
|
||||
$preferences = $preferences->read_repository();
|
||||
$duration = $preferences['calendar']['defaultlength'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$duration = ($GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60);
|
||||
}
|
||||
$end_time = $start_time + $duration;
|
||||
|
||||
$config = config::read('registration');
|
||||
@ -196,7 +206,22 @@ class resources_reserve {
|
||||
}
|
||||
|
||||
if(!$data['date']) $data['date'] = strtotime('tomorrow');
|
||||
if(!$data['time']) $data['time'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'] * 60 * 60;
|
||||
if(!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'];
|
||||
|
||||
// Use sitemgr's default appointment length
|
||||
if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
|
||||
{
|
||||
$preferences = new preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user']));
|
||||
$preferences = $preferences->read_repository();
|
||||
$data['duration'] = $preferences['calendar']['defaultlength'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['duration'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'];
|
||||
}
|
||||
// Leading 0
|
||||
$data['duration'] = '0'.$data['duration'];
|
||||
|
||||
if(!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking
|
||||
!$GLOBALS['egw_info']['user']['apps']['calendar'] // Needed for updating schedule
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* EGroupware - eTemplates for Application resources
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2012-03-06 14:20
|
||||
* generated by soetemplate::dump4setup() 2012-04-12 15:50
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package resources
|
||||
@ -63,7 +63,7 @@ $templ_data[] = array('name' => 'resources.show.rows','template' => '','lang' =>
|
||||
|
||||
$templ_data[] = array('name' => 'resources.showdetails','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:8:{i:0;a:8:{s:2:"c1";s:3:"nmh";s:1:"B";s:4:"100%";s:2:"c5";s:2:"th";s:2:"h3";s:2:"1%";s:2:"c6";s:11:"row_off,top";s:1:"A";s:3:"43%";s:2:"h1";s:5:"240px";s:2:"h5";s:10:",@!link_to";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"image";s:4:"name";s:16:"resource_picture";s:5:"align";s:6:"center";}s:1:"B";a:4:{s:4:"type";s:4:"grid";s:4:"data";a:9:{i:0;a:1:{s:2:"c5";s:4:",top";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:1:"b";s:5:"label";s:5:"Name:";}s:1:"B";a:4:{s:4:"type";s:5:"label";s:4:"size";s:1:"b";s:7:"no_lang";s:1:"1";s:4:"name";s:4:"name";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Inventory number:";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:16:"inventory_number";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Category:";}s:1:"B";a:3:{s:4:"type";s:10:"select-cat";s:4:"name";s:6:"cat_id";s:8:"readonly";s:1:"1";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:13:"Responsible: ";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:9:"cat_admin";s:8:"readonly";s:1:"1";}}i:5;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Quantity: ";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:8:"quantity";}}i:6;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Useable:";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:7:"useable";}}i:7;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Location:";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"location";}}i:8;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"Storage information:";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:12:"storage_info";}}}s:4:"rows";i:8;s:4:"cols";i:2;}}i:2;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"html";s:4:"span";s:1:"2";s:4:"name";s:11:"description";s:8:"readonly";s:1:"1";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:6:{s:4:"type";s:5:"label";s:4:"span";s:1:"2";s:4:"data";a:2:{i:0;a:1:{s:1:"A";s:4:"100%";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:13:"Related links";}s:1:"B";a:6:{s:4:"type";s:6:"button";s:5:"label";s:17:"Buy this resource";s:5:"align";s:5:"right";s:4:"size";s:7:"buyable";s:4:"help";s:17:"Buy this resource";s:4:"name";s:11:"btn_buyable";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:18:"Book this resource";s:4:"name";s:12:"btn_bookable";s:4:"size";s:8:"bookable";}s:1:"D";a:5:{s:4:"type";s:6:"button";s:5:"label";s:4:"edit";s:4:"name";s:8:"btn_edit";s:4:"size";s:4:"edit";s:4:"help";s:4:"edit";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:5:"label";s:13:"Related links";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:4:{s:4:"type";s:9:"link-list";s:4:"span";s:3:"all";s:4:"name";s:7:"link_to";s:8:"readonly";s:1:"1";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:7;a:2:{s:1:"A";a:8:{s:4:"type";s:4:"hbox";s:5:"label";s:6:"Cancel";s:4:"span";s:1:"2";s:4:"size";s:1:"2";i:1;a:9:{s:4:"type";s:4:"hbox";s:5:"label";s:4:"Edit";s:4:"span";s:1:"2";s:4:"name";s:8:"btn_edit";s:4:"size";s:1:"4";i:1;a:5:{s:4:"type";s:6:"button";s:5:"label";s:4:"Edit";s:4:"span";s:1:"2";s:4:"name";s:8:"btn_edit";s:4:"help";s:16:"Buy this article";}i:2;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:7:"onclick";s:14:"window.close()";}i:3;a:6:{s:4:"type";s:6:"button";s:5:"label";s:8:"Calendar";s:4:"span";s:1:"2";s:4:"name";s:12:"btn_calendar";s:4:"help";s:25:"Show calendar of resource";s:7:"onclick";s:120:"opener.location=egw::link(\'/index.php\',\'menuaction=calendar.calendar_uiviews.month&owner=r$cont[res_id]\'); return false;";}i:4;a:5:{s:4:"type";s:6:"button";s:5:"label";s:4:"Book";s:7:"onclick";s:209:"window.open(egw::link(\'/index.php\',\'menuaction=calendar.calendar_uiforms.edit&participants=r$cont[res_id]\'),\'\',\'dependent=yes,width=750,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\');";s:4:"name";s:8:"btn_book";s:4:"help";s:18:"Book this resource";}}i:2;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:5:"align";s:5:"right";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:7:"onclick";s:61:"return confirm(\'Do you really want do delte this resource?\');";s:4:"name";s:10:"btn_delete";}}i:3;a:1:{s:4:"type";s:5:"label";}i:4;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:10:"btn_delete";s:5:"align";s:5:"right";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:7;s:4:"cols";i:2;s:4:"size";s:7:"750,480";s:7:"options";a:2:{i:0;s:3:"750";i:1;s:3:"480";}}}','size' => '750,480','style' => '','modified' => '1129667646',);
|
||||
|
||||
$templ_data[] = array('name' => 'resources.sitemgr_book','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:3:"box";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"1";i:1;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:12:{i:0;a:6:{s:2:"h2";s:6:",!@msg";s:2:"h7";s:15:",!@contact_form";s:2:"h8";s:15:",!@show_contact";s:2:"h9";s:15:",!@show_contact";s:2:"h4";s:20:",!@short_description";s:2:"h5";s:19:",!@long_description";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:6:"res_id";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"span";s:11:"all,message";s:4:"name";s:3:"msg";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:4:"name";s:4:"span";s:5:",name";}s:1:"B";a:4:{s:4:"type";s:5:"image";s:4:"name";s:7:"picture";s:5:"align";s:5:"right";s:4:"span";s:15:",resource_thumb";}}i:4;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:17:"short_description";s:4:"span";s:15:"all,description";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"span";s:15:"all,description";s:4:"name";s:16:"long_description";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";i:1;a:3:{s:4:"type";s:4:"date";s:5:"label";s:4:"Date";s:4:"name";s:4:"date";}i:2;a:2:{s:4:"type";s:13:"date-timeonly";s:4:"name";s:4:"time";}s:5:"label";s:4:"Date";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:4:"date";s:4:"name";s:4:"date";s:8:"onchange";s:219:"var request = new egw_json_request(\'resources.resources_reserve.ajax_update_planner\',[document.getElementById(\'exec[res_id]\').value, Math.round(window.calendar.date.getTime()/1000)]);request.sendRequest(); return false;";}i:2;a:2:{s:4:"type";s:13:"date-timeonly";s:4:"name";s:4:"time";}}}i:7;a:2:{s:1:"A";a:3:{s:4:"type";s:8:"template";s:4:"span";s:3:"all";s:4:"name";s:13:"@contact_form";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:8;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:4:"text";s:4:"name";s:7:"n_given";i:1;a:1:{s:4:"type";s:4:"hbox";}}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:8:"n_family";}}}i:9;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Email";}s:1:"B";a:4:{s:4:"type";s:9:"url-email";s:4:"size";s:2:"48";s:4:"name";s:5:"email";s:6:"needed";s:1:"1";}}i:10;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Party size";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:3:"int";s:4:"name";s:8:"quantity";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Book";s:5:"align";s:5:"right";s:4:"name";s:4:"book";}}}i:11;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"span";s:3:"all";s:4:"name";s:11:"planner_div";s:4:"size";s:1:"1";i:1;a:3:{s:4:"type";s:4:"html";s:4:"span";s:3:"all";s:4:"name";s:7:"planner";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:11;s:4:"cols";i:2;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}}','size' => '','style' => '.resource_thumb img {
|
||||
$templ_data[] = array('name' => 'resources.sitemgr_book','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:3:"box";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"1";i:1;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:12:{i:0;a:6:{s:2:"h2";s:6:",!@msg";s:2:"h7";s:15:",!@contact_form";s:2:"h8";s:15:",!@show_contact";s:2:"h9";s:15:",!@show_contact";s:2:"h4";s:20:",!@short_description";s:2:"h5";s:19:",!@long_description";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:6:"hidden";s:4:"name";s:6:"res_id";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"span";s:11:"all,message";s:4:"name";s:3:"msg";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:4:"name";s:4:"span";s:5:",name";}s:1:"B";a:4:{s:4:"type";s:5:"image";s:4:"name";s:7:"picture";s:5:"align";s:5:"right";s:4:"span";s:15:",resource_thumb";}}i:4;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:17:"short_description";s:4:"span";s:15:"all,description";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"span";s:15:"all,description";s:4:"name";s:16:"long_description";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";i:1;a:3:{s:4:"type";s:4:"date";s:5:"label";s:4:"Date";s:4:"name";s:4:"date";}i:2;a:2:{s:4:"type";s:13:"date-timeonly";s:4:"name";s:4:"time";}s:5:"label";s:4:"Date";}s:1:"B";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"4,,0,0";i:1;a:3:{s:4:"type";s:4:"date";s:4:"name";s:4:"date";s:8:"onchange";s:219:"var request = new egw_json_request(\'resources.resources_reserve.ajax_update_planner\',[document.getElementById(\'exec[res_id]\').value, Math.round(window.calendar.date.getTime()/1000)]);request.sendRequest(); return false;";}i:2;a:2:{s:4:"type";s:11:"select-hour";s:4:"name";s:10:"time[hour]";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:1:":";}i:4;a:3:{s:4:"type";s:13:"select-number";s:4:"name";s:12:"time[minute]";s:4:"size";s:21:",0,59,$cont[duration]";}}}i:7;a:2:{s:1:"A";a:3:{s:4:"type";s:8:"template";s:4:"span";s:3:"all";s:4:"name";s:13:"@contact_form";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:8;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:4:"text";s:4:"name";s:7:"n_given";i:1;a:1:{s:4:"type";s:4:"hbox";}}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:8:"n_family";}}}i:9;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Email";}s:1:"B";a:4:{s:4:"type";s:9:"url-email";s:4:"size";s:2:"48";s:4:"name";s:5:"email";s:6:"needed";s:1:"1";}}i:10;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Party size";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:3:"int";s:4:"name";s:8:"quantity";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Book";s:5:"align";s:5:"right";s:4:"name";s:4:"book";}}}i:11;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"span";s:3:"all";s:4:"name";s:11:"planner_div";s:4:"size";s:1:"1";i:1;a:3:{s:4:"type";s:4:"html";s:4:"span";s:3:"all";s:4:"name";s:7:"planner";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:11;s:4:"cols";i:2;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}}','size' => '','style' => '.resource_thumb img {
|
||||
float:right;
|
||||
position:absolute;
|
||||
}','modified' => '1328133598',);
|
||||
|
@ -33,7 +33,13 @@
|
||||
<description value="Date"/>
|
||||
<hbox options="0,0">
|
||||
<date id="date" onchange="var request = new egw_json_request('resources.resources_reserve.ajax_update_planner',[document.getElementById('exec[res_id]').value, Math.round(window.calendar.date.getTime()/1000)]);request.sendRequest(); return false;"/>
|
||||
<date-timeonly id="time"/>
|
||||
<menulist>
|
||||
<menupopup type="select-hour" id="time[hour]"/>
|
||||
</menulist>
|
||||
<description value=":"/>
|
||||
<menulist>
|
||||
<menupopup type="select-number" id="time[minute]" options=",0,59,$cont[duration]"/>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</row>
|
||||
<row disabled="!@contact_form">
|
||||
|
Loading…
Reference in New Issue
Block a user