From a3513a979713905b34c4381d9e56c36c0cfb76fe Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 17 Dec 2012 22:14:32 +0000 Subject: [PATCH] Add history logging & delete protection --- resources/inc/class.bo_acl.inc.php | 1 + resources/inc/class.resources_bo.inc.php | 63 ++++++++++++++++++- resources/inc/class.resources_hooks.inc.php | 1 + resources/inc/class.resources_ui.inc.php | 34 +++++++++- .../class.resources_wizard_export_csv.inc.php | 17 +---- resources/setup/etemplates.inc.php | 6 +- resources/setup/setup.inc.php | 3 +- resources/setup/tables_current.inc.php | 5 +- resources/setup/tables_update.inc.php | 11 ++++ resources/templates/default/edit.xet | 5 ++ 10 files changed, 122 insertions(+), 24 deletions(-) diff --git a/resources/inc/class.bo_acl.inc.php b/resources/inc/class.bo_acl.inc.php index 1fa0598b79..042c3996af 100755 --- a/resources/inc/class.bo_acl.inc.php +++ b/resources/inc/class.bo_acl.inc.php @@ -197,6 +197,7 @@ class bo_acl self::get_permissions($cat_id); } //echo "

".__METHOD__."($cat_id,$right) = ".self::$permissions[$cat_id]." & $right = ".(self::$permissions[$cat_id] & $right)."

\n"; + return (boolean) (self::$permissions[$cat_id] & $right); } diff --git a/resources/inc/class.resources_bo.inc.php b/resources/inc/class.resources_bo.inc.php index e6df7b2ea1..4fe6266ce4 100755 --- a/resources/inc/class.resources_bo.inc.php +++ b/resources/inc/class.resources_bo.inc.php @@ -18,6 +18,7 @@ */ class resources_bo { + const DELETED = 'deleted'; const PICTURE_NAME = '.picture.jpg'; var $resource_icons = '/resources/templates/default/images/resource_icons/'; var $debug = 0; @@ -48,6 +49,23 @@ class resources_bo // Accessories of a resource added when resource selected ); + public static $field2label = array( + 'res_id' => 'Resource ID', + 'name' => 'name', + 'short_description' => 'short description', + 'cat_id' => 'Category', + 'quantity' => 'Quantity', + 'useable' => 'Useable', + 'location' => 'Location', + 'storage_info' => 'Storage', + 'bookable' => 'Bookable', + 'buyable' => 'Buyable', + 'prize' => 'Prize', + 'long_description' => 'Long description', + 'inventory_number' => 'inventory number', + 'accessory_of' => 'Accessory of' + ); + function __construct() { $this->so = new resources_so(); @@ -106,9 +124,16 @@ class resources_bo $join = $acc_join; $extra_cols[] = 'acc_count'; break; + case self::DELETED: + $filter[] = 'deleted IS NOT NULL'; + break; default: $filter['accessory_of'] = $query['filter2']; } + if($query['filter2'] != self::DELETED) + { + $filter['deleted'] = null; + } if ($query['filter']) { @@ -154,13 +179,20 @@ class resources_bo return $nr; } + $config = config::read('resources'); foreach($rows as $num => &$resource) { if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_EDIT)) { $readonlys["edit[$resource[res_id]]"] = true; } - if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE)) + elseif($resource['deleted']) + { + $resource['class'] .= 'deleted '; + } + if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE) || + ($resource['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history') + ) { $readonlys["delete[$resource[res_id]]"] = true; $resource['class'] .= 'no_delete '; @@ -288,6 +320,12 @@ class resources_bo return $msg; } + // Check for restore of deleted, restore held links + if($old && $old['deleted'] && !$resource['deleted']) + { + egw_link::restore('resources', $resource['res_id']); + } + // delete old pictures if($resource['picture_src'] != 'own_src') { @@ -323,6 +361,17 @@ class resources_bo } $res_id = $this->so->save($resource); + + // History & notifications + if (!is_object($this->tracking)) + { + $this->tracking = new resources_tracking(); + } + if ($this->tracking->track($resource,$old,$this->user) === false) + { + return implode(', ',$this->tracking->errors); + } + return $res_id ? $res_id : lang('Something went wrong by saving resource'); } @@ -339,7 +388,17 @@ class resources_bo return lang('You are not permitted to delete this resource!'); } - if ($this->so->delete(array('res_id'=>$res_id))) + // check if we only mark timesheets as deleted, or really delete them + $old = $this->read($res_id); + $config = config::read('resources'); + if ($config['history'] != '' && $old['deleted'] == null) + { + $old['deleted'] = time(); + $this->save($old); + egw_link::unlink(0,'resources',$res_id,'','','',true); + return false; + } + elseif ($this->so->delete(array('res_id'=>$res_id))) { $accessories = $this->get_acc_list($res_id); foreach($accessories as $acc_id => $name) diff --git a/resources/inc/class.resources_hooks.inc.php b/resources/inc/class.resources_hooks.inc.php index 4775d1d1a6..e1590f5b42 100644 --- a/resources/inc/class.resources_hooks.inc.php +++ b/resources/inc/class.resources_hooks.inc.php @@ -62,6 +62,7 @@ class resources_hooks if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') { $file = Array( + 'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 'Global Categories' => egw::link('/index.php',array( 'menuaction' => 'admin.admin_categories.index', 'appname' => $appname, diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index aaaadffa7c..b8abe372cf 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -128,6 +128,12 @@ class resources_ui $content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(EGW_ACL_READ); $content['nm']['options-filter2'] = resources_bo::$filter_options; + $config = config::read('resources'); + if($config['history']) + { + $content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted'); + } + if($_GET['search']) { $content['nm']['search'] = $_GET['search']; } @@ -268,6 +274,12 @@ class resources_ui 'nm_action' => 'open_popup', 'hideOnDisabled' => true ), + 'restore' => array( + 'caption' => 'Un-delete', + 'enableClass' => 'deleted', + 'hideOnDisabled' => true, + 'group' => $group, + ) ); return $actions; } @@ -337,6 +349,15 @@ class resources_ui egw_framework::set_onload("egw_openWindowCentered2('".egw::link('/index.php',$url_params) ."','_blank');"); $action_msg = lang('booked'); break; + case 'restore': + $action_msg = lang('restored'); + foreach($checked as $n=>$id) + { + $resource = $this->bo->read($id); + $resource['deleted'] = null; + $this->bo->save($resource); + } + break; case 'delete': $action_msg = lang('deleted'); $promoted_accessories = 0; @@ -491,6 +512,15 @@ class resources_ui $content['useable'] = $content['useable'] ? $content['useable'] : 1; $content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of; + $content['history'] = array( + 'id' => $res_id, + 'app' => 'resources', + 'status-widgets' => array( + 'accessory_of' => 'link-entry:resources' + ) + ); + $sel_options['status'] = resources_bo::$field2label; + $sel_options['gen_src_list'] = $this->bo->get_genpicturelist(); $sel_options['cat_id'] = $this->bo->acl->get_cats(EGW_ACL_ADD); $sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : @@ -511,7 +541,9 @@ class resources_ui { $read_only['__ALL__'] = true; } - if(!$this->bo->acl->is_permitted($content['cat_id'],EGW_ACL_DELETE)) + $config = config::read('resources'); + if(!$this->bo->acl->is_permitted($content['cat_id'],EGW_ACL_DELETE) || + ($content['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history')) { $read_only['delete'] = true; } diff --git a/resources/inc/class.resources_wizard_export_csv.inc.php b/resources/inc/class.resources_wizard_export_csv.inc.php index 91c8293fd0..6fe2d4c6c2 100644 --- a/resources/inc/class.resources_wizard_export_csv.inc.php +++ b/resources/inc/class.resources_wizard_export_csv.inc.php @@ -16,22 +16,7 @@ class resources_wizard_export_csv extends importexport_wizard_basic_export_csv parent::__construct(); // Field mapping - $this->export_fields = array( - 'res_id' => lang('Resource ID'), - 'name' => lang('name'), - 'short_description' => lang('short description'), - 'cat_id' => lang('Category'), - 'quantity' => lang('Quantity'), - 'useable' => lang('Useable'), - 'location' => lang('Location'), - 'storage_info' => lang('Storage'), - 'bookable' => lang('Bookable'), - 'buyable' => lang('Buyable'), - 'prize' => lang('Prize'), - 'long_description' => lang('Long description'), - 'inventory_number' => lang('inventory number'), - 'accessory_of' => lang('Accessory of') - ); + $this->export_fields = resources_bo::$field2label; // Custom fields $custom = config::get_customfields('resources', true); diff --git a/resources/setup/etemplates.inc.php b/resources/setup/etemplates.inc.php index de4c80bb0f..06ca2cf2cb 100644 --- a/resources/setup/etemplates.inc.php +++ b/resources/setup/etemplates.inc.php @@ -2,7 +2,7 @@ /** * EGroupware - eTemplates for Application resources * http://www.egroupware.org - * generated by soetemplate::dump4setup() 2012-12-06 10:07 + * generated by soetemplate::dump4setup() 2012-12-17 13:08 * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package resources @@ -36,7 +36,7 @@ $templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang' $templ_data[] = array('name' => 'resources.edit_pictures','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:2:"c1";s:3:"nmr";s:2:"c2";s:3:"nmr";s:2:"c3";s:3:"nmr";}i:1;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:26:"Use general resources icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"gen_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"gen_src_list";}}i:2;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:23:"Use the category\'s icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"cat_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:15:"Use own picture";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"own_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:2:{s:4:"type";s:4:"file";s:4:"name";s:8:"own_file";}}}s:4:"rows";i:3;s:4:"cols";i:3;}}','size' => '','style' => '','modified' => '1108638846',); -$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:7:"row_off";s:1:"A";s:3:"700";s:2:"h2";s:4:"100%";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:40:"General|Description|Picture|Links|Custom";s:4:"name";s:39:"tabs=general|page|pictures|links|custom";s:4:"help";s:164:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:4:"size";s:4:",380";s:7:"options";a:1:{i:1;s:3:"380";}}}','size' => ',380','style' => '','modified' => '1116664222',); +$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:7:"row_off";s:1:"A";s:3:"700";s:2:"h2";s:4:"100%";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:48:"General|Description|Picture|Links|Custom|History";s:4:"name";s:47:"tabs=general|page|pictures|links|custom|history";s:4:"help";s:164:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:4:"size";s:4:",380";s:7:"options";a:1:{i:1;s:3:"380";}}}','size' => ',380','style' => '','modified' => '1116664222',); $templ_data[] = array('name' => 'resources.edit_tabs.accessories','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:9:"nextmatch";s:4:"name";s:2:"nm";s:4:"size";s:19:"resources.show.rows";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1109668181',); @@ -44,6 +44,8 @@ $templ_data[] = array('name' => 'resources.edit_tabs.custom','template' => '','l $templ_data[] = array('name' => 'resources.edit_tabs.general','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:10:{i:0;a:2:{s:1:"C";s:2:"10";s:2:"h9";s:4:"100%";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:19:"Description (short)";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"50,100";s:4:"name";s:17:"short_description";s:4:"help";s:29:"Short description of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:29:"Short description of resource";}}i:2;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Location";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"50,100";s:4:"name";s:8:"location";s:4:"help";s:20:"Location of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:28:"Where to find this resource?";}}i:3;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:19:"Storage information";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"50,100";s:4:"name";s:12:"storage_info";s:4:"help";s:25:"Information about storage";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:25:"Information about storage";}}i:4;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Quantity";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:"5,10";s:4:"name";s:8:"quantity";s:4:"help";s:20:"Quantity of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"Quantity of resource";}}i:5;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Useable";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:"5,10";s:4:"name";s:7:"useable";s:4:"help";s:29:"How many of them are useable?";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:38:"How many of the resources are useable?";}}i:6;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Bookable";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:8:"bookable";s:4:"help";s:21:"Is resource bookable?";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:26:"Is this resource bookable?";}}i:7;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Accessory of";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"accessory_of";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:8;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:7:"Buyable";s:8:"disabled";s:1:"1";}s:1:"B";a:4:{s:4:"type";s:8:"checkbox";s:4:"name";s:7:"buyable";s:4:"help";s:20:"Is resource buyable?";s:8:"disabled";s:1:"1";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:3:{s:4:"type";s:5:"label";s:5:"label";s:25:"Is this resource buyable?";s:8:"disabled";s:1:"1";}}i:9;a:4:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:9;s:4:"cols";i:4;s:4:"size";s:7:"700,380";s:7:"options";a:2:{i:0;s:3:"700";i:1;s:3:"380";}}}','size' => '700,380','style' => '','modified' => '1093597682',); +$templ_data[] = array('name' => 'resources.edit_tabs.history','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:"type";s:10:"historylog";s:4:"data";a:2:{i:0;a:1:{s:1:"A";s:4:"100%";}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:10:"historylog";s:4:"name";s:7:"history";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"name";s:7:"history";}}','size' => '','style' => '','modified' => '1355774114',); + $templ_data[] = array('name' => 'resources.edit_tabs.links','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:7:{s:1:"A";s:3:"100";s:2:"c1";s:2:"th";s:2:"c2";s:3:"row";s:2:"c3";s:2:"th";s:2:"c4";s:11:"row_off,top";s:2:"h4";s:3:"164";s:2:"h5";s:4:"100%";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";s:5:"label";s:16:"Create new links";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:3:{s:4:"type";s:7:"link-to";s:4:"span";s:3:"all";s:4:"name";s:7:"link_to";}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:"span";s:3:"all";s:5:"label";s:14:"Existing links";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:3:{s:4:"type";s:9:"link-list";s:4:"span";s:3:"all";s:4:"name";s:7:"link_to";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:2;s:4:"size";s:7:"700,380";s:7:"options";a:2:{i:0;s:3:"700";i:1;s:3:"380";}}}','size' => '700,380','style' => '','modified' => '1109248913',); $templ_data[] = array('name' => 'resources.edit_tabs.page','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:2:"c1";s:4:",top";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"htmlarea";s:4:"name";s:16:"long_description";s:4:"help";s:26:"Web-Site for this resource";s:4:"size";s:17:",350px,700px,true";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:8:"100%,380";s:7:"options";a:2:{i:0;s:4:"100%";i:1;s:3:"380";}}}','size' => '100%,380','style' => '','modified' => '1093599237',); diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php index 049042e37c..0c7a6c1326 100755 --- a/resources/setup/setup.inc.php +++ b/resources/setup/setup.inc.php @@ -13,7 +13,7 @@ $setup_info['resources']['name'] = 'resources'; $setup_info['resources']['title'] = 'Resources'; -$setup_info['resources']['version'] = '1.9.001'; +$setup_info['resources']['version'] = '1.9.002'; $setup_info['resources']['app_order'] = 5; $setup_info['resources']['tables'] = array('egw_resources','egw_resources_extra'); $setup_info['resources']['enable'] = 1; @@ -45,3 +45,4 @@ $setup_info['resources']['depends'][] = array( // cause eTemplates is not in the 'appname' => 'etemplate', 'versions' => Array('1.7','1.8','1.9') ); + diff --git a/resources/setup/tables_current.inc.php b/resources/setup/tables_current.inc.php index 81e1deefaa..c4b10e703f 100755 --- a/resources/setup/tables_current.inc.php +++ b/resources/setup/tables_current.inc.php @@ -14,7 +14,7 @@ $phpgw_baseline = array( 'egw_resources' => array( 'fd' => array( - 'res_id' => array('type' => 'auto'), + 'res_id' => array('type' => 'auto','nullable' => False), 'name' => array('type' => 'varchar','precision' => '100'), 'short_description' => array('type' => 'varchar','precision' => '100'), 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), @@ -28,7 +28,8 @@ $phpgw_baseline = array( 'picture_src' => array('type' => 'varchar','precision' => '20'), 'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'), 'storage_info' => array('type' => 'varchar','precision' => '200'), - 'inventory_number' => array('type' => 'varchar','precision' => '20') + 'inventory_number' => array('type' => 'varchar','precision' => '20'), + 'deleted' => array('type' => 'int','precision' => '8') ), 'pk' => array('res_id'), 'fk' => array(), diff --git a/resources/setup/tables_update.inc.php b/resources/setup/tables_update.inc.php index def1e89040..fa4e1deadc 100755 --- a/resources/setup/tables_update.inc.php +++ b/resources/setup/tables_update.inc.php @@ -335,3 +335,14 @@ function resources_upgrade1_8() return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001'; } + +function resources_upgrade1_9_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','deleted',array( + 'type' => 'int', + 'precision' => '8' + )); + + return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.002'; +} + diff --git a/resources/templates/default/edit.xet b/resources/templates/default/edit.xet index 50e33ec966..eef4071ed0 100644 --- a/resources/templates/default/edit.xet +++ b/resources/templates/default/edit.xet @@ -171,6 +171,9 @@ +