Commit 85ef344e authored by Patrick Barroca's avatar Patrick Barroca 😠
Browse files

Merge branch 'hotline#105277_nombre_de_livres_numeriques_empruntes_par_bibliotheque' into 'hotline'

hotline #105277 dilicom PNB, CSV export, add library column

See merge request !3394
parents 1a8571c0 ca58c675
Pipeline #9366 passed with stage
in 55 minutes and 50 seconds
- ticket #105277 : Dilicom PNB, export CSV des prêts : ajout de la colonne "Bibliothèque" qui contient le libellé de la bibliothèque des abonnés
\ No newline at end of file
......@@ -151,7 +151,16 @@ class Class_Loan_Pnb extends Storm_Model_Abstract {
public function getBibliotheque() {
return '';
return $this->hasUser()
? $this->getUser()->getLibelleBib()
: '';
}
public function getUser() {
if ($user = parent::_get('user'))
return $user;
return Class_Users::findFirstBy(['idabon' => $this->getSubscriberId()]);
}
......
......@@ -37,7 +37,7 @@ class Class_TableDescription_PNBLoans extends Class_TableDescription {
->addColumn($this->_('Genre'), 'first_kind')
->addColumn($this->_('Section'), 'first_section')
->addColumn($this->_('Catégorie'), 'category')
;
->addColumn($this->_('Bibliothèque'), 'bibliotheque');
}
......
......@@ -31,6 +31,10 @@ abstract class Scenario_MobileApplication_RestfulApi_UserAccountTestCase extends
Class_CommSigb::setInstance($this->_sigb = $this->mock());
$this->fixture('Class_Bib',
['id' => 1,
'libelle' => 'Vaise-sur-Ravoire']);
$puppy = $this->fixture('Class_Users',
['id' => 345,
'pseudo' => 'Puppy',
......@@ -173,7 +177,7 @@ class Scenario_MobileApplication_RestfulApi_UserAccountLoansWithTokenTest extend
'author' => 'Collodi',
'date_due' => '2022-05-02',
'loaned_by' => 'puppy',
'library' => ''
'library' => 'Vaise-sur-Ravoire'
],
$this->_json['loans'][2]);
}
......
......@@ -3626,7 +3626,38 @@ class PnbDilicomAdminAlbumControllerExportLoansCsvTest extends PnbDilicomAdminAl
public function setUp() {
parent::setUp();
Class_Album_UsageConstraints::setTimeSource(new TimeSourceForTest('2015-12-04 14:14:14'));
$this->fixture('Class_Users',
['id' => 7,
'nom' => 'boum',
'login'=>'boum',
'password'=>'secret',
'id_site' => 1,
'idabon' => '9878']);
$this->fixture('Class_Bib', ['id' => 1,
'libelle' => 'SomewhereInCode',
'gln' => '333']);
$this->fixture('Class_Loan_Pnb',
['id' => 4,
'record_origin_id' => 'Dilicom-3663608260879',
'subscriber_id' => 9879,
'user_id' => 7,
'expected_return_date' => '2020-01-20 13:57:33',
'loan_date' => '2020-01-06 13:57:33',
'loan_link' => 'https://pnb-dilicom.centprod.com/v2//XXXXXXXX.do',
'order_line_id' => '82377a045ce56ef0a072a8b']);
$this->fixture('Class_Loan_Pnb',
['id' => 5,
'record_origin_id' => 'Dilicom-3663608260879',
'subscriber_id' => 9878,
'user_id' => 12321,
'expected_return_date' => '2020-02-20 13:57:33',
'loan_date' => '2020-02-06 13:57:33',
'loan_link' => 'https://pnb-dilicom.centprod.com/v2//XXXXXXXX.do',
'order_line_id' => '82377a045ce56ef0a072a8b']);
$this->dispatch('admin/album/dilicom-export-loans-csv', true);
}
......@@ -3648,9 +3679,11 @@ class PnbDilicomAdminAlbumControllerExportLoansCsvTest extends PnbDilicomAdminAl
/** @test */
public function csvShouldContainsAlbumsItems() {
$this->assertEquals('Date;Titre;"Date de commande";Auteur;Éditeur;Collection;Année;Genre;Section;Catégorie
16/12/2016;"Hell is from here to eternity";30/03/2015;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu
13/11/2017;"Hell is from here to eternity";30/03/2015;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu
$this->assertEquals('Date;Titre;"Date de commande";Auteur;Éditeur;Collection;Année;Genre;Section;Catégorie;Bibliothèque
16/12/2016;"Hell is from here to eternity";30/03/2015;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu;
13/11/2017;"Hell is from here to eternity";30/03/2015;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu;
06/01/2020;"Hell is from here to eternity";;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu;SomewhereInCode
06/02/2020;"Hell is from here to eternity";;"Iron Maiden";EMI;"Temple Of Rock";1992;"Heavy Metal";"Espace métal";Fondu;SomewhereInCode
',
$this->_response->getBody());
}
......
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