Skip to content
Snippets Groups Projects
Commit 6bbc0cb6 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #26484 : ilsdi errors translations / text replacements

parent 6f485c6a
Branches
Tags
2 merge requests!955Hotline master,!952Hotline#26484 customize renewal error message
- ticket #26484 : ajout possibilité de traduction / remplacement de textes des messages d'erreurs des connecteurs ILSDI
\ No newline at end of file
......@@ -20,6 +20,8 @@
*/
abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebService_SIGB_AbstractService {
use Trait_Translator;
protected $_server_root;
protected $_web_client;
......@@ -37,7 +39,7 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @return Class_WebService_SIGB_AbstractRESTService
*/
public function setServerRoot($server_root) {
$this->_server_root = 'http://'.str_replace('http://', '', $server_root);
$this->_server_root = 'http://' . str_replace('http://', '', $server_root);
return $this;
}
......@@ -178,7 +180,8 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @return array
*/
public function ilsdiHoldTitle($params, $error_tag = 'error') {
return $this->ilsdiAction('HoldTitle', $params, $error_tag, 'Réservation impossible');
return $this->ilsdiAction('HoldTitle', $params, $error_tag,
$this->_('Réservation impossible'));
}
......@@ -187,7 +190,8 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @return array
*/
public function ilsdiHoldItem($params, $error_tag = 'error') {
return $this->ilsdiAction('HoldItem', $params, $error_tag, 'Réservation impossible');
return $this->ilsdiAction('HoldItem', $params, $error_tag,
$this->_('Réservation impossible'));
}
......@@ -195,7 +199,8 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @param array $params
*/
public function ilsdiCancelHold($params, $error_tag='error') {
return $this->ilsdiAction('CancelHold', $params, $error_tag, 'Annulation impossible');
return $this->ilsdiAction('CancelHold', $params, $error_tag,
$this->_('Annulation impossible'));
}
......@@ -203,7 +208,8 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @param array $params
*/
public function ilsdiRenewLoan($params, $error_tag='error') {
return $this->ilsdiAction('RenewLoan', $params, $error_tag, 'Prolongation impossible');
return $this->ilsdiAction('RenewLoan', $params, $error_tag,
$this->_('Prolongation impossible'));
}
......@@ -211,12 +217,13 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @param string $xml
*/
public function ilsdiUpdatePatronInfo($xml, $error_tag='error'){
return $this->ilsdiCheckXml($xml, $error_tag, 'Mise à jour impossible');
return $this->ilsdiCheckXml($xml, $error_tag,
$this->_('Mise à jour impossible'));
}
public function ilsdiAction($name, $params, $error_tag, $error_message) {
$params = array_merge(array('service' => $name), $params);
$params = array_merge(['service' => $name], $params);
return $this->ilsdiCheckXml($this->httpGet($params), $error_tag, $error_message);
}
......@@ -239,8 +246,6 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
* @return array
*/
protected function _getNetworkError() {
return $this->_error('Service indisponible');
return $this->_error($this->_('Service indisponible'));
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -517,9 +517,10 @@ class AbonneControllerPretsRenewErrorThreePretsTest extends AbonneControllerPret
return $this->mock()
->whenCalled('prolongerPret')
->answers(['statut' => 0,
'erreur' => 'Patron not found']);
'erreur' => '<strong>Patron not found</strong>']);
}
/** @test */
public function popupTitleShouldBeErreur() {
$this->assertEquals('Erreur', $this->json->title);
......@@ -528,7 +529,7 @@ class AbonneControllerPretsRenewErrorThreePretsTest extends AbonneControllerPret
/** @test */
public function popupContentShouldContainsPatronNotFound() {
$this->assertEquals('Patron not found', $this->json->content);
$this->assertEquals('<strong>Patron not found</strong>', $this->json->content);
}
}
......
This diff is collapsed.
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