diff --git a/VERSIONS b/VERSIONS index 91cb8c9324a2d7076cdf2dce6496483f2f7dcb8f..580f157871c2078d80836ff543ae33ee504a8c58 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,12 @@ +27/11/2015 - v7.3.32 + + - ticket #33756 : Cosmogramme : correction de la prise en charge de webservices en https + + - ticket #33429 : Cosmogramme : correction de la génération de vignettes des pseudo-notices dans le contexte de l'intégration automatique + + - ticket #33773 : VSmart: correction de l'impossibilité de se connecter au compte lecteur lorsqu'une consultation est reservée + + 26/11/2015 - v7.3.31 - ticket #33501 : Cosmogramme: amélioration des intégrations automatiques diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 2d5d9a3853e85bf212f1e97ae497a7324af43d8b..8495ddf1c0d53b7e2361ffa71fdcda4923b10e59 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -137,12 +137,14 @@ class Class_Profil extends Storm_Model_Abstract { * @return Class_Profil */ public static function getCurrentProfil() { - if (!isset(self::$_current_profil)) { - if (!$id_profil = Zend_Registry::get('session')->id_profil) - $id_profil = 1; - self::$_current_profil = self::getLoader()->find($id_profil); - } - return self::$_current_profil; + if (isset(self::$_current_profil)) + return self::$_current_profil; + + if (!Zend_Registry::isRegistered('session') + || (!$id_profil = Zend_Registry::get('session')->id_profil)) + $id_profil = 1; + + return self::$_current_profil = self::getLoader()->find($id_profil); } diff --git a/library/Class/WebService/SIGB/AbstractRESTService.php b/library/Class/WebService/SIGB/AbstractRESTService.php index 1303ebb6ebac571764193cc3bbe0ba4201af0624..857648b26603573f365e4efc3bc6b9bfe319fac9 100644 --- a/library/Class/WebService/SIGB/AbstractRESTService.php +++ b/library/Class/WebService/SIGB/AbstractRESTService.php @@ -37,10 +37,18 @@ 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 = $this->_withProtocol($server_root); return $this; } + + protected function _withProtocol($url) { + return ('http://' == substr($url, 0, 7) || 'https://' == substr($url, 0, 8) + ? '' : 'http://') + . $url; + } + + /** * @return string */ diff --git a/library/Class/WebService/SIGB/VSmart/BorrowerReader.php b/library/Class/WebService/SIGB/VSmart/BorrowerReader.php index fe701a3c069281472a3d4c2207347cceedcd2c9d..77d0a507194ae430cdec729224a9ef99006a7c93 100644 --- a/library/Class/WebService/SIGB/VSmart/BorrowerReader.php +++ b/library/Class/WebService/SIGB/VSmart/BorrowerReader.php @@ -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_VSmart_BorrowerReader { @@ -27,7 +27,7 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { protected $_sigb_service; protected $_xml_parser; - + protected $_current_exemplaire_operation; /** * @@ -110,11 +110,17 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { } + public function endReservation() { + $this->_current_exemplaire_operation = null; + } + + /** * @param string $data */ public function endLoan($data) { $this->_emprunteur->empruntsAdd($this->_current_exemplaire_operation); + $this->_current_exemplaire_operation = null; } @@ -130,7 +136,8 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { * @param string $data */ public function endTitle($data) { - $this->_current_exemplaire_operation->getExemplaire()->setTitre($data); + if ($this->_current_exemplaire_operation) + $this->_current_exemplaire_operation->getExemplaire()->setTitre($data); } @@ -138,7 +145,8 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { * @param string $data */ public function endDueDate($data) { - $this->_current_exemplaire_operation->setDateRetour($data); + if ($this->_current_exemplaire_operation) + $this->_current_exemplaire_operation->setDateRetour($data); } @@ -146,10 +154,11 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { * @param string $data */ public function endItemBarcode($data) { - $this->_current_exemplaire_operation->setId($data) - ->getExemplaire() - ->setId($data) - ->setCodeBarre($data); + if ($this->_current_exemplaire_operation) + $this->_current_exemplaire_operation->setId($data) + ->getExemplaire() + ->setId($data) + ->setCodeBarre($data); } @@ -157,7 +166,8 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { * @param string $data */ public function endPlaceInQueue($data) { - $this->_current_exemplaire_operation->setRang($data); + if ($this->_current_exemplaire_operation) + $this->_current_exemplaire_operation->setRang($data); } @@ -165,7 +175,8 @@ class Class_WebService_SIGB_VSmart_BorrowerReader { * @param string $data */ public function endReservationNumber($data) { - $this->_current_exemplaire_operation->setId($data); + if ($this->_current_exemplaire_operation) + $this->_current_exemplaire_operation->setId($data); } diff --git a/library/startup.php b/library/startup.php index 16e300713d578f990c6b871638ec210caf437159..4c441d2789b529950563319cc9fb4348a77a097f 100644 --- a/library/startup.php +++ b/library/startup.php @@ -64,7 +64,7 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.3'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.31'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.32'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php index 4e4f13d2f671dbc7aa1ab1512dc21a722b97c64f..4e90e0d108410b19dd2f8f1573bbe276202c9082 100644 --- a/tests/library/Class/ProfilTest.php +++ b/tests/library/Class/ProfilTest.php @@ -20,6 +20,8 @@ */ class ProfilVideTest extends ModelTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setup(); $this->profil_vide = new Class_Profil(); @@ -58,7 +60,7 @@ class ProfilVideTest extends ModelTestCase { public function profilZonesTitreShouldReturn200_E_H_I() { $this->assertEquals( ['200$e', '200$h', '200$i'], - Class_Profil::getCurrentProfil()->getZonesTitre()); + $this->profil_vide->getZonesTitre()); } @@ -71,6 +73,8 @@ class ProfilVideTest extends ModelTestCase { class ProfilJeunesseAstrolabeTest extends ModelTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { $this->fixture('Class_AdminVar', ['clef' => 'NOM_DOMAINE', 'id' => 'NOM_DOMAINE', @@ -81,77 +85,65 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { 'preferences' => []]], 'options' => []]; - $this->profil_astro = Class_Profil::getLoader() - ->newInstanceWithId(7) - ->setIdSite(12) - ->setLibelle("Jeunesse") - ->setSkin('astrolabe') - ->setCfgMenus(array()) - ->setHeaderCss('afi-opac3/userfiles/jeunesse.css') - ->setCfgAccueil($cfg_accueil); + $this->profil_astro = $this->fixture('Class_Profil', + ['id' => 7, + 'id_site' => 12, + 'libelle' => 'Jeunesse', + 'skin' => 'astrolabe', + 'cfg_menus' => [], + 'header_css' => 'afi-opac3/userfiles/jeunesse.css', + 'cfg_accueil' => $cfg_accueil]); - $this->bib_melun = Class_Bib::getLoader() - ->newInstanceWithId(12) - ->setLibelle('Melun'); + $this->bib_melun = $this->fixture('Class_Bib', + ['id' => 12, + 'libelle' => 'Melun']); + $this->onLoaderOfModel('Class_Profil') + ->whenCalled('findAllBy') + ->answers([]); - Storm_Test_ObjectWrapper - ::onLoaderOfModel('Class_Profil') - ->whenCalled('findAllBy') - ->answers(array()); - - Class_Profil::setFileWriter(Storm_Test_ObjectWrapper::mock()->whenCalled('fileExists')->answers(true)); + Class_Profil::setFileWriter($this->mock()->whenCalled('fileExists')->answers(true)); } /** @test */ public function profilUrlShouldReturnBokehDotOrg() { - $this->assertEquals('http://bokeh.org/index/index?id_profil=7', Class_Profil::find(7)->getUrl()); + $this->assertEquals('http://bokeh.org/index/index?id_profil=7', + Class_Profil::find(7)->getUrl()); } /** @test */ public function getCfgMenuAsArrayShouldReturnDefaultMenus() { - $this->assertEquals(array( - 'H' => array( - "libelle" => "Menu horizontal", - "picto" => "vide.gif", - 'menus' => array()), - 'V' => array( - "libelle" => "Menu vertical", - "picto" => "vide.gif", - 'menus' => array())), + $this->assertEquals(['H' => ["libelle" => "Menu horizontal", + "picto" => "vide.gif", + 'menus' => []], + 'V' => ["libelle" => "Menu vertical", + "picto" => "vide.gif", + 'menus' => []]], $this->profil_astro->getCfgMenusAsArray()); } /** @test */ public function shouldAddMenuHorizontalIfNotExists() { - $this->profil_astro->setCfgMenus( array( - 'V' => array( - "libelle" => "Les news", - "picto" => "home.gif", - "menus" => array()), - - '4' => array( - "libelle" => "Mon menu", - "picto" => "home.png", - "menus" => array()))); - - $this->assertEquals(array( - 'H' => array( - "libelle" => "Menu horizontal", - "picto" => "vide.gif", - "menus" => array()), - 'V' => array( - "libelle" => "Les news", - "picto" => "home.gif", - "menus" => array()), - - '4' => array( - "libelle" => "Mon menu", - "picto" => "home.png", - "menus" => array())), + $this->profil_astro + ->setCfgMenus(['V' => ["libelle" => "Les news", + "picto" => "home.gif", + "menus" => []], + '4' => ["libelle" => "Mon menu", + "picto" => "home.png", + "menus" => []]]); + + $this->assertEquals(['H' => ["libelle" => "Menu horizontal", + "picto" => "vide.gif", + "menus" => []], + 'V' => ["libelle" => "Les news", + "picto" => "home.gif", + "menus" => []], + '4' => ["libelle" => "Mon menu", + "picto" => "home.png", + "menus" => []]], $this->profil_astro->getCfgMenusAsArray()); } @@ -165,7 +157,8 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function astroHeaderCssShouldBeJeunesse() { - $this->assertEquals('afi-opac3/userfiles/jeunesse.css', $this->profil_astro->getHeaderCss()); + $this->assertEquals('afi-opac3/userfiles/jeunesse.css', + $this->profil_astro->getHeaderCss()); } @@ -232,7 +225,7 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function toArrayShouldContainsTitreSiteMediathequeAstrolabe() { $attributes = $this->profil_astro->toArray(); - $this->assertEquals("", $attributes['titre_site']); + $this->assertEquals('', $attributes['titre_site']); } @@ -280,7 +273,7 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function updateAttributesWithBoiteLoginTrueShouldAddIt() { - $this->profil_astro->updateAttributes(array('boite_login_in_banniere' => true)); + $this->profil_astro->updateAttributes(['boite_login_in_banniere' => true]); $this->assertTrue($this->profil_astro->getBoiteLoginInBanniere()); } @@ -293,19 +286,14 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function getSubProfilsShouldReturnEmptyArray() { - $this->assertEquals(array(), - $this->profil_astro->getSubProfils()); - return Class_Profil::getLoader(); - + $this->assertEquals([], $this->profil_astro->getSubProfils()); } - /** - * @depends getSubProfilsShouldReturnEmptyArray - * @test - */ - public function profilLoaderShouldHaveFindAllByCalledWithParentIdOfAstrolabe($loader) { - $param = $loader->getFirstAttributeForLastCallOn('findAllBy'); + /** @test */ + public function profilLoaderShouldHaveFindAllByCalledWithParentIdOfAstrolabe() { + $this->profil_astro->getSubProfils(); + $param = Class_Profil::getFirstAttributeForLastCallOn('findAllBy'); $this->assertEquals('parent_profil', $param['role']); $this->assertEquals($this->profil_astro->toArray(), @@ -323,7 +311,8 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { -class PageBdAstrolabeTest extends Storm_Test_ModelTestCase { +class PageBdAstrolabeTest extends ModelTestCase { + protected $_storm_default_to_volatile = true; protected $page_bd; protected $profil_astro; protected $bib_melun; @@ -340,38 +329,33 @@ class PageBdAstrolabeTest extends Storm_Test_ModelTestCase { 'preferences' => ['titre'=>'Connection']]], 'options' => []]; - $this->profil_astro = Class_Profil::getLoader() - ->newInstanceWithId(7) - ->setIdSite(12) - ->setLibelle("Jeunesse") - ->setSkin('astrolabe') - ->setCfgMenus(array()) - ->setHeaderCss('afi-opac3/userfiles/jeunesse.css') - ->setCfgAccueil($cfg_accueil); - - $this->bib_melun = Class_Bib::getLoader() - ->newInstanceWithId(12) - ->setLibelle('Melun'); - - Storm_Test_ObjectWrapper - ::onLoaderOfModel('Class_Profil') - ->whenCalled('findAllBy') - ->answers(array()); - - Class_Profil::setFileWriter( - Storm_Test_ObjectWrapper::mock() - ->whenCalled('fileExists') - ->answers(true)); - - $this->page_bd = Class_Profil::getLoader() - ->newInstanceWithId(6, - ['parent_id' => $this->profil_astro->getId(), - 'id_site' => 12, - 'libelle' => 'Bdd', - 'cfg_menus' => [], - 'cfg_accueil' => [], - 'page_css' => 'afi-opac3/userfiles/bd_jeunesse.css']); - + $this->profil_astro = $this->fixture('Class_Profil', + ['id' => 7, + 'id_site' => 12, + 'libelle' => 'Jeunesse', + 'skin' => 'astrolabe', + 'cfg_menus' => [], + 'header_css' => 'afi-opac3/userfiles/jeunesse.css', + 'cfg_accueil' => $cfg_accueil]); + + $this->bib_melun = $this->fixture('Class_Bib', + ['id' => 12, + 'libelle' => 'Melun']); + + $this->onLoaderOfModel('Class_Profil') + ->whenCalled('findAllBy') + ->answers([]); + + Class_Profil::setFileWriter($this->mock()->whenCalled('fileExists')->answers(true)); + + $this->page_bd = $this->fixture('Class_Profil', + ['id' => 6, + 'parent_id' => $this->profil_astro->getId(), + 'id_site' => 12, + 'libelle' => 'Bdd', + 'cfg_menus' => [], + 'cfg_accueil' => [], + 'page_css' => 'afi-opac3/userfiles/bd_jeunesse.css',]); $this->profil_astro->setSubProfils([$this->page_bd]); } @@ -1601,8 +1585,4 @@ class ProfilIsPortalTest extends Storm_Test_ModelTestCase { public function profilWithIdSevenStringShouldNotBePortal() { $this->assertFalse($this->fixture('Class_Profil', ['id' => '7'])->isPortail()); } - -} - - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/tests/library/Class/WebService/SIGB/VSmartFixtures.php b/tests/library/Class/WebService/SIGB/VSmartFixtures.php index 5dce65080cb2eddc909fb42b9375baf294bfb790..81f395920a77246aadbcc306acfb1cd14d00df66 100644 --- a/tests/library/Class/WebService/SIGB/VSmartFixtures.php +++ b/tests/library/Class/WebService/SIGB/VSmartFixtures.php @@ -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 VSmartFixtures { @@ -178,7 +178,20 @@ class VSmartFixtures { </Items> </Reservation> </Reservations> - <StackRequests /> + <StackRequests> + <StackRequest> + <RequestNumber>DC00001093</RequestNumber> + <Status>Active</Status> + <RequestDateTime>26/11/2015 12:14:27</RequestDateTime> + <ExpiryDateTime>24/02/2016 23:59:00</ExpiryDateTime> + <Delivery>Liv</Delivery> + <HeldItem>RES_MCP271095</HeldItem> + <RecordId>1.179920</RecordId> + <Title>A Moulins...le marché cou</Title> + <MaterialType>LDA</MaterialType> + <MaterialType>LDA</MaterialType> + </StackRequest> + </StackRequests> </Borrower> </VubisSmart>'; }