Commit ee2702d2 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #78971 fix loans exports when connecting with a multicard account

parent bc863a70
Pipeline #4871 passed with stage
in 89 minutes and 54 seconds
- ticket #78971 : Compte lecteur : correction des exports de la liste des prêts pour les comptes multi-cartes.
\ No newline at end of file
......@@ -1011,7 +1011,12 @@ class AbonneController extends ZendAfi_Controller_Action {
$this->_helper->viewRenderer->setNoRender();
$datas = [];
$emprunts = $this->_user->getLoansWithoutPNB($this->_request->getParams());
$cards = new Class_User_Cards($this->_user);
$emprunts = $cards
->getLoansWithOutPNB($this->_request->getParams())
->getArrayCopy();
foreach($emprunts as $emprunt) {
if (!$exemplaire = $emprunt->getExemplaireOPAC())
continue;
......@@ -1055,9 +1060,9 @@ class AbonneController extends ZendAfi_Controller_Action {
return $loan->getCodeBarre();
});
$datas = array_filter($this->_user
->getLoansWithoutPNB($this->_request->getParams())
->getArrayCopy());
$cards = new Class_User_Cards($this->_user);
$loans = $cards->getLoansWithOutPNB($this->_request->getParams())->getArrayCopy();
$datas = array_filter($loans);
$this->_helper->csv($filename,
$this->view->renderCsv($description,
......
......@@ -1161,3 +1161,110 @@ class AbonneControllerPrintActionPretsTest extends AbonneControllerPretsListThre
$this->assertXPathContentContains('//div', 'Titre : Alice au royaume de ');
}
}
class AbonneControllerPretsExportThreePretsInCardsTest extends AbonneControllerPretsListThreePretsTestCase {
protected
$_dl_file,
$unimarc = '01201nam0 22002891 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890995001400897frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrefleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la foret aux portes, Alice tombe nez a nez avec Ace. Devenue malgre elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assiste a la scene, intervient, la rencontre tourne a l\'affrontement. b9782355926358 1tAlice au royaume de Trefle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR 1aAliceItem00604nam0 22001931 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388995001500395frOr1314913787 a9781408812792 a20140320 0103  aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliotheque de l\'agglomeration de Saint-Omer apm 1aPotterItem';
public function setUp() {
parent::setUp();
$e_wok = $this->fixture('Class_Users',
['id' => 666,
'login' => 'e',
'password' => 'wok',
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]);
$e_wok
->addChildCard(Class_Users::find(123456))
->save();
ZendAfi_Auth::getInstance()->logUser($e_wok);
$this->dispatch('/opac/abonne/loan-export', true);
$this->_dl_file = tempnam('/tmp', 'UNIMARC');
file_put_contents($this->_dl_file, $this->_response->getBody());
}
/** @test */
public function controllerAndActionShouldBeAbonnePrets() {
$this->assertController('abonne');
$this->assertAction('loan-export');
}
/** @test */
public function responseBodyShouldBeAttachment() {
$this->assertHeaderContains('Content-Disposition', 'attachment');
}
/** @test */
public function responseFileNameShouldContainsPrets() {
$this->assertHeaderContains('Content-Disposition', 'filename="prets_');
$this->assertHeaderContains('Content-Type', 'name="prets_');
}
/** @test */
public function bodyShouldContainsUnimarcs() {
$this->assertSame($this->unimarc, $this->_response->getBody());
}
/** @test */
public function dlFileShouldContainsUnimarc() {
$this->assertEquals($this->unimarc, file_get_contents($this->_dl_file));
}
}
class AbonneControllerBarcodesExportThreePretsInCardsTest extends AbonneControllerPretsListThreePretsTestCase {
public function setUp() {
parent::setUp();
$e_wok = $this->fixture('Class_Users',
['id' => 666,
'login' => 'e',
'password' => 'wok',
'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]);
$e_wok
->addChildCard(Class_Users::find(123456))
->save();
ZendAfi_Auth::getInstance()->logUser($e_wok);
$this->dispatch('abonne/barcodes-export', true);
}
/** @test */
public function responseBodyShouldBeAttachment() {
$this->assertHeaderContains('Content-Disposition', 'attachment');
}
/** @test */
public function responseFileNameShouldContainsPrets() {
$this->assertHeaderContains('Content-Disposition', 'filename="prets_codes_barres_');
$this->assertHeaderContains('Content-Type', 'name="prets_codes_barres_');
}
/** @test */
public function bodyShouldContainsBarCodes() {
$this->assertContains('124', $this->_response->getBody());
$this->assertContains('123', $this->_response->getBody());
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment