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
a4d5e022
Commit
a4d5e022
authored
9 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix pagination on limit failed when limit was forced on url
parent
8c1f2713
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/core/lib/functions.lib.php
+7
-5
7 additions, 5 deletions
htdocs/core/lib/functions.lib.php
htdocs/holiday/list.php
+9
-8
9 additions, 8 deletions
htdocs/holiday/list.php
with
16 additions
and
13 deletions
htdocs/core/lib/functions.lib.php
+
7
−
5
View file @
a4d5e022
...
...
@@ -2959,16 +2959,18 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param string $morehtml More html to show
* @param string $morecss More css to the table
* @param int $limit Limit ofnumber of lines on each page
* @return void
*/
function
print_barre_liste
(
$titre
,
$page
,
$file
,
$options
=
''
,
$sortfield
=
''
,
$sortorder
=
''
,
$center
=
''
,
$num
=-
1
,
$totalnboflines
=
0
,
$picto
=
'title_generic.png'
,
$pictoisfullpath
=
0
,
$morehtml
=
''
,
$morecss
=
''
)
function
print_barre_liste
(
$titre
,
$page
,
$file
,
$options
=
''
,
$sortfield
=
''
,
$sortorder
=
''
,
$center
=
''
,
$num
=-
1
,
$totalnboflines
=
0
,
$picto
=
'title_generic.png'
,
$pictoisfullpath
=
0
,
$morehtml
=
''
,
$morecss
=
''
,
$limit
=
0
)
{
global
$conf
,
$langs
;
if
(
$picto
==
'setup'
)
$picto
=
'title_setup.png'
;
if
((
$conf
->
browser
->
name
==
'ie'
)
&&
$picto
==
'title_generic.png'
)
$picto
=
'title.gif'
;
if
((
$num
>
$conf
->
liste_limit
)
||
(
$num
==
-
1
))
if
(
$limit
<
1
)
$limit
=
$conf
->
liste_limit
;
if
((
$num
>
$limit
)
||
(
$num
==
-
1
))
{
$nextpage
=
1
;
}
...
...
@@ -2997,13 +2999,13 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
if
(
$sortorder
)
$options
.
=
"&sortorder="
.
$sortorder
;
// Show navigation bar
$pagelist
=
''
;
if
(
$page
>
0
||
$num
>
$
conf
->
liste_
limit
)
if
(
$page
>
0
||
$num
>
$limit
)
{
if
(
$totalnboflines
)
// If we know total nb of lines
{
$maxnbofpage
=
(
empty
(
$conf
->
dol_optimize_smallscreen
)
?
6
:
3
);
// nb before and after selected page + ... + first or last
$nbpages
=
ceil
(
$totalnboflines
/
$
conf
->
liste_
limit
);
$nbpages
=
ceil
(
$totalnboflines
/
$limit
);
$cpt
=
(
$page
-
$maxnbofpage
);
if
(
$cpt
<
0
)
{
$cpt
=
0
;
}
...
...
This diff is collapsed.
Click to expand it.
htdocs/holiday/list.php
+
9
−
8
View file @
a4d5e022
...
...
@@ -39,6 +39,7 @@ $langs->load('holidays');
// Protection if external user
if
(
$user
->
societe_id
>
0
)
accessforbidden
();
$limit
=
GETPOST
(
'limit'
)
?
GETPOST
(
'limit'
,
'int'
)
:
$conf
->
liste_limit
;
$sortfield
=
GETPOST
(
"sortfield"
,
'alpha'
);
$sortorder
=
GETPOST
(
"sortorder"
,
'alpha'
);
$page
=
GETPOST
(
"page"
,
'int'
);
...
...
@@ -47,7 +48,7 @@ $page = $page == -1 ? 0 : $page;
if
(
!
$sortfield
)
$sortfield
=
"cp.rowid"
;
if
(
!
$sortorder
)
$sortorder
=
"DESC"
;
$offset
=
$
conf
->
liste_
limit
*
$page
;
$offset
=
$limit
*
$page
;
$pageprev
=
$page
-
1
;
$pagenext
=
$page
+
1
;
...
...
@@ -114,7 +115,7 @@ $filter='';
llxHeader
(
array
(),
$langs
->
trans
(
'CPTitreMenu'
));
$order
=
$db
->
order
(
$sortfield
,
$sortorder
)
.
$db
->
plimit
(
$
conf
->
liste_
limit
+
1
,
$offset
);
$order
=
$db
->
order
(
$sortfield
,
$sortorder
)
.
$db
->
plimit
(
$limit
+
1
,
$offset
);
// WHERE
if
(
!
empty
(
$search_ref
))
...
...
@@ -189,9 +190,6 @@ if (!empty($sall))
if
(
empty
(
$user
->
rights
->
holiday
->
read_all
))
$filter
.
=
' AND cp.fk_user IN ('
.
join
(
','
,
$childids
)
.
')'
;
/*************************************
* Fin des filtres de recherche
*************************************/
// Récupération de l'ID de l'utilisateur
$user_id
=
$user
->
id
;
...
...
@@ -204,7 +202,7 @@ if ($id > 0)
$user_id
=
$fuser
->
id
;
}
// Récupération des congés payés de l'utilisateur ou de tous les users
if
(
empty
(
$user
->
rights
->
holiday
->
write
_all
)
||
$id
>
0
)
if
(
empty
(
$user
->
rights
->
holiday
->
read
_all
)
||
$id
>
0
)
{
$holiday_payes
=
$holiday
->
fetchByUser
(
$user_id
,
$order
,
$filter
);
// Load array $holiday->holiday
}
...
...
@@ -224,7 +222,8 @@ if ($holiday_payes == '-1')
// Show table of vacations
$var
=
true
;
$num
=
count
(
$holiday
->
holiday
);
$var
=
true
;
$num
=
count
(
$holiday
->
holiday
);
$form
=
new
Form
(
$db
);
$formother
=
new
FormOther
(
$db
);
...
...
@@ -246,7 +245,9 @@ if ($id > 0)
}
else
{
print_barre_liste
(
$langs
->
trans
(
"ListeCP"
),
$page
,
$_SERVER
[
"PHP_SELF"
],
''
,
$sortfield
,
$sortorder
,
""
,
$num
,
0
,
'title_hrm.png'
);
//print $num;
//print count($holiday->holiday);
print_barre_liste
(
$langs
->
trans
(
"ListeCP"
),
$page
,
$_SERVER
[
"PHP_SELF"
],
''
,
$sortfield
,
$sortorder
,
""
,
$num
,
count
(
$holiday
->
holiday
),
'title_hrm.png'
,
0
,
''
,
''
,
$limit
);
dol_fiche_head
(
''
);
}
...
...
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