Don't add 'Deleted' status to status list, just add it where needed and use an Undelete button

This commit is contained in:
Nathan Gray 2012-10-22 18:31:11 +00:00
parent 13844bbf17
commit 014c720546
4 changed files with 20 additions and 10 deletions

View File

@ -220,10 +220,6 @@ class timesheet_bo extends so_sql_cf
//$sorted[$status_id]['name'] = $label; //$sorted[$status_id]['name'] = $label;
unset($sorted[$status_id]['substatus']); unset($sorted[$status_id]['substatus']);
} }
if($this->config_data['history'])
{
$this->status_labels[self::DELETED_STATUS] = 'Deleted';
}
$this->status_labels_config = $sorted; $this->status_labels_config = $sorted;
} }

View File

@ -157,6 +157,10 @@ class timesheet_ui extends timesheet_bo
if ($this->check_acl(EGW_ACL_EDIT) && !$only_admin_edit) $view = false; if ($this->check_acl(EGW_ACL_EDIT) && !$only_admin_edit) $view = false;
break; break;
case 'undelete':
if($content['ts_status'] == self::DELETED_STATUS) unset($content['ts_status']);
$button = 'apply';
// fall through
case 'save': case 'save':
case 'save_new': case 'save_new':
case 'apply': case 'apply':
@ -375,18 +379,23 @@ class timesheet_ui extends timesheet_bo
'id' => $this->data['ts_id'], 'id' => $this->data['ts_id'],
'app' => 'timesheet', 'app' => 'timesheet',
'status-widgets' => array( 'status-widgets' => array(
'ts_status' => $this->status_labels, 'ts_status' => $this->status_labels + array(self::DELETED_STATUS => 'Deleted'),
'ts_modifier' => 'select-account', 'ts_modifier' => 'select-account',
'cat_id' => 'select-cat', 'cat_id' => 'select-cat',
), ),
); );
$sel_options['status'] = $this->field2label; $sel_options['status'] = $this->field2label;
if($this->config_data['history'])
{
$sel_options['status'][self::DELETED_STATUS] = 'Deleted';
}
// the actual title-blur is either the preserved title blur (if we are called from infolog entry), // the actual title-blur is either the preserved title blur (if we are called from infolog entry),
// or the preserved project-blur comming from the current selected project // or the preserved project-blur comming from the current selected project
$content['ts_title_blur'] = $preserv['ts_title_blur'] ? $preserv['ts_title_blur'] : $preserv['ts_project_blur']; $content['ts_title_blur'] = $preserv['ts_title_blur'] ? $preserv['ts_title_blur'] : $preserv['ts_project_blur'];
$readonlys = array( $readonlys = array(
'button[delete]' => !$this->data['ts_id'] || !$this->check_acl(EGW_ACL_DELETE), 'button[delete]' => !$this->data['ts_id'] || !$this->check_acl(EGW_ACL_DELETE) || $this->data['ts_status'] == self::DELETED_STATUS,
'button[undelete]' => $this->data['ts_status'] != self::DELETED_STATUS,
'button[edit]' => !$view || !$this->check_acl(EGW_ACL_EDIT), 'button[edit]' => !$view || !$this->check_acl(EGW_ACL_EDIT),
'button[save]' => $view, 'button[save]' => $view,
'button[save_new]' => $view, 'button[save_new]' => $view,
@ -870,6 +879,10 @@ class timesheet_ui extends timesheet_bo
'cat_id' => array(lang('None')), 'cat_id' => array(lang('None')),
'ts_status' => $this->status_labels+array(lang('No status')), 'ts_status' => $this->status_labels+array(lang('No status')),
); );
if($this->config_data['history'])
{
$sel_options['ts_status'][self::DELETED_STATUS] = 'Deleted';
}
$content['nm']['no_status'] = count($sel_options['ts_status']) <= 1; // 1 because of 'No status' $content['nm']['no_status'] = count($sel_options['ts_status']) <= 1; // 1 because of 'No status'
if ($this->pm_integration != 'full') if ($this->pm_integration != 'full')

View File

@ -2,7 +2,7 @@
/** /**
* EGroupware - eTemplates for Application timesheet * EGroupware - eTemplates for Application timesheet
* http://www.egroupware.org * http://www.egroupware.org
* generated by soetemplate::dump4setup() 2011-08-15 11:13 * generated by soetemplate::dump4setup() 2012-10-22 11:54
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package timesheet * @package timesheet
@ -21,9 +21,9 @@ $templ_data[] = array('name' => 'timesheet.customstatus','template' => '','lang'
$templ_data[] = array('name' => 'timesheet.customstatus.cats','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:3:{s:1:"D";s:3:"30%";s:2:"c1";s:7:"row,top";s:1:"A";s:3:"100";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Status";}s:1:"B";a:8:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,280,,,,,auto";s:4:"span";s:3:"all";s:4:"name";s:6:"statis";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:1:"B";s:2:"5%";s:2:"c2";s:3:"row";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:2;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"80,150";s:4:"blur";s:18:"--> enter new name";s:4:"name";s:12:"${row}[name]";}s:1:"B";a:7:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:5:"align";s:6:"center";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"help";s:18:"Delete this status";s:7:"onclick";s:37:"return confirm(\'Delete this status\');";}}}s:4:"rows";i:2;s:4:"cols";i:2;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"280";i:6;s:4:"auto";}}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:1;s:4:"cols";i:4;s:4:"size";s:17:"100%,300,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"300";i:6;s:4:"auto";}}}','size' => '100%,300,,,,,auto','style' => '','modified' => '1236867741',); $templ_data[] = array('name' => 'timesheet.customstatus.cats','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:3:{s:1:"D";s:3:"30%";s:2:"c1";s:7:"row,top";s:1:"A";s:3:"100";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Status";}s:1:"B";a:8:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,280,,,,,auto";s:4:"span";s:3:"all";s:4:"name";s:6:"statis";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:1:"B";s:2:"5%";s:2:"c2";s:3:"row";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:2;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"80,150";s:4:"blur";s:18:"--> enter new name";s:4:"name";s:12:"${row}[name]";}s:1:"B";a:7:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:5:"align";s:6:"center";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"help";s:18:"Delete this status";s:7:"onclick";s:37:"return confirm(\'Delete this status\');";}}}s:4:"rows";i:2;s:4:"cols";i:2;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"280";i:6;s:4:"auto";}}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:1;s:4:"cols";i:4;s:4:"size";s:17:"100%,300,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"300";i:6;s:4:"auto";}}}','size' => '100%,300,,,,,auto','style' => '','modified' => '1236867741',);
$templ_data[] = array('name' => 'timesheet.edit','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:8:{i:0;a:8:{s:1:"A";s:3:"100";s:2:"h1";s:6:",!@msg";s:2:"c2";s:2:"th";s:2:"h2";s:2:"28";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";s:2:"h4";s:13:",@ts_viewtype";s:2:"h6";s:14:",!@ts_modified";}i:1;a:2:{s:1:"A";a:5:{s:4:"span";s:13:"all,redItalic";s:7:"no_lang";s:1:"1";s:5:"align";s:6:"center";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:3:{s:4:"size";s:11:",,,ts_owner";s:4:"type";s:5:"label";s:5:"label";s:4:"User";}s:1:"B";a:4:{s:4:"span";s:3:"all";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"ts_owner";s:4:"type";s:6:"select";}}i:3;a:2:{s:1:"A";a:3:{s:4:"size";s:13:",,,ts_project";s:4:"type";s:5:"label";s:5:"label";s:7:"Project";}s:1:"B";a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"h1";s:21:",@pm_integration=none";s:2:"h2";s:21:",@pm_integration=full";}i:1;a:1:{s:1:"A";a:6:{s:4:"span";s:13:"all,fullWidth";s:8:"onchange";s:1:"1";s:4:"name";s:5:"pm_id";s:4:"size";s:4:"None";s:4:"type";s:21:"projectmanager-select";s:4:"help";s:16:"Select a project";}}i:2;a:1:{s:1:"A";a:5:{s:4:"blur";s:16:"@ts_project_blur";s:4:"size";s:5:"65,80";s:4:"name";s:10:"ts_project";s:4:"type";s:4:"text";s:4:"span";s:10:",fullWidth";}}}s:4:"cols";i:1;s:4:"rows";i:2;s:4:"size";s:7:",,,,1,1";}}i:4;a:2:{s:1:"A";a:3:{s:4:"size";s:15:",,,ts_unitprice";s:4:"type";s:5:"label";s:5:"label";s:9:"Unitprice";}s:1:"B";a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:1:"A";s:21:",@pm_integration=none";}i:1;a:2:{s:1:"A";a:4:{s:8:"onchange";s:209:"this.form[\'exec[ts_unitprice]\'].value=this.options[this.selectedIndex].text.lastIndexOf(\'(\') < 0 ? \'\' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf(\'(\')+1,-1);";s:4:"name";s:5:"pl_id";s:4:"size";s:4:"None";s:4:"type";s:24:"projectmanager-pricelist";}s:1:"B";a:4:{s:4:"type";s:5:"float";s:4:"span";s:3:"all";s:4:"name";s:12:"ts_unitprice";s:4:"size";s:1:",";}}}s:4:"cols";i:2;s:4:"rows";i:1;}}i:5;a:2:{s:1:"A";a:5:{s:4:"span";s:3:"all";s:4:"name";s:45:"tabs=general|notes|links|customfields|history";s:4:"type";s:3:"tab";s:5:"label";s:41:"General|Notes|Links|Custom Fields|History";s:4:"help";s:4:"||||";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:13:"Last modified";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:11:"ts_modified";s:4:"type";s:9:"date-time";}i:2;a:4:{s:4:"type";s:14:"select-account";s:5:"label";s:2:"by";s:8:"readonly";s:4:"true";s:4:"name";s:11:"ts_modifier";}}}i:7;a:2:{s:1:"A";a:6:{s:4:"span";s:1:"2";s:6:"orient";s:1:"0";s:4:"size";s:1:"2";s:4:"type";s:4:"hbox";i:1;a:8:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"6";i:1;a:4:{s:5:"label";s:4:"Edit";s:4:"name";s:12:"button[edit]";s:4:"type";s:6:"button";s:4:"help";s:15:"Edit this entry";}i:2;a:4:{s:5:"label";s:10:"Save & New";s:4:"name";s:16:"button[save_new]";s:4:"type";s:6:"button";s:4:"help";s:34:"Saves this entry and add a new one";}i:3;a:4:{s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"type";s:6:"button";s:4:"help";s:22:"Saves the changes made";}i:4;a:4:{s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"type";s:6:"button";s:4:"help";s:24:"Applies the changes made";}i:5;a:5:{s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";s:4:"name";s:14:"button[cancel]";s:4:"type";s:6:"button";s:4:"help";s:44:"closes the window without saving the changes";}i:6;a:2:{s:4:"name";s:2:"js";s:4:"type";s:4:"html";}}i:2;a:6:{s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:7:"onclick";s:36:"return confirm(\'Delete this entry\');";s:4:"name";s:14:"button[delete]";s:4:"type";s:6:"button";s:4:"help";s:17:"Delete this entry";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"cols";i:2;s:4:"rows";i:7;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.fullWidth select { widht: 100%; } $templ_data[] = array('name' => 'timesheet.edit','template' => '','lang' => '','group' => '0','version' => '1.9.002','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:8:{i:0;a:8:{s:1:"A";s:3:"100";s:2:"h1";s:6:",!@msg";s:2:"c2";s:2:"th";s:2:"h2";s:2:"28";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";s:2:"h4";s:13:",@ts_viewtype";s:2:"h6";s:14:",!@ts_modified";}i:1;a:2:{s:1:"A";a:5:{s:4:"span";s:13:"all,redItalic";s:7:"no_lang";s:1:"1";s:5:"align";s:6:"center";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:3:{s:4:"size";s:11:",,,ts_owner";s:4:"type";s:5:"label";s:5:"label";s:4:"User";}s:1:"B";a:4:{s:4:"span";s:3:"all";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"ts_owner";s:4:"type";s:6:"select";}}i:3;a:2:{s:1:"A";a:3:{s:4:"size";s:13:",,,ts_project";s:4:"type";s:5:"label";s:5:"label";s:7:"Project";}s:1:"B";a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"h1";s:21:",@pm_integration=none";s:2:"h2";s:21:",@pm_integration=full";}i:1;a:1:{s:1:"A";a:6:{s:4:"span";s:13:"all,fullWidth";s:8:"onchange";s:1:"1";s:4:"name";s:5:"pm_id";s:4:"size";s:4:"None";s:4:"type";s:21:"projectmanager-select";s:4:"help";s:16:"Select a project";}}i:2;a:1:{s:1:"A";a:5:{s:4:"blur";s:16:"@ts_project_blur";s:4:"size";s:5:"65,80";s:4:"name";s:10:"ts_project";s:4:"type";s:4:"text";s:4:"span";s:10:",fullWidth";}}}s:4:"cols";i:1;s:4:"rows";i:2;s:4:"size";s:7:",,,,1,1";}}i:4;a:2:{s:1:"A";a:3:{s:4:"size";s:15:",,,ts_unitprice";s:4:"type";s:5:"label";s:5:"label";s:9:"Unitprice";}s:1:"B";a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:1:"A";s:21:",@pm_integration=none";}i:1;a:2:{s:1:"A";a:4:{s:8:"onchange";s:209:"this.form[\'exec[ts_unitprice]\'].value=this.options[this.selectedIndex].text.lastIndexOf(\'(\') < 0 ? \'\' : this.options[this.selectedIndex].text.slice(this.options[this.selectedIndex].text.lastIndexOf(\'(\')+1,-1);";s:4:"name";s:5:"pl_id";s:4:"size";s:4:"None";s:4:"type";s:24:"projectmanager-pricelist";}s:1:"B";a:4:{s:4:"type";s:5:"float";s:4:"span";s:3:"all";s:4:"name";s:12:"ts_unitprice";s:4:"size";s:1:",";}}}s:4:"cols";i:2;s:4:"rows";i:1;}}i:5;a:2:{s:1:"A";a:5:{s:4:"span";s:3:"all";s:4:"name";s:45:"tabs=general|notes|links|customfields|history";s:4:"type";s:3:"tab";s:5:"label";s:41:"General|Notes|Links|Custom Fields|History";s:4:"help";s:4:"||||";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:6;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:13:"Last modified";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:11:"ts_modified";s:4:"type";s:9:"date-time";}i:2;a:4:{s:4:"type";s:14:"select-account";s:5:"label";s:2:"by";s:8:"readonly";s:4:"true";s:4:"name";s:11:"ts_modifier";}}}i:7;a:2:{s:1:"A";a:7:{s:4:"span";s:1:"2";s:6:"orient";s:1:"0";s:4:"size";s:1:"3";s:4:"type";s:4:"hbox";i:1;a:8:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"6";i:1;a:4:{s:5:"label";s:4:"Edit";s:4:"name";s:12:"button[edit]";s:4:"type";s:6:"button";s:4:"help";s:15:"Edit this entry";}i:2;a:4:{s:5:"label";s:10:"Save & New";s:4:"name";s:16:"button[save_new]";s:4:"type";s:6:"button";s:4:"help";s:34:"Saves this entry and add a new one";}i:3;a:4:{s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"type";s:6:"button";s:4:"help";s:22:"Saves the changes made";}i:4;a:4:{s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"type";s:6:"button";s:4:"help";s:24:"Applies the changes made";}i:5;a:5:{s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";s:4:"name";s:14:"button[cancel]";s:4:"type";s:6:"button";s:4:"help";s:44:"closes the window without saving the changes";}i:6;a:2:{s:4:"name";s:2:"js";s:4:"type";s:4:"html";}}i:2;a:6:{s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:7:"onclick";s:36:"return confirm(\'Delete this entry\');";s:4:"name";s:14:"button[delete]";s:4:"type";s:6:"button";s:4:"help";s:17:"Delete this entry";}i:3;a:5:{s:5:"label";s:8:"Undelete";s:5:"align";s:5:"right";s:4:"name";s:16:"button[undelete]";s:4:"type";s:6:"button";s:4:"help";s:18:"Restore this entry";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"cols";i:2;s:4:"rows";i:7;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.fullWidth select { widht: 100%; }
.fullWidth input { widht: 100%; } .fullWidth input { widht: 100%; }
.fullWidth textarea { widht: 100%; }','modified' => '1311158552',); .fullWidth textarea { widht: 100%; }','modified' => '1350928309',);
$templ_data[] = array('name' => 'timesheet.edit.customfields','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:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:12:"customfields";}}}s:4:"cols";i:1;s:4:"rows";i:1;s:4:"size";s:17:"100%,165,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"165";i:6;s:4:"auto";}}}','size' => '100%,165,,,,,auto','style' => '','modified' => '1303228015',); $templ_data[] = array('name' => 'timesheet.edit.customfields','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:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:12:"customfields";}}}s:4:"cols";i:1;s:4:"rows";i:1;s:4:"size";s:17:"100%,165,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"165";i:6;s:4:"auto";}}}','size' => '100%,165,,,,,auto','style' => '','modified' => '1303228015',);

View File

@ -111,7 +111,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="timesheet.edit" template="" lang="" group="0" version="1.9.001"> <template id="timesheet.edit" template="" lang="" group="0" version="1.9.002">
<grid width="100%"> <grid width="100%">
<columns> <columns>
<column width="100"/> <column width="100"/>
@ -197,6 +197,7 @@
<html id="js"/> <html id="js"/>
</hbox> </hbox>
<button align="right" statustext="Delete this entry" label="Delete" id="button[delete]" onclick="return confirm('Delete this entry');"/> <button align="right" statustext="Delete this entry" label="Delete" id="button[delete]" onclick="return confirm('Delete this entry');"/>
<button align="right" statustext="Restore this entry" label="Undelete" id="button[undelete]"/>
</hbox> </hbox>
</row> </row>
</rows> </rows>