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
0051ca5e
Commit
0051ca5e
authored
Jan 23, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix changing of work period on new timesheets.
parent
cb055bf6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
32 deletions
+40
-32
do_timesheet_aed.php
do_timesheet_aed.php
+2
-2
timesheet.class.php
timesheet.class.php
+38
-30
No files found.
do_timesheet_aed.php
View file @
0051ca5e
...
...
@@ -60,7 +60,7 @@ if ($del) {
}
}
else
if
(
$workperiod
)
{
if
(
!
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
$AppUI
->
setMsg
(
"Timesheet
work
period failed"
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
"Timesheet period failed"
,
UI_MSG_ERROR
);
}
else
{
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$msg
=
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
;
...
...
@@ -70,7 +70,7 @@ if ($del) {
if
(
!
$obj
->
store
())
{
$AppUI
->
setMsg
(
"Timesheet saving failed"
,
UI_MSG_ERROR
);
}
else
{
$isNotNew
=
$obj
->
timesheet_id
;
//_POST['timesheet_id'];
$isNotNew
=
$obj
->
timesheet_id
;
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
}
}
...
...
timesheet.class.php
View file @
0051ca5e
...
...
@@ -95,11 +95,11 @@ class CTimesheet extends w2p_Core_BaseObject {
return
true
;
}
protected
function
project_store
()
protected
function
project_store
(
$workperiod
)
{
// Get the current timesheet period
$period
=
new
w2p_Utilities
Date
(
$_POST
[
'timesheet_period'
]
);
$period
->
setDate
(
$_POST
[
'timesheet_period'
]
,
DATE_FORMAT_UNIXTIME
);
$period
=
new
w2p_Utilities
_Date
(
);
$period
->
setDate
(
$workperiod
,
DATE_FORMAT_UNIXTIME
);
$q
=
$this
->
_getQuery
();
$q
->
addQuery
(
'project_id'
);
...
...
@@ -217,40 +217,48 @@ class CTimesheet extends w2p_Core_BaseObject {
public
function
change_status
()
{
$this
->
clearErrors
();
if
(
$this
->
canEdit
())
{
$this
->
_action
=
'updated'
;
$q
=
$this
->
_getQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_status'
,
$this
->
timesheet_status
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'change-status-timesheet'
]
=
db_error
();
if
(
!
$this
->
canEdit
())
return
false
;
if
(
$timesheet_id
==
0
)
{
if
(
!
$this
->
canCreate
())
return
false
;
}
return
true
;
$this
->
init
();
}
return
false
;
$q
=
$this
->
_getQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_status'
,
$this
->
timesheet_status
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'change-status-timesheet'
]
=
db_error
();
return
false
;
}
return
true
;
}
public
function
change_period
(
$period
)
{
$result
=
false
;
$this
->
clearErrors
();
if
(
$this
->
canEdit
())
{
$this
->
_action
=
'updated'
;
$q
=
$this
->
_getQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_period'
,
$period
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'change-period-timesheet'
]
=
db_error
();
return
$result
;
}
$result
=
true
;
$purge_result
=
$this
->
project_purge
();
$store_result
=
$this
->
project_store
();
$result
=
$result
&&
$purge_result
&&
$store_result
;
//if (!$this->canEdit())
// return false;
if
(
$timesheet_id
==
0
)
{
if
(
!
$this
->
canCreate
())
return
false
;
$this
->
init
();
}
$q
=
$this
->
_getQuery
();
$q
->
addTable
(
'timesheet'
);
$q
->
addUpdate
(
'timesheet_period'
,
$period
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'change-period-timesheet'
]
=
db_error
();
return
false
;
}
return
$result
;
$purge_result
=
$this
->
project_purge
();
$store_result
=
$this
->
project_store
(
$period
);
$timesheet_period
=
$period
;
return
$purge_result
&&
$store_result
;
}
public
function
get_config
()
{
...
...
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