Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
timesheet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web2project
timesheet
Commits
aec085e4
Commit
aec085e4
authored
Jan 22, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addedit.php: read configuration values from the timesheet_config table
parent
3f6e6356
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
35 deletions
+37
-35
addedit.php
addedit.php
+37
-35
No files found.
addedit.php
View file @
aec085e4
<?php
/*
* Copyright (C) 2007-20
08, M2X
* Copyright (C) 2007-20
14, M2X BV
*
* Authors: Jean-Paul Saman
*
...
...
@@ -19,55 +19,56 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
$perms
=&
$AppUI
->
acl
();
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
// Create new timesheet or edit an existing one.
$timesheet_id
=
intval
(
dPgetParam
(
$_GET
,
"timesheet_id"
,
0
)
);
$timesheet_id
=
(
int
)
w2PgetParam
(
$_GET
,
"timesheet_id"
,
0
);
// Timesheet object
$timesheet
=
new
CTimesheet
();
$timesheet
->
timesheet_id
=
$timesheet_id
;
$obj
=
$timesheet
;
$canEdit
=
$obj
->
canEdit
();
$canDelete
=
$obj
->
canDelete
();
// check permissions for this record
$canEdit
=
!
getDenyEdit
(
$m
,
$timesheet_id
);
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
$AppUI
->
redirect
(
ACCESS_DENIED
);
}
$canDelete
=
$perms
->
checkModule
(
$m
,
'delete'
);
// Read in all configuration data
// $TIMESHEET_CONFIG = array();
$CONFIG_FILE
=
"./modules/timesheet/config.php"
;
require_once
(
$CONFIG_FILE
);
//Read the current config values from the config file and update the array.
$config_options
=
array
(
"approval_by"
=>
array
(
"value"
=>
''
),
"book_year"
=>
array
(
"value"
=>
''
),
"sort_order"
=>
array
(
"value"
=>
''
)
);
foreach
(
$config_options
as
$key
=>
$value
){
if
(
isset
(
$TIMESHEET_CONFIG
[
$key
])){
$config_options
[
$key
][
'value'
]
=
$TIMESHEET_CONFIG
[
$key
];
}
$obj
=
$AppUI
->
restoreObject
();
if
(
$obj
)
{
$timesheet
=
$obj
;
$timesheet_id
=
$timesheet
->
timesheet_id
;
}
else
{
$timesheet
->
load
(
null
,
$timesheet_id
);
}
// use the object oriented design of dP for loading the timesheet that should be edited
// therefore create a new instance of the Timesheet Class
$obj
=
new
CTimesheet
();
// load the record data in case of that this script is used to edit the timesheet qith timesheet_id (transmitted via GET)
if
(
!
$obj
->
load
(
$timesheet_id
,
false
)
&&
(
$timesheet_id
>
0
)
)
{
// show some error messages using the dPFramework if loadOperation failed
// these error messages are nicely integrated with the frontend of dP
// use detailed error messages as often as possible
$AppUI
->
setMsg
(
'Timesheet'
);
$AppUI
->
setMsg
(
"invalidID"
,
UI_MSG_ERROR
,
true
);
// load the record data in case of that this script is used to edit the timesheet(timesheet_id(
if
(
!
$timesheet
&&
$timesheet_id
>
0
)
{
$AppUI
->
setMsg
(
'Timesheet'
);
$AppUI
->
setMsg
(
'invalidID'
,
UI_MSG_ERROR
,
true
);
$AppUI
->
redirect
();
// go back to the calling location
}
// Read in all configuration data from timesheet_config
print
"configuration options loading"
;
$config_options
=
$obj
->
get_config
();
if
(
!
$config_options
)
{
$AppUI
->
setMsg
(
'no configuration options found'
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
print
"configuration options loaded"
;
// setup the title block
// Fill the title block either with 'Edit' or with 'New' depending on
// if timesheet_id has been transmitted via GET or is empty
$ttl
=
(
$timesheet_id
>
0
)
?
"Edit Timesheet"
:
"New Timesheet"
;
$titleBlock
=
new
CTitleBlock
(
$ttl
,
'timesheet.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
=
new
w2p_Theme_TitleBlock
(
$ttl
,
'timesheet.png'
,
$m
,
'$m'
.
'.'
.
'$a'
);
$titleBlock
->
addCrumb
(
"?m=timesheet"
,
"view all timesheets"
);
if
(
$canDelete
&&
(
$timesheet_id
>
0
)
)
{
$titleBlock
->
addCrumbDelete
(
'delete timesheet'
,
$canDelete
,
$msg
);
...
...
@@ -288,6 +289,7 @@ if (intval($obj->timesheet_worked)) {
// Get Project Status information.
$project_types
=
dPgetSysVal
(
"ProjectStatus"
);
// FIXME: Move this function to the Timesheet class
// Find all tasks in this timesheet period and account them to the project.
function
showproject
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment