Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
19ba90f5
Commit
19ba90f5
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix creation of leave request
parent
03b3f54c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/holiday/card.php
+10
-7
10 additions, 7 deletions
htdocs/holiday/card.php
htdocs/holiday/class/holiday.class.php
+3
-3
3 additions, 3 deletions
htdocs/holiday/class/holiday.class.php
with
13 additions
and
10 deletions
htdocs/holiday/card.php
+
10
−
7
View file @
19ba90f5
...
...
@@ -60,7 +60,7 @@ if ($action == 'create')
$object
=
new
Holiday
(
$db
);
// If no right to create a request
$fuserid
=
GETPOST
(
'fuserid'
);
$fuserid
=
GETPOST
(
'fuserid'
,
'int'
);
if
((
$fuserid
==
$user
->
id
&&
empty
(
$user
->
rights
->
holiday
->
write
))
||
(
$fuserid
!=
$user
->
id
&&
empty
(
$user
->
rights
->
holiday
->
write_all
)))
{
$error
++
;
...
...
@@ -118,7 +118,7 @@ if ($action == 'create')
}
// Check if there is already holiday for this period
$verifCP
=
$object
->
verifDateHolidayCP
(
$user
ID
,
$date_debut
,
$date_fin
,
$halfday
);
$verifCP
=
$object
->
verifDateHolidayCP
(
$
f
user
id
,
$date_debut
,
$date_fin
,
$halfday
);
if
(
!
$verifCP
)
{
setEventMessages
(
$langs
->
trans
(
"alreadyCPexist"
),
null
,
'errors'
);
...
...
@@ -144,11 +144,9 @@ if ($action == 'create')
$result
=
0
;
$result
=
0
;
if
(
!
$error
)
{
$object
->
fk_user
=
$userid
;
$object
->
fk_user
=
$
f
userid
;
$object
->
description
=
$description
;
$object
->
date_debut
=
$date_debut
;
$object
->
date_fin
=
$date_fin
;
...
...
@@ -157,10 +155,15 @@ if ($action == 'create')
$object
->
fk_type
=
$type
;
$result
=
$object
->
create
(
$user
);
if
(
$result
<=
0
)
{
setEventMessages
(
$object
->
error
,
$object
->
errors
,
'errors'
);
$error
++
;
}
}
// If no SQL error we redirect to the request card
if
(
!
$error
&&
$result
>
0
)
if
(
!
$error
)
{
$db
->
commit
();
...
...
@@ -834,7 +837,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print
$form
->
select_dolusers
(
$fuserid
,
'useridbis'
,
0
,
''
,
1
,
''
,
''
,
0
,
0
,
0
,
''
,
0
,
''
,
'maxwidth300'
);
print
'<input type="hidden" name="fuserid" value="'
.
(
$fuserid
?
$fuserid
:
$user
->
id
)
.
'">'
;
}
else
print
$form
->
select_dolusers
(
GETPOST
(
'fuserid'
)
?
GETPOST
(
'fuserid'
)
:
$user
->
id
,
'fuserid'
,
0
,
''
,
0
);
else
print
$form
->
select_dolusers
(
GETPOST
(
'fuserid'
,
'int'
)
?
GETPOST
(
'fuserid'
,
'int'
)
:
$user
->
id
,
'fuserid'
,
0
,
''
,
0
);
print
'</td>'
;
print
'</tr>'
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/holiday/class/holiday.class.php
+
3
−
3
View file @
19ba90f5
...
...
@@ -125,9 +125,9 @@ class Holiday extends CommonObject
$now
=
dol_now
();
// Check parameters
if
(
empty
(
$this
->
fk_user
)
||
!
is_numeric
(
$this
->
fk_user
)
||
$this
->
fk_user
<
0
)
{
$this
->
error
=
"ErrorBadParameter"
;
return
-
1
;
}
if
(
empty
(
$this
->
fk_validator
)
||
!
is_numeric
(
$this
->
fk_validator
)
||
$this
->
fk_validator
<
0
)
{
$this
->
error
=
"ErrorBadParameter"
;
return
-
1
;
}
if
(
empty
(
$this
->
fk_type
)
||
!
is_numeric
(
$this
->
fk_type
)
||
$this
->
fk_type
<
0
)
{
$this
->
error
=
"ErrorBadParameter"
;
return
-
1
;
}
if
(
empty
(
$this
->
fk_user
)
||
!
is_numeric
(
$this
->
fk_user
)
||
$this
->
fk_user
<
0
)
{
$this
->
error
=
"ErrorBadParameter
FkUser
"
;
return
-
1
;
}
if
(
empty
(
$this
->
fk_validator
)
||
!
is_numeric
(
$this
->
fk_validator
)
||
$this
->
fk_validator
<
0
)
{
$this
->
error
=
"ErrorBadParameter
FkValidator
"
;
return
-
1
;
}
if
(
empty
(
$this
->
fk_type
)
||
!
is_numeric
(
$this
->
fk_type
)
||
$this
->
fk_type
<
0
)
{
$this
->
error
=
"ErrorBadParameter
FkType
"
;
return
-
1
;
}
// Insert request
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"holiday("
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment