diff --git a/resources/inc/class.resources_bo.inc.php b/resources/inc/class.resources_bo.inc.php index 4dc30a3d94..e1cfeca356 100755 --- a/resources/inc/class.resources_bo.inc.php +++ b/resources/inc/class.resources_bo.inc.php @@ -320,7 +320,8 @@ class resources_bo } } - return $this->so->save($resource) ? false : lang('Something went wrong by saving resource'); + $res_id = $this->so->save($resource); + return $res_id ? $res_id : lang('Something went wrong by saving resource'); } /** diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index b4a60745e1..cff3e50dd9 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -350,6 +350,7 @@ class resources_ui $action_msg = lang('booked'); break; case 'delete': + case 'delete-acc': $action_msg = lang('deleted'); foreach((array)$checked as $n => $id) { @@ -397,27 +398,38 @@ class resources_ui case 'save': case 'apply': unset($content['save']); + unset($content['apply']); // if($content['id'] != 0) // { // // links are already saved by eTemplate // unset($resource['link_to']['to_id']); // } - $content['msg'] = $this->bo->save($content); + $result = $this->bo->save($content); + if(is_numeric($result)) + { + $content['res_id'] = $result; + } + else + { + $content['msg'] = $result; + } break; case 'delete': unset($content['delete']); $content['msg'] = $this->bo->delete($content['res_id']); break; } - + $js = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','addressbook',{$content['res_id']});"; if($button != 'apply' && !$content['msg']) { - $js = "opener.location.href='".$GLOBALS['egw']->link('/index.php', - array('menuaction' => 'resources.resources_ui.index'))."';"; $js .= 'window.close();'; echo "
\n"; $GLOBALS['egw']->common->egw_exit(); } + else + { + $GLOBALS['egw_info']['flags']['java_script'] .= ""; + } } $res_id = is_numeric($content) ? (int)$content : $content['res_id'];