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
Hide 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
<?php
/*
/*
* Copyright (C) 2007-20
08, M2X
* Copyright (C) 2007-20
14, M2X BV
*
*
* Authors: Jean-Paul Saman
* Authors: Jean-Paul Saman
*
*
...
@@ -19,55 +19,56 @@
...
@@ -19,55 +19,56 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* 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.
// 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
// check permissions for this record
$canEdit
=
!
getDenyEdit
(
$m
,
$timesheet_id
);
if
(
!
$canEdit
)
{
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
$AppUI
->
redirect
(
ACCESS_DENIED
);
}
}
$canDelete
=
$perms
->
checkModule
(
$m
,
'delete'
);
$obj
=
$AppUI
->
restoreObject
();
// Read in all configuration data
if
(
$obj
)
{
// $TIMESHEET_CONFIG = array();
$timesheet
=
$obj
;
$CONFIG_FILE
=
"./modules/timesheet/config.php"
;
$timesheet_id
=
$timesheet
->
timesheet_id
;
require_once
(
$CONFIG_FILE
);
}
else
{
//Read the current config values from the config file and update the array.
$timesheet
->
load
(
null
,
$timesheet_id
);
$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
];
}
}
}
// use the object oriented design of dP for loading the timesheet that should be edited
// load the record data in case of that this script is used to edit the timesheet(timesheet_id(
// therefore create a new instance of the Timesheet Class
if
(
!
$timesheet
&&
$timesheet_id
>
0
)
{
$obj
=
new
CTimesheet
();
$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 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
);
$AppUI
->
redirect
();
// go back to the calling location
$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
// setup the title block
// Fill the title block either with 'Edit' or with 'New' depending on
// Fill the title block either with 'Edit' or with 'New' depending on
// if timesheet_id has been transmitted via GET or is empty
// if timesheet_id has been transmitted via GET or is empty
$ttl
=
(
$timesheet_id
>
0
)
?
"Edit Timesheet"
:
"New Timesheet"
;
$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"
);
$titleBlock
->
addCrumb
(
"?m=timesheet"
,
"view all timesheets"
);
if
(
$canDelete
&&
(
$timesheet_id
>
0
)
)
{
if
(
$canDelete
&&
(
$timesheet_id
>
0
)
)
{
$titleBlock
->
addCrumbDelete
(
'delete timesheet'
,
$canDelete
,
$msg
);
$titleBlock
->
addCrumbDelete
(
'delete timesheet'
,
$canDelete
,
$msg
);
...
@@ -288,6 +289,7 @@ if (intval($obj->timesheet_worked)) {
...
@@ -288,6 +289,7 @@ if (intval($obj->timesheet_worked)) {
// Get Project Status information.
// Get Project Status information.
$project_types
=
dPgetSysVal
(
"ProjectStatus"
);
$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.
// Find all tasks in this timesheet period and account them to the project.
function
showproject
()
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