Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
afi
opacce
Commits
70d6a38a
Commit
70d6a38a
authored
Jun 25, 2018
by
Ghislain Loas
Browse files
dev #72825 change export json to csv
parent
42c7c08f
Pipeline
#4460
failed with stage
in 33 minutes and 43 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
29 deletions
+20
-29
application/modules/opac/controllers/AbonneController.php
application/modules/opac/controllers/AbonneController.php
+16
-14
tests/application/modules/opac/controllers/AbonneControllerPretsTest.php
...on/modules/opac/controllers/AbonneControllerPretsTest.php
+3
-14
tests/scenarios/HandleOnholdTest/HandleOnholdTest.php
tests/scenarios/HandleOnholdTest/HandleOnholdTest.php
+1
-1
No files found.
application/modules/opac/controllers/AbonneController.php
View file @
70d6a38a
...
...
@@ -400,7 +400,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$id_pret
=
$this
->
_getParam
(
'id_pret'
);
$ids
=
array_filter
(
explode
(
';'
,
$id_pret
));
if
(
!
count
(
$ids
))
{
$this
->
_renderExtendPopup
([
$this
->
_
(
'Aucune prolongation éffectué.'
)]);
$this
->
_renderExtendPopup
([
$this
->
_
(
'Aucune prolongation éffectué
e
.'
)]);
return
;
}
...
...
@@ -1021,22 +1021,24 @@ class AbonneController extends ZendAfi_Controller_Action {
public
function
barcodesExportAction
()
{
$this
->
_helper
->
viewRenderer
->
setNoRender
();
$datas
=
[];
$emprunts
=
$this
->
_user
->
getLoansWithoutPNB
(
$this
->
_request
->
getParams
());
foreach
(
$emprunts
as
$emprunt
)
{
if
(
!
$exemplaire
=
$emprunt
->
getExemplaireOPAC
())
continue
;
$datas
[]
=
(
string
)
$exemplaire
->
getCodeBarres
();
}
$filename
=
$this
->
_
(
'prets_codes_barres_%s_%s%s'
,
$this
->
_user
->
getId
(),
uniqid
(),
'.json'
);
$this
->
_helper
->
binaryDownload
(
json_encode
(
array_filter
(
$datas
)),
$filename
);
'.csv'
);
$description
=
(
new
Class_TableDescription
(
'loans-barcodes'
))
->
addColumn
(
''
,
function
(
$loan
)
{
return
$loan
->
getCodeBarre
();
});
$datas
=
array_filter
(
$this
->
_user
->
getLoansWithoutPNB
(
$this
->
_request
->
getParams
())
->
getArrayCopy
());
$this
->
_helper
->
csv
(
$filename
,
$this
->
view
->
renderCsv
(
$description
,
$datas
));
}
...
...
tests/application/modules/opac/controllers/AbonneControllerPretsTest.php
View file @
70d6a38a
...
...
@@ -1104,16 +1104,10 @@ class AbonneControllerPretsListMoreThanUndredHoldsTest extends AbonneControllerP
class
AbonneControllerBarcodesExportThreePretsTest
extends
AbonneControllerPretsListThreePretsTestCase
{
protected
$_dl_file
,
$_json
=
[
'124'
,
'123'
];
public
function
setUp
()
{
parent
::
setUp
();
$this
->
dispatch
(
'abonne/barcodes-export'
,
true
);
$this
->
_dl_file
=
tempnam
(
'/tmp'
,
'JSON'
);
file_put_contents
(
$this
->
_dl_file
,
$this
->
_response
->
getBody
());
$this
->
_json
=
json_encode
(
$this
->
_json
);
}
...
...
@@ -1131,14 +1125,9 @@ class AbonneControllerBarcodesExportThreePretsTest extends AbonneControllerPrets
/** @test */
public
function
bodyShouldContainsJsons
()
{
$this
->
assertSame
(
$this
->
_json
,
$this
->
_response
->
getBody
());
}
/** @test */
public
function
dlFileShouldContainsJson
()
{
$this
->
assertEquals
(
$this
->
_json
,
file_get_contents
(
$this
->
_dl_file
));
public
function
bodyShouldContainsBarCodes
()
{
$this
->
assertContains
(
'124'
,
$this
->
_response
->
getBody
());
$this
->
assertContains
(
'123'
,
$this
->
_response
->
getBody
());
}
}
...
...
tests/scenarios/HandleOnholdTest/HandleOnholdTest.php
View file @
70d6a38a
...
...
@@ -206,7 +206,7 @@ abstract class HandleOnholdDispatchTestCase extends HandleOnholdTestCase {
/** @test */
public
function
export
Json
ShouldBeDisplay
()
{
public
function
export
Barcodes
ShouldBeDisplay
()
{
$this
->
dispatch
(
'/opac/abonne/prets/onhold/yes'
,
true
);
$this
->
assertXPathContentContains
(
'//a[contains(@href, "abonne/barcodes-export/onhold/yes")]'
,
'Export codes barres'
);
}
...
...
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