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
cb111eba
Commit
cb111eba
authored
Oct 13, 2018
by
Okhin
Browse files
Finally, extract the PDF attributes from tables.
parent
3520bb48
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
db/seeds/AddressSeeder.php
View file @
cb111eba
...
...
@@ -54,6 +54,19 @@ class AddressSeeder extends AbstractSeed
'user_id'
=>
1
,
'defaut'
=>
false
,
),
array
(
'id'
=>
5
,
'nom'
=>
'Bob address'
,
'adresse'
=>
'4 rue Ménars'
,
'adresse2'
=>
null
,
'codepostal'
=>
75003
,
'ville'
=>
'Paris'
,
'etat'
=>
null
,
'pays'
=>
'France'
,
'alias'
=>
'Third address'
,
'user_id'
=>
2
,
'defaut'
=>
false
,
),
);
$this
->
table
(
'adresses'
)
->
insert
(
$data
)
->
save
();
...
...
db/seeds/CounterpartSeeder.php
View file @
cb111eba
...
...
@@ -29,7 +29,7 @@ class CounterpartSeeder extends AbstractSeed
'datec'
=>
'2016-06-22 12:34'
,
'user_id'
=>
2
,
'quoi'
=>
'piplome'
,
// [piplome|pibag|pishirt|hoodie]
'taille'
=>
1
,
'taille'
=>
2
,
'status'
=>
1
,
'adresse_id'
=>
null
,
),
...
...
db/seeds/DonationSeeder.php
View file @
cb111eba
...
...
@@ -63,7 +63,7 @@ class DonationSeeder extends AbstractSeed
'fdnn_user'
=>
1234567890
,
'color_2'
=>
'red'
,
'cumul'
=>
1000
,
'adresse_id'
=>
1
,
'adresse_id'
=>
3
,
'user_id'
=>
2
,
'identifier'
=>
'id2'
,
),
...
...
src/LQDN/Finder/CounterpartFinder.php
View file @
cb111eba
...
...
@@ -34,19 +34,20 @@ class CounterpartFinder
// @TODO: This part is probably not working.
if
(
'piplome'
===
$counterpart
[
'quoi'
])
{
$query
=
<<<EOQ
SELECT d.id
AS
id, a.nom as pseudo, d.pdf as pdf
SELECT d.id
as
id, a.nom as pseudo, d.pdf as pdf
FROM dons d
JOIN adresses a ON a.id = d.adresse_id
WHERE d.id = :don_id
JOIN contreparties c ON c.id = d.taille
WHERE d.taille = :size
EOQ;
$pdf
=
$this
->
connection
->
fetchAssoc
(
$query
,
[
'
don_id
'
=>
$counterpart
[
''
]
'
size
'
=>
$counterpart
[
'
taille
'
]
]);
if
(
false
!==
$pdf
)
{
$cont
r
epart
ie
[
'pdf_id'
]
=
$pdf
[
'id'
];
$cont
r
epart
ie
[
'pdf_nom'
]
=
$pdf
[
'pseudo'
];
$cont
r
epart
ie
[
'pdf_url'
]
=
$pdf
[
'pdf'
];
$co
u
nte
r
part
[
'pdf_id'
]
=
$pdf
[
'id'
];
$co
u
nte
r
part
[
'pdf_nom'
]
=
$pdf
[
'pseudo'
];
$co
u
nte
r
part
[
'pdf_url'
]
=
$pdf
[
'pdf'
];
}
}
...
...
tests/functional/Finder/CounterpartFinderTest.php
View file @
cb111eba
...
...
@@ -19,18 +19,13 @@ class CounterpartFinderTest extends FunctionalTest
'user_id'
=>
'2'
,
'datec'
=>
'2016-06-22 12:34:00'
,
'quoi'
=>
'piplome'
,
'taille'
=>
'
1
'
,
'taille'
=>
'
2
'
,
'status'
=>
'1'
,
'adresse_id'
=>
null
,
'pdf_id'
=>
'1'
,
'pdf_nom'
=>
'
bob@example.org
'
,
'pdf_nom'
=>
'
Main
'
,
'pdf_url'
=>
'pdf'
,
];
$this
->
assertEquals
(
$expectedCounterpart
,
$firstCounterpart
);
// Test the PDF attributes
$this
->
assertEquals
(
2
,
$firstCounterpart
[
'pdf_id'
]);
$this
->
assertEquals
(
'Bob'
,
$firstCounterpart
[
'pdf_nom'
]);
$this
->
assertEquals
(
'http://example.org/pdf/2'
,
$firstCounterpart
[
'pdf_url'
]);
}
}
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