Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
a39e9915
Commit
a39e9915
authored
Nov 16, 2018
by
Okhin
Browse files
Adding a filter by date
parent
bb599f4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
db/seeds/DonationSeeder.php
View file @
a39e9915
...
...
@@ -70,7 +70,7 @@ class DonationSeeder extends AbstractSeed
array
(
'id'
=>
3
,
'status'
=>
100
,
'datec'
=>
'2016-06-1
0
12:34'
,
'datec'
=>
'2016-06-1
1
12:34'
,
'somme'
=>
100
,
'lang'
=>
'fr_FR'
,
'cadeau'
=>
1
,
...
...
src/LQDN/Finder/DonationFinder.php
View file @
a39e9915
...
...
@@ -43,7 +43,7 @@ class DonationFinder
*
* @return array
*/
public
function
adminSearch
(
$text
,
$sum
,
$public
,
$status
,
$limit
=
50
,
$page
=
1
)
public
function
adminSearch
(
$text
,
$sum
,
$public
,
$status
,
$date1
,
$date2
=
"2999-12-31 23:59:59"
,
$limit
=
50
,
$page
=
1
)
{
$query
=
<<<EOQ
SELECT d.id as id,
...
...
@@ -87,6 +87,11 @@ EOQ;
$params
[
'status'
]
=
$status
;
}
if
(
''
!==
$date1
)
{
$query
.
=
' AND d.datec BETWEEN (:date1) AND (:date2) '
;
$params
[
'date1'
]
=
$date1
;
$params
[
'date2'
]
=
$date2
;
}
$first
=
(
$page
-
1
)
*
$limit
;
$last
=
(
$page
)
*
$limit
;
$query
.
=
" ORDER BY datec DESC LIMIT
$first
,
$last
"
;
...
...
tests/functional/Finder/DonationFinderTest.php
View file @
a39e9915
...
...
@@ -43,10 +43,12 @@ class DonationFinderTest extends FunctionalTest
public
function
testAdminSearchDonations
()
{
$this
->
assertCount
(
1
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$sum
=
''
,
$public
=
''
,
$status
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
'1000'
,
$public
=
''
,
$status
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
'0'
,
$status
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
''
,
$status
=
'1'
));
$this
->
assertCount
(
1
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$sum
=
''
,
$public
=
''
,
$status
=
''
,
$date1
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
'1000'
,
$public
=
''
,
$status
=
''
,
$date1
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
'0'
,
$status
=
''
,
$date1
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
''
,
$status
=
'1'
,
$date1
=
''
));
$this
->
assertCount
(
2
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
''
,
$status
=
'1'
,
$date1
=
''
));
$this
->
assertCount
(
1
,
$this
->
container
[
'donation_finder'
]
->
adminSearch
(
$text
=
''
,
$sum
=
''
,
$public
=
''
,
$status
=
''
,
$date1
=
'2016-06-11 00:00:00'
));
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment