Skip to content
GitLab
Menu
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
ff509ab6
Commit
ff509ab6
authored
Nov 19, 2018
by
okhin
🚴
Browse files
Merge branch 'preprod' into 'master'
Preprod See merge request
!61
parents
bb599f4f
0bd6723e
Changes
9
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
ff509ab6
...
...
@@ -82,7 +82,7 @@ cs-lint: ## Lint
translations
:
locales/fr_FR/LC_MESSAGES/messages.mo locales/en_US/LC_MESSAGES/messages.mo
##
Generate translations
messages.pot
:
app/*.php
templates
/*/*.html
messages.pot
:
app/*.php
app/view
/*/*.html
[
-r
$@
]
||
touch
$@
xgettext
--package-name
=
LQDNCampaign
--package-version
=
2016.1
--force-po
-o
$@
--keyword
=
__
--keyword
=
_
--from-code
=
UTF-8
$^
...
...
app/controller/admin.php
View file @
ff509ab6
This diff is collapsed.
Click to expand it.
db/seeds/DonationSeeder.php
View file @
ff509ab6
...
...
@@ -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
,
...
...
locales/en_US/LC_MESSAGES/messages.po
View file @
ff509ab6
This diff is collapsed.
Click to expand it.
locales/fr_FR/LC_MESSAGES/messages.po
View file @
ff509ab6
This diff is collapsed.
Click to expand it.
src/LQDN/Finder/DonationFinder.php
View file @
ff509ab6
...
...
@@ -32,6 +32,24 @@ class DonationFinder
return
$donations
;
}
/**
* findById
*
* @param int $donationId
*
* @return []
*/
public
function
findById
(
$donationId
)
{
$donationId
=
(
int
)
$donationId
;
$donations
=
[];
$stmt
=
$this
->
connection
->
query
(
"SELECT * FROM dons WHERE id='
$donationId
'"
);
while
(
$donation
=
$stmt
->
fetch
())
{
$donations
[
$donationId
]
=
$donation
;
}
return
$donations
;
}
/**
* Return dons for admins.
*
...
...
@@ -43,7 +61,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,
...
...
@@ -61,7 +79,7 @@ SELECT d.id as id,
a.ville AS ville,
a.pays AS pays
FROM dons d
JOIN users u ON u.id = d.user_id
LEFT
JOIN users u ON u.id = d.user_id
LEFT JOIN adresses a ON d.adresse_id = a.id
WHERE 1=1
EOQ;
...
...
@@ -87,6 +105,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
"
;
...
...
src/LQDN/Finder/UserFinder.php
View file @
ff509ab6
...
...
@@ -37,6 +37,18 @@ class UserFinder
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE email = :email"
,
[
'email'
=>
$email
]);
}
/**
* findByPseudo
*
* @param mixed pseudo
*
* @return []
*/
public
function
findByPseudo
(
$pseudo
)
{
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE pseudo = :pseudo"
,
[
'pseudo'
=>
$pseudo
]);
}
/**
* The search from the admin.
*
...
...
tests/functional/Finder/DonationFinderTest.php
View file @
ff509ab6
...
...
@@ -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'
));
}
}
tests/functional/Finder/UserFinderTest.php
View file @
ff509ab6
...
...
@@ -42,6 +42,25 @@ class UserFinderTest extends FunctionalTest
$this
->
assertEquals
(
$expectedUser
,
$user
);
}
public
function
testFindByPseudo
()
{
$user
=
$this
->
container
[
'user_finder'
]
->
findByPseudo
(
'Alice'
);
$expectedUser
=
[
'id'
=>
'1'
,
'status'
=>
'1'
,
'hash'
=>
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8'
,
'cumul'
=>
'2000'
,
'email'
=>
'alice@example.org'
,
'total'
=>
'5000'
,
'pseudo'
=>
'Alice'
,
'expiration'
=>
null
,
'commentaire'
=>
'RAS'
,
];
$this
->
assertEquals
(
$expectedUser
,
$user
);
}
public
function
testAdminSearch
()
{
$this
->
assertCount
(
1
,
$this
->
container
[
'user_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$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