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
Quentin CHEVILLON
opacce
Commits
857cb47b
Commit
857cb47b
authored
Jul 15, 2021
by
Ghislain Loas
Browse files
hotline MT #137459 fix borower loans list when koha throwing error on history
parent
2d34ec5a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
48 deletions
+149
-48
VERSIONS_HOTLINE/137459
VERSIONS_HOTLINE/137459
+1
-0
library/Class/User/Cards.php
library/Class/User/Cards.php
+14
-8
library/templates/Intonation/View/Abonne/AjaxLoans.php
library/templates/Intonation/View/Abonne/AjaxLoans.php
+5
-4
library/templates/Intonation/View/Abonne/HistoryLoansList.php
...ary/templates/Intonation/View/Abonne/HistoryLoansList.php
+2
-2
library/templates/Intonation/View/Abonne/LoansList.php
library/templates/Intonation/View/Abonne/LoansList.php
+4
-4
tests/fixtures/KohaFixtures.php
tests/fixtures/KohaFixtures.php
+5
-0
tests/scenarios/Templates/TemplatesAbonneTest.php
tests/scenarios/Templates/TemplatesAbonneTest.php
+118
-30
No files found.
VERSIONS_HOTLINE/137459
0 → 100644
View file @
857cb47b
- ticket #137459 : Magasin de thèmes : correction de l'affichage des prêts en cours lorsque le SIGB Koha retourne une anomalie de l'historique de prêts.
\ No newline at end of file
library/Class/User/Cards.php
View file @
857cb47b
...
...
@@ -173,20 +173,26 @@ class Class_User_Cards extends Storm_Model_Collection {
public
function
getPNBLoans
()
{
$loans
=
$this
->
getLoans
()
->
select
(
function
(
$loan
)
{
return
$loan
->
isPNB
();
});
->
select
(
function
(
$loan
)
{
return
$loan
->
isPNB
();
});
return
$loans
;
}
public
function
getLoansHistory
()
{
return
$this
->
_decorateOperationFrom
(
function
(
$card
)
{
return
$card
->
getLoansHistory
();
});
/* see forge #137459 and koha library/Class/WebService/SIGB/Koha/RestfulService loanHistory($borrower) */
try
{
return
$this
->
_decorateOperationFrom
(
function
(
$card
)
{
return
$card
->
getLoansHistory
();
});
}
catch
(
Exception
$exception
)
{
return
new
Storm_Collection
;
}
}
...
...
library/templates/Intonation/View/Abonne/AjaxLoans.php
View file @
857cb47b
...
...
@@ -58,10 +58,11 @@ class Intonation_View_Abonne_AjaxLoans extends ZendAfi_View_Helper_BaseHelper {
'Loans'
=>
$cards
->
getPNBLoans
()]))
:
''
;
$history
=
$this
->
view
->
abonne_HistoryLoansList
(
new
Class_Entity
([
'Profile'
=>
Class_Profil
::
getCurrentProfil
(),
'RequestParams'
=>
[],
'User'
=>
$this
->
_model
,
'Loans'
=>
$cards
->
getLoansHistory
([])]));
$history
=
$this
->
view
->
abonne_HistoryLoansList
(
new
Class_Entity
([
'Profile'
=>
Class_Profil
::
getCurrentProfil
(),
'RequestParams'
=>
[],
'User'
=>
$this
->
_model
,
'Loans'
=>
$cards
->
getLoansHistory
([])]));
$html
=
[];
...
...
library/templates/Intonation/View/Abonne/HistoryLoansList.php
View file @
857cb47b
...
...
@@ -23,8 +23,8 @@
class
Intonation_View_Abonne_HistoryLoansList
extends
Intonation_View_Abonne_LoansList
{
public
function
abonne_HistoryLoansList
(
$
user
)
{
return
parent
::
abonne_LoansList
(
$
user
);
public
function
abonne_HistoryLoansList
(
$
config
)
{
return
parent
::
abonne_LoansList
(
$
config
);
}
protected
function
_renderList
(
$collection
,
$actions
)
{
...
...
library/templates/Intonation/View/Abonne/LoansList.php
View file @
857cb47b
...
...
@@ -21,16 +21,16 @@
class
Intonation_View_Abonne_LoansList
extends
ZendAfi_View_Helper_BaseHelper
{
protected
$_config
;
public
function
abonne_LoansList
(
$config
)
{
$this
->
_config
=
$config
;
if
(
$error
=
$config
->
getError
())
return
$error
;
return
$this
->
render
(
$config
->
getLoans
());
return
(
$error
=
$config
->
getError
())
?
$error
:
$this
->
render
(
$config
->
getLoans
());
}
...
...
tests/fixtures/KohaFixtures.php
View file @
857cb47b
...
...
@@ -1096,6 +1096,11 @@ class KohaFixtures {
public
static
function
xmlGetPatronLaureIssuesHistoryError
()
{
return
''
;
}
public
static
function
xmlLookupPatronJeanAndre
()
{
return
'<?xml version="1.0" encoding="UTF-8" ?>
<LookupPatron>
...
...
tests/scenarios/Templates/TemplatesAbonneTest.php
View file @
857cb47b
...
...
@@ -106,10 +106,10 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes
'id_notice'
=>
820
]);
$exemplaire_troy
=
$this
->
fixture
(
'Class_Exemplaire'
,
[
'id'
=>
12090
,
'code_barres'
=>
123
,
'id_int_bib'
=>
1
,
'id_notice'
=>
820
]);
[
'id'
=>
12090
,
'code_barres'
=>
123
,
'id_int_bib'
=>
1
,
'id_notice'
=>
820
]);
$this
->
fixture
(
'Class_Notice'
,
[
'id'
=>
820
,
...
...
@@ -348,11 +348,11 @@ class TemplatesDispatchAbonneLoansPaginatedTest extends TemplatesIntonationAccou
$reviews
=
Class_AvisNotice
::
groupByRecords
(
Class_AvisNotice
::
findAll
());
$reviews
=
array_map
(
function
(
$review
)
{
return
(
new
Intonation_Library_View_Wrapper_ReviewsByRecord
)
->
setModel
(
$review
)
->
setView
(
$this
->
view
);
},
$reviews
);
{
return
(
new
Intonation_Library_View_Wrapper_ReviewsByRecord
)
->
setModel
(
$review
)
->
setView
(
$this
->
view
);
},
$reviews
);
$collection
=
new
Storm_Collection
(
$reviews
);
...
...
@@ -457,18 +457,18 @@ class TemplatesDispatchAbonneMonHistoriqueTest extends TemplatesIntonationAccoun
$notice_unimarc
->
newZone
()
->
label
(
'200'
)
->
addChild
(
'a'
,
'Pottifar'
);
$notice
=
$this
->
fixture
(
'Class_Notice'
,
[
'id'
=>
890
,
'clef_alpha'
=>
'MYSUPERkey'
,
'unimarc'
=>
$notice_unimarc
->
render
(),
'facettes'
=>
'M8897 T1 B3 A18 Lfre'
]);
[
'id'
=>
890
,
'clef_alpha'
=>
'MYSUPERkey'
,
'unimarc'
=>
$notice_unimarc
->
render
(),
'facettes'
=>
'M8897 T1 B3 A18 Lfre'
]);
$exemplaire
=
$this
->
fixture
(
'Class_Exemplaire'
,
[
'id'
=>
891
,
'id_origine'
=>
1234
,
'code_barres'
=>
456
,
'id_int_bib'
=>
1
,
'zone995'
=>
serialize
([[
'clef'
=>
'a'
,
'valeur'
=>
'PottifarItem'
]]),
'notice'
=>
$notice
]);
[
'id'
=>
891
,
'id_origine'
=>
1234
,
'code_barres'
=>
456
,
'id_int_bib'
=>
1
,
'zone995'
=>
serialize
([[
'clef'
=>
'a'
,
'valeur'
=>
'PottifarItem'
]]),
'notice'
=>
$notice
]);
$pottifar_old_issue
=
new
Class_WebService_SIGB_Emprunt
(
'42'
,
new
Class_WebService_SIGB_Exemplaire
(
456
));
$pottifar_old_issue
...
...
@@ -516,18 +516,18 @@ class TemplatesDispatchAbonneLoansWithHistoryTest extends TemplatesIntonationAcc
$notice_unimarc
->
newZone
()
->
label
(
'200'
)
->
addChild
(
'a'
,
'Pottifar'
);
$notice
=
$this
->
fixture
(
'Class_Notice'
,
[
'id'
=>
890
,
'clef_alpha'
=>
'MYSUPERkey'
,
'unimarc'
=>
$notice_unimarc
->
render
(),
'facettes'
=>
'M8897 T1 B3 A18 Lfre'
]);
[
'id'
=>
890
,
'clef_alpha'
=>
'MYSUPERkey'
,
'unimarc'
=>
$notice_unimarc
->
render
(),
'facettes'
=>
'M8897 T1 B3 A18 Lfre'
]);
$exemplaire
=
$this
->
fixture
(
'Class_Exemplaire'
,
[
'id'
=>
891
,
'id_origine'
=>
1234
,
'code_barres'
=>
456
,
'id_int_bib'
=>
1
,
'zone995'
=>
serialize
([[
'clef'
=>
'a'
,
'valeur'
=>
'PottifarItem'
]]),
'notice'
=>
$notice
]);
[
'id'
=>
891
,
'id_origine'
=>
1234
,
'code_barres'
=>
456
,
'id_int_bib'
=>
1
,
'zone995'
=>
serialize
([[
'clef'
=>
'a'
,
'valeur'
=>
'PottifarItem'
]]),
'notice'
=>
$notice
]);
$pottifar_old_issue
=
new
Class_WebService_SIGB_Emprunt
(
'42'
,
new
Class_WebService_SIGB_Exemplaire
(
456
));
$pottifar_old_issue
...
...
@@ -1339,7 +1339,6 @@ class TemplatesAbonneEditActionFicheTest extends Admin_AbstractControllerTestCas
class
TemplatesAbonneAgendaDisabledTest
extends
AbstractControllerTestCase
{
...
...
@@ -1385,4 +1384,93 @@ class TemplatesAbonneJumbotronLoansTest extends TemplatesIntonationAccountTestCa
$this
->
dispatch
(
'/abonne/has-loan/id_profil/72'
);
$this
->
assertXPath
(
'//span[@class="success"]'
);
}
}
require_once
__DIR__
.
'/../../fixtures/KohaFixtures.php'
;
class
TemplatesAbonneKohaAjaxLoansTest
extends
AbstractControllerTestCase
{
protected
$_storm_default_to_volatile
=
true
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
_buildTemplateProfil
([
'id'
=>
5
]);
$sigb_plage
=
$this
->
fixture
(
'Class_IntBib'
,
[
'id'
=>
3
,
'comm_params'
=>
[
'url_serveur'
=>
'http://plage.com/cgi-bin/koha/ilsdi.pl'
,
'restful'
=>
'1'
],
'comm_sigb'
=>
Class_IntBib
::
COM_KOHA
]);
$this
->
fixture
(
'Class_Bib'
,
[
'id'
=>
3
,
'libelle'
=>
'Bib de la plage 2'
,
'int_bib'
=>
$sigb_plage
]);
$user
=
$this
->
fixture
(
'Class_Users'
,
[
'id'
=>
3
,
'login'
=>
'thom'
,
'password'
=>
'thom'
,
'id_site'
=>
12
,
'idabon'
=>
'572'
,
'id_sigb'
=>
'572'
,
'role_level'
=>
ZendAfi_Acl_AdminControllerRoles
::
ABONNE_SIGB
,
'int_bib'
=>
$sigb_plage
]);
$logger
=
$this
->
mock
()
->
whenCalled
(
'log'
)
->
answers
(
true
)
->
whenCalled
(
'logError'
)
->
willDo
(
function
(
$url
,
$message
)
{
throw
new
RuntimeException
(
$url
.
' :: '
.
$message
);
});
Class_WebService_SIGB_AbstractService
::
setLogger
(
$logger
);
Class_CommSigb
::
setLogger
(
$logger
);
ZendAfi_Auth
::
getInstance
()
->
logUser
(
$user
);
$this
->
mock_web_client
=
$this
->
mock
();
$sigb_comm
=
$sigb_plage
->
getSIGBComm
();
$sigb_comm
->
setWebClient
(
$this
->
mock_web_client
);
$this
->
mock_web_client
->
whenCalled
(
'open_url'
)
->
with
(
'http://plage.com/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=572&show_contact=1&show_loans=0&show_holds=1'
)
->
answers
(
KohaFixtures
::
xmlGetPatronInfoLaure
())
->
whenCalled
(
'open_url'
)
->
with
(
'http://plage.com/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=572&show_contact=0&show_loans=1&show_holds=0'
)
->
answers
(
KohaFixtures
::
xmlGetPatronInfoLaureLoans
())
->
whenCalled
(
'open_url'
)
->
with
(
'http://plage.com/cgi-bin/koha/rest.pl/user/byid/572/issues_history'
)
->
answers
(
KohaFixtures
::
xmlGetPatronLaureIssuesHistoryError
())
->
beStrict
();
$this
->
dispatch
(
'/opac/abonne/ajax-loans/id/3'
);
}
public
function
tearDown
()
{
Class_CommSigb
::
setLogger
(
null
);
Class_WebService_SIGB_AbstractService
::
setLogger
(
null
);
parent
::
tearDown
();
}
/** @test */
public
function
shouldRenderEmptyBodyWithoutFatalError
()
{
$this
->
assertEmpty
(
$this
->
_response
->
getBody
());
}
}
\ No newline at end of file
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