Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
don
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LQdN interne
don
Commits
63f5bf82
Commit
63f5bf82
authored
Nov 16, 2018
by
okhin
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a filter by date
parent
8ee23dea
Pipeline
#2249
passed with stages
in 12 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
db/seeds/DonationSeeder.php
db/seeds/DonationSeeder.php
+1
-1
src/LQDN/Finder/DonationFinder.php
src/LQDN/Finder/DonationFinder.php
+6
-1
tests/functional/Finder/DonationFinderTest.php
tests/functional/Finder/DonationFinderTest.php
+6
-4
No files found.
db/seeds/DonationSeeder.php
View file @
63f5bf82
...
...
@@ -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 @
63f5bf82
...
...
@@ -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 @
63f5bf82
...
...
@@ -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
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