Commit a0a81d97 authored by Laurent's avatar Laurent

hotline #113526 Dynix : library mails now configurable

parent 95d1bd15
Pipeline #10511 passed with stage
in 51 minutes and 38 seconds
- ticket #113526 : SIGB Dynix : Cosmogramme : rend disponible la configuration des mails à envoyer aux différentes bibliothèques lors de la réservation d'un documente disponible
\ No newline at end of file
......@@ -157,7 +157,12 @@ function getBlocsParams($id_bib, $type, $valeurs) {
$champs_params[0] = ['url_serveur', 'catalogue_web', 'reserver_retrait_bib_abonne'];
if ($clef == Class_IntBib::COM_DYNIX)
$champs_params[0] = ['url_serveur', 'client_id'];
$champs_params[0] = ['url_serveur',
'client_id',
['mails_bib' => function($id, $valeur)
{
return getTextArea($id, $valeur, 60, 20);
}]];
if ($clef == Class_IntBib::COM_Z3950)
$champs_params[0] = ['url_serveur', 'login', 'password', 'nom_base'];
......
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_SIGB_Abstract {
protected static $service;
......@@ -40,5 +40,16 @@ class Class_WebService_SIGB_Abstract {
public static function reset() {
static::$service = null;
}
public static function decodeMapping($str_codif) {
$codifs = [];
$lines = array_filter(explode("\n", trim($str_codif)));
foreach($lines as $line) {
$code_libelle = explode(':', $line);
$codifs[trim($code_libelle[0])] = trim($code_libelle[1]);
}
return $codifs;
}
}
?>
\ No newline at end of file
......@@ -16,11 +16,13 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_SIGB_Dynix extends Class_WebService_SIGB_Abstract {
public static function getService($params){
return parent::getService($params)->setClientId($params['client_id']);
return parent::getService($params)
->setClientId($params['client_id'])
->setMailsBib(static::decodeMapping($params['mails_bib']));
}
}
......
......@@ -20,21 +20,8 @@
*/
class Class_Webservice_SIGB_Dynix_Service extends Class_WebService_SIGB_AbstractRESTService {
protected $_client_id;
protected $_mail_bib = [
'ALFAX1'=>'bibliotheque.alfortville.annexe@agglo-plainecentrale94.fr',
'ALFMEDA'=>'malfortville@agglo-plainecentrale94.fr',
'CRETBLE'=>'biblibleuets@agglo-plainecentrale94.fr',
'CRETMES'=>'bibliotheque.creteil.biblimesly@agglo-plainecentrale94.fr',
'CRETBUS'=>'bibliotheque.creteil.bibliobus@agglo-plainecentrale94.fr',
'CRETMEC'=>'bibliotheque.creteil.meches@agglo-plainecentrale94.fr',
'CRETDOY'=>'mediatheque.creteil.abbaye@agglo-plainecentrale94.fr',
'ENMDAD'=>'',
'CRETHAB'=>'medialudo.creteil@gpsea.fr',
'CRETMAC'=>'mediabus@gpsea.fr',
'CRETMUL'=>'',
'CRETRES'=>'bibliotheque.creteil.servicesinternes@agglo-plainecentrale94.fr',
'CRETVIL'=>'mediatheque.creteil.village@agglo-plainecentrale94.fr',
'LB'=>'bibliotheque.limeilbrevannes@agglo-plainecentrale94.fr'];
protected $_mail_bib = [];
/**
* @param string $server_root
......@@ -47,6 +34,12 @@ class Class_Webservice_SIGB_Dynix_Service extends Class_WebService_SIGB_Abstract
}
public function setMailsBib($mails_bib) {
$this->_mail_bib = $mails_bib;
return $this;
}
public function setClientId($client_id) {
$this->_client_id = $client_id;
return $this;
......
......@@ -50,8 +50,8 @@ class Class_WebService_SIGB_Koha {
$service = $service_class::getService($params);
$service
->setCodificationDisponibilites(static::decodeMapping($params['Codification_disponibilites']))
->setWithdrawnMapping(static::decodeMapping($params['withdrawn_mapping']))
->setCodificationDisponibilites(Class_WebService_SIGB_Abstract::decodeMapping($params['Codification_disponibilites']))
->setWithdrawnMapping(Class_WebService_SIGB_Abstract::decodeMapping($params['withdrawn_mapping']))
->setGroupedHoldsITypes(array_filter(explode("\n", $params['grouped_holds_itypes'])))
->setBundledHoldsMinimalDuration($params['bundled_holds_minimal_duration'])
->setBundledHoldsMaximalDuration($params['bundled_holds_maximal_duration']);;
......@@ -63,17 +63,6 @@ class Class_WebService_SIGB_Koha {
}
public static function decodeMapping($str_codif) {
$codifs = [];
$lines = array_filter(explode("\n", trim($str_codif)));
foreach($lines as $line) {
$code_libelle = explode(':', $line);
$codifs[trim($code_libelle[0])] = trim($code_libelle[1]);
}
return $codifs;
}
public static function setService($params, $service) {
static::$services[static::makeKey($params)] = $service;
}
......
......@@ -674,7 +674,8 @@ class CommSigbDynixTest extends CommSigbTestCase {
$this->bib_pc94 = Class_IntBib::newInstanceWithId(5)
->setCommParams(["url_serveur" => 'http://www.dynix.fr:8080/capcvm/',
'client_id' => 'SymWS'])
'client_id' => 'SymWS',
'mails_bib' => 'ALFA:alfa@here.fr'])
->setCommSigb(11);
Class_WebService_SIGB_Dynix::setService($this->createMockForService('Dynix'));
......@@ -683,6 +684,11 @@ class CommSigbDynixTest extends CommSigbTestCase {
->expects($this->any())
->method('setClientId')
->will($this->returnValue($this->mock_service));
$this->mock_service
->expects($this->any())
->method('setMailsBib')
->will($this->returnValue($this->mock_service));
}
......@@ -691,7 +697,8 @@ class CommSigbDynixTest extends CommSigbTestCase {
$this->assertEquals(["url_serveur" => 'http://www.dynix.fr:8080/capcvm/',
"type" => Class_IntBib::COM_DYNIX,
'client_id' => 'SymWS',
'id_bib' => 5],
'id_bib' => 5,
'mails_bib' => 'ALFA:alfa@here.fr'],
$this->bib_pc94->getModeComm(5));
}
}
......
......@@ -27,7 +27,8 @@ class DynixGetServiceTest extends ModelTestCase {
public function setUp() {
Class_WebService_SIGB_Dynix::reset();
$this->_service = Class_WebService_SIGB_Dynix::getService(['url_serveur' => 'http://www.infocom94.fr:8080/capcvm/',
'client_id' => 'myid']);
'client_id' => 'myid',
'mails_bib' => "CRETBUS:mediatheque.creteil.bibliobus@gpsea.fr\nALFMEDA:malfortville@agglo-plainecentrale94.fr"]);
}
......@@ -58,7 +59,8 @@ abstract class DynixTestCase extends ModelTestCase {
Class_WebService_SIGB_Dynix::setService(null);
$this->_service = Class_WebService_SIGB_Dynix
::getService(['url_serveur' => 'http://www.infocom94.fr:8080/capcvm/',
'client_id' => 'SymWS'])
'client_id' => 'SymWS',
'mails_bib' => "CRETBUS:mediatheque.creteil.bibliobus@gpsea.fr\nALFMEDA:malfortville@agglo-plainecentrale94.fr"])
->setWebClient($this->_mock_web_client);
......@@ -638,7 +640,8 @@ class DynixAuthenticateManuLarcinetTest extends DynixTestCase {
['id' => 94,
'comm_sigb' => Class_IntBib::COM_DYNIX,
'comm_params' => ['url_serveur' => 'http://www.infocom94.fr:8080/capcvm/',
'client_id' => 'SymWS']]);
'client_id' => 'SymWS',
'mails_bib' => '']]);
ZendAfi_Auth::getInstance()->authenticateLoginPassword('0917036', 'secret');
}
......
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