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
cb055bf6
Commit
cb055bf6
authored
Jan 23, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deleting of timesheet works
parent
a67eea8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
54 deletions
+44
-54
addedit.php
addedit.php
+2
-2
do_timesheet_aed.php
do_timesheet_aed.php
+22
-31
index.php
index.php
+1
-3
timesheet.class.php
timesheet.class.php
+19
-18
No files found.
addedit.php
View file @
cb055bf6
...
@@ -72,10 +72,10 @@ $titleBlock->show();
...
@@ -72,10 +72,10 @@ $titleBlock->show();
// some javaScript code to submit the form and set the delete object flag for the form processing
// some javaScript code to submit the form and set the delete object flag for the form processing
?>
?>
<script
language=
"javascript"
>
<script
language=
"javascript"
type=
"text/javascript"
>
function
delIt
(
id
)
{
function
delIt
(
id
)
{
if
(
confirm
(
"
<?php
echo
$AppUI
->
_
(
'Really delete this timesheet ?'
);
?>
"
))
{
if
(
confirm
(
"
<?php
echo
$AppUI
->
_
(
'Really delete this timesheet ?'
,
UI_OUPUT_JS
);
?>
"
))
{
var
f
=
document
.
editFrm
;
var
f
=
document
.
editFrm
;
f
.
del
.
value
=
'
1
'
;
f
.
del
.
value
=
'
1
'
;
f
.
submit
();
f
.
submit
();
...
...
do_timesheet_aed.php
View file @
cb055bf6
<?php
<?php
/*
/*
* Copyright (C) 2007-20
08, M2X
* Copyright (C) 2007-20
14, M2X BV
*
*
* Authors: Jean-Paul Saman
* Authors: Jean-Paul Saman
*
*
...
@@ -19,20 +19,22 @@
...
@@ -19,20 +19,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
// create a new instance of the timesheet class
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
$obj
=
new
CTimesheet
();
die
(
'You should not access this file directly.'
);
$msg
=
''
;
// reset the message string
}
$obj
=
new
CTimesheet
();
// bind the informations (variables) retrieved via post to the timesheet object
// bind the informations (variables) retrieved via post to the timesheet object
if
(
!
$obj
->
bind
(
$_POST
))
{
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
}
}
// detect if a dele
e
te operation has to be processed
// detect if a delete operation has to be processed
$workperiod
=
d
PgetParam
(
$_POST
,
'workperiod'
,
0
);
$workperiod
=
w2
PgetParam
(
$_POST
,
'workperiod'
,
0
);
$stat
=
d
PgetParam
(
$_POST
,
'stat'
,
0
);
$stat
=
w2
PgetParam
(
$_POST
,
'stat'
,
0
);
$del
=
d
PgetParam
(
$_POST
,
'del'
,
0
);
$del
=
w2
PgetParam
(
$_POST
,
'del'
,
0
);
$obj
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$obj
->
timesheet_id
=
$_POST
[
"timesheet_id"
];
$obj
->
timesheet_status
=
$_POST
[
"timesheet_status"
];
$obj
->
timesheet_status
=
$_POST
[
"timesheet_status"
];
...
@@ -42,46 +44,35 @@ $obj->timesheet_creator = $_POST["timesheet_creator"];
...
@@ -42,46 +44,35 @@ $obj->timesheet_creator = $_POST["timesheet_creator"];
$obj
->
timesheet_worked
=
$_POST
[
"timesheet_worked"
];
$obj
->
timesheet_worked
=
$_POST
[
"timesheet_worked"
];
$AppUI
->
setMsg
(
'Timesheet'
);
$AppUI
->
setMsg
(
'Timesheet'
);
$msg
=
"m=timesheet"
;
if
(
$del
)
{
if
(
$del
)
{
// check if there are dependencies on this object
if
(
!
$obj
->
delete
())
{
if
(
!
$obj
->
canDelete
(
$msg
))
{
$AppUI
->
setMsg
(
'Timesheet delete failed'
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
// see how easy it is to run database commands with the object oriented architecture !
// simply delete a quote from db and have detailed error or success report
if
(
$msg
=
$obj
->
delete
())
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet deleted"
,
UI_MSG_ALERT
);
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
}
else
if
(
$stat
)
{
}
else
if
(
$stat
)
{
if
(
$msg
=
$obj
->
change_status
())
{
if
(
!
$obj
->
change_status
())
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
"Timesheet changing status failed"
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet status updated"
,
UI_MSG_ALERT
);
$
AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
)
;
$
msg
=
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
;
}
}
}
else
if
(
$workperiod
)
{
}
else
if
(
$workperiod
)
{
if
(
$msg
=
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
if
(
!
$obj
->
change_period
(
$obj
->
timesheet_period
))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
"Timesheet workperiod failed"
,
UI_MSG_ERROR
);
$AppUI
->
redirect
();
}
else
{
}
else
{
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$AppUI
->
setMsg
(
"Timesheet period changed"
,
UI_MSG_ALERT
);
$
AppUI
->
redirect
(
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
)
;
$
msg
=
"m=timesheet&a=addedit×heet_id="
.
$obj
->
timesheet_id
;
}
}
}
else
{
}
else
{
// simply store the added/edited quote in database via the store method of the timesheet
// simply store the added/edited quote in database via the store method of the timesheet
// child class of the CDpObject provided ba the dPFramework
if
(
!
$obj
->
store
())
{
if
((
$msg
=
$obj
->
store
()))
{
$AppUI
->
setMsg
(
"Timesheet saving failed"
,
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
}
else
{
$isNotNew
=
$obj
->
timesheet_id
;
//_POST['timesheet_id'];
$isNotNew
=
$obj
->
timesheet_id
;
//_POST['timesheet_id'];
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
$AppUI
->
setMsg
(
$isNotNew
?
'Timesheet updated'
:
'Timesheet inserted'
,
UI_MSG_OK
);
}
}
$AppUI
->
redirect
(
"m=timesheet"
);
}
}
$AppUI
->
redirect
(
$msg
);
?>
?>
index.php
View file @
cb055bf6
...
@@ -23,9 +23,7 @@ if (!defined('W2P_BASE_DIR')) {
...
@@ -23,9 +23,7 @@ if (!defined('W2P_BASE_DIR')) {
die
(
'You should not access this file directly.'
);
die
(
'You should not access this file directly.'
);
}
}
global
$AppUI
;
$perms
=
&
$AppUI
->
acl
();
$perms
=
$AppUI
->
acl
();
if
(
!
$perms
->
checkModuleItem
(
'timesheet'
,
'access'
))
{
if
(
!
$perms
->
checkModuleItem
(
'timesheet'
,
'access'
))
{
$AppUI
->
redirect
(
ACCESS_DENIED
);
$AppUI
->
redirect
(
ACCESS_DENIED
);
}
}
...
...
timesheet.class.php
View file @
cb055bf6
...
@@ -56,7 +56,7 @@ class CTimesheet extends w2p_Core_BaseObject {
...
@@ -56,7 +56,7 @@ class CTimesheet extends w2p_Core_BaseObject {
}
}
public
function
loadFull
(
$notUsed
=
null
,
$timesheet_id
)
{
public
function
loadFull
(
$notUsed
=
null
,
$timesheet_id
)
{
// loadFull information for this timesheet
\
// loadFull information for this timesheet
}
}
public
function
load
(
$notUsed
=
null
,
$timesheet_id
)
{
public
function
load
(
$notUsed
=
null
,
$timesheet_id
)
{
...
@@ -194,24 +194,25 @@ class CTimesheet extends w2p_Core_BaseObject {
...
@@ -194,24 +194,25 @@ class CTimesheet extends w2p_Core_BaseObject {
// overload the delete method of the parent class for adaptation for timesheet's needs
// overload the delete method of the parent class for adaptation for timesheet's needs
public
function
delete
(
$unused
=
null
)
{
public
function
delete
(
$unused
=
null
)
{
$this
->
clearErrors
();
$this
->
clearErrors
();
if
(
$this
->
canDelete
())
{
// FIXME: this check does not work
$q
=
$this
->
_getQuery
();
//if (!$this->canDelete())
$q
->
setDelete
(
'timesheet_project'
);
// return false;
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$q
=
$this
->
_getQuery
();
$this
->
_error
[
'delete-timesheet-project'
]
=
db_error
();
$q
->
setDelete
(
'timesheet_project'
);
return
false
;
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
}
if
(
!
(
$q
->
exec
()))
{
$q
->
clear
();
$this
->
_error
[
'delete-timesheet-project'
]
=
db_error
();
$q
->
setDelete
(
'timesheet'
);
return
false
;
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'delete-timesheet'
]
=
db_error
();
return
false
;
}
return
true
;
}
}
return
false
;
$q
->
clear
();
$q
->
setDelete
(
'timesheet'
);
$q
->
addWhere
(
'timesheet_id = '
.
$this
->
timesheet_id
);
if
(
!
(
$q
->
exec
()))
{
$this
->
_error
[
'delete-timesheet'
]
=
db_error
();
return
false
;
}
return
true
;
}
}
public
function
change_status
()
{
public
function
change_status
()
{
...
...
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