diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index cfdb3926b2..1a64b39bbe 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1472,10 +1472,6 @@ class calendar_uiforms extends calendar_ui { // fix real app string $content['participants']['resource']['app'] = 'resources'; - // this will be used to get reservation information on the resource select list - $content['participants']['resource']['extra'] = "values2url(this.form,'start,end,duration,participants,recur_type,whole_day')". - "+'&exec[event_id]=".$content['id']."'"."+'&exec[show_conflict]=". - (($this->cal_prefs['defaultresource_sel'] == 'resources_without_conflict')? '0':'1')."'"; } // check if current pref. is an allowed application for the user if (!isset($GLOBALS['egw_info']['user']['apps'][$content['participants']['resource']['app']])) diff --git a/calendar/js/app.js b/calendar/js/app.js index 47272a6235..8e5d105011 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -939,6 +939,40 @@ app.classes.calendar = AppJS.extend( } }, + /** + * In edit popup, search for calendar participants. + * Resources need to have the start & duration (etc.) + * passed along in the query. + * + * @param {Object} request + * @param {et2_link_entry} widget + * + * @returns {boolean} True to continue with the search + */ + edit_participant_search: function(request, widget) + { + if(widget.app_select.val() == 'resources') + { + // Resources search is expecting exec + var values = widget.getInstanceManager().getValues(widget.getRoot()); + if(typeof request.options != 'object' || request.options == null) + { + request.options = {}; + } + request.options.exec = { + start: values.start, + end: values.end, + duration: values.duration, + participants: values.participants, + recur_type: values.recur_type, + whole_day: values.whole_day, + event_id: values.link_to.to_id, // cal_id, if available + show_conflict: (egw.preference('defaultresource_sel','calendar') == 'resources_without_conflict') ? '0' : '1' + } + } + return true; + }, + /** * Handles to select freetime, and replace the selected one on Start, * and End date&time in edit calendar entry popup. diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet index ccb0988322..b55f8784b4 100644 --- a/calendar/templates/default/edit.xet +++ b/calendar/templates/default/edit.xet @@ -112,7 +112,7 @@ - + diff --git a/resources/inc/class.resources_bo.inc.php b/resources/inc/class.resources_bo.inc.php index fb9ea02023..748955f0f8 100755 --- a/resources/inc/class.resources_bo.inc.php +++ b/resources/inc/class.resources_bo.inc.php @@ -588,11 +588,11 @@ class resources_bo $data = $this->so->search($criteria,$only_keys,$order_by='name',$extra_cols='',$wildcard='%',$empty,$op='OR',$limit,$filter); // maybe we need to check disponibility of the searched resources in the calendar if $pattern ['exec'] contains some extra args $show_conflict=False; - if (is_array($pattern) && isset($pattern['exec']) ) + if ($options['exec']) { // we'll use a cache for resources info taken from database static $res_info_cache = array(); - $cal_info=$pattern['exec']; + $cal_info=$options['exec']; if ( isset($cal_info['start']) && isset($cal_info['duration'])) { //get a calendar objet for reservations @@ -602,11 +602,7 @@ class resources_bo $this->bocal =& CreateObject('calendar.calendar_bo'); } - //get the real timestamps from infos we have on the event - //use etemplate date widget to handle date values - require_once(EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.jscalendar.inc.php'); - $jscal=& CreateObject('phpgwapi.jscalendar'); - $startarr= $jscal->input2date($cal_info['start']['str'],$raw='raw',$day='day',$month='month',$year='year'); + $startarr= getdate(strtotime($cal_info['start'])); if (isset($cal_info['whole_day'])) { $startarr['hour'] = $startarr['minute'] = 0; unset($startarr['raw']); @@ -673,7 +669,7 @@ class resources_bo } } if (isset($res_info_cache)) { - $show_conflict= (isset($pattern['exec']['show_conflict'])&& ($pattern['exec']['show_conflict']=='0'))? False:True; + $show_conflict= (isset($options['exec']['show_conflict'])&& ($options['exec']['show_conflict']=='0'))? False:True; // if we have this array indexed on resource id it means non-bookable resource are removed and we are working for calendar // so we'll loop on this one and not $data foreach($res_info_cache as $id => $resource) {