Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
opacce
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fleurant Ylan
opacce
Commits
cd891ae4
Commit
cd891ae4
authored
May 16, 2019
by
Laurent
Committed by
Patrick Barroca
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hotline #92518 PMB : display renew loan error messages
parent
a10b3550
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
92518
VERSIONS_HOTLINE/92518
+1
-0
Service.php
library/Class/WebService/SIGB/PMB/Service.php
+15
-9
PMBTest.php
tests/library/Class/WebService/SIGB/PMBTest.php
+9
-5
No files found.
VERSIONS_HOTLINE/92518
0 → 100644
View file @
cd891ae4
- ticket #92518 : SIGB PMB : correction de l'affichage des messages d'erreur de prolongation
\ No newline at end of file
library/Class/WebService/SIGB/PMB/Service.php
View file @
cd891ae4
...
@@ -88,13 +88,13 @@ class Class_Webservice_SIGB_PMB_Service extends Class_WebService_SIGB_AbstractSe
...
@@ -88,13 +88,13 @@ class Class_Webservice_SIGB_PMB_Service extends Class_WebService_SIGB_AbstractSe
$exemplaire
->
getIdOrigine
()]);
$exemplaire
->
getIdOrigine
()]);
$result
=
(
array
)
$this
->
_getJsonData
(
$json
,
'result'
);
$result
=
(
array
)
$this
->
_getJsonData
(
$json
,
'result'
);
if
(
!
$result
)
if
(
!
$result
)
return
[
'status'
=>
false
,
'erreur'
=>
$this
->
_
(
'Réservation impossible : le service de réservation PMB via webservice est indisponible'
)]
;
return
$this
->
_error
(
$this
->
_
(
'Réservation impossible : le service de réservation PMB via webservice est indisponible'
))
;
if
(
isset
(
$result
[
'error'
]))
if
(
isset
(
$result
[
'error'
]))
return
[
'status'
=>
false
,
'erreur'
=>
$this
->
_
(
'Réservation impossible : Vous avez déjà réservé cette exemplaire'
)]
;
return
$this
->
_error
(
$this
->
_
(
'Réservation impossible : Vous avez déjà réservé cette exemplaire'
))
;
return
true
;
return
$this
->
_success
()
;
}
}
...
@@ -102,16 +102,23 @@ class Class_Webservice_SIGB_PMB_Service extends Class_WebService_SIGB_AbstractSe
...
@@ -102,16 +102,23 @@ class Class_Webservice_SIGB_PMB_Service extends Class_WebService_SIGB_AbstractSe
$session_token
=
$this
->
openSessionForUser
(
$user
);
$session_token
=
$this
->
openSessionForUser
(
$user
);
$json
=
$this
->
httpPost
(
'pmbesOPACEmpr_delete_resa'
,
[
$session_token
,
$json
=
$this
->
httpPost
(
'pmbesOPACEmpr_delete_resa'
,
[
$session_token
,
$reservation_id
]);
$reservation_id
]);
return
true
;
return
$this
->
_success
()
;
}
}
public
function
prolongerPret
(
$user
,
$pret_id
)
{
public
function
prolongerPret
(
$user
,
$pret_id
)
{
$session_token
=
$this
->
openSessionForUser
(
$user
);
$session_token
=
$this
->
openSessionForUser
(
$user
);
if
(
!
$json
=
$this
->
httpPost
(
'pmbesSelfServices_self_renew'
,
[
$session_token
,
$pret_id
]))
if
((
!
$json
=
$this
->
httpPost
(
'pmbesSelfServices_self_renew'
,
[
$session_token
,
$pret_id
]))
return
[
'statut'
=>
false
,
'erreur'
=>
$this
->
_
(
'Prolongation impossible : le service de prolongation PMB via webservice est indisponible'
)];
||
(
!
$result
=
json_decode
(
$json
,
true
)))
return
$this
->
_error
(
$this
->
_
(
'Prolongation impossible : le service de prolongation PMB via webservice est indisponible'
));
return
true
;
if
(
array_key_exists
(
'result'
,
$result
)
&&
is_array
(
$result
[
'result'
])
&&
array_key_exists
(
'message'
,
$result
[
'result'
])
&&
$message
=
$result
[
'result'
][
'message'
])
return
$this
->
_error
(
$message
);
return
$this
->
_success
();
}
}
...
@@ -339,4 +346,3 @@ class JsonWebClient {
...
@@ -339,4 +346,3 @@ class JsonWebClient {
}
}
}
}
?>
\ No newline at end of file
tests/library/Class/WebService/SIGB/PMBTest.php
View file @
cd891ae4
...
@@ -54,7 +54,7 @@ abstract class PMBTestCase extends ModelTestCase {
...
@@ -54,7 +54,7 @@ abstract class PMBTestCase extends ModelTestCase {
->
whenCalled
(
'httpPost'
)
->
whenCalled
(
'httpPost'
)
->
with
(
'pmbesSelfServices_self_renew'
,
[
'faf3404e9d51b48e47745556789b55401'
,
15
])
->
with
(
'pmbesSelfServices_self_renew'
,
[
'faf3404e9d51b48e47745556789b55401'
,
15
])
->
answers
(
null
)
->
answers
(
'{"id":1,"result":{"status":1,"message":"Prolongation non activ\u00e9e","transaction_date":"20190516 164241","title":"7d918cd04e21cb62d886dea49a6b711314","due_date":"20190516 164241"},"error":null}'
)
->
whenCalled
(
'httpPost'
)
->
whenCalled
(
'httpPost'
)
->
with
(
'pmbesOPACEmpr_add_resa'
,
[
'faf3404e9d51b48e47745556789b55401'
,
'456789'
])
->
with
(
'pmbesOPACEmpr_add_resa'
,
[
'faf3404e9d51b48e47745556789b55401'
,
'456789'
])
...
@@ -209,19 +209,23 @@ class PMBServiceTest extends PMBTestCase {
...
@@ -209,19 +209,23 @@ class PMBServiceTest extends PMBTestCase {
/** @test */
/** @test */
public
function
renewLoansShouldReturnError
()
{
public
function
renewLoansShouldReturnMessageProlongationNonActive
()
{
$this
->
assertContains
(
false
,
$this
->
_service
->
prolongerPret
(
$this
->
_paul
,
15
));
$this
->
assertEquals
([
'statut'
=>
false
,
'erreur'
=>
'Prolongation non activée'
],
$this
->
_service
->
prolongerPret
(
$this
->
_paul
,
15
));
}
}
/** @test */
/** @test */
public
function
bookingItemShouldReturnSuccess
()
{
public
function
bookingItemShouldReturnSuccess
()
{
$this
->
assertTrue
(
$this
->
_service
->
reserverExemplaire
(
$this
->
_paul
,
$this
->
_le_kiosque
,
'000018'
));
$this
->
assertEquals
([
'statut'
=>
true
,
'erreur'
=>
''
],
$this
->
_service
->
reserverExemplaire
(
$this
->
_paul
,
$this
->
_le_kiosque
,
'000018'
));
}
}
/** @test */
/** @test */
public
function
cancelBookingShouldReturnSuccess
()
{
public
function
cancelBookingShouldReturnSuccess
()
{
$this
->
assertTrue
(
$this
->
_service
->
supprimerReservation
(
$this
->
_paul
,
456
));
$this
->
assertEquals
([
'statut'
=>
true
,
'erreur'
=>
''
],
$this
->
_service
->
supprimerReservation
(
$this
->
_paul
,
456
));
}
}
}
}
\ 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