diff --git a/VERSIONS b/VERSIONS index 0947e1f2f8f80503b3c5d1587af44347dbcb3617..834625501df446388e8a9be2b5746b1cd4db845c 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,13 @@ +25/02/2016 - v7.5.13 + + - ticket #39088 : Administration : Correction de l'affichage des listes de cases à cocher dans la nouvelle skin 7.4 + + - ticket #38236 : Administration : Correction du selecteur de Territoire dans la fiche Bibliothèque + + - ticket #37078 : Cosmogramme : Correction du chemin de fichier lors de la génération de site Nanook/Pergame + + + 22/02/2016 - v7.5.12 - ticket #37996 : Premier chapitre : correction de l'image ancrable dans la liste de résultats et la vue notice diff --git a/VERSIONS_HOTLINE/39088 b/VERSIONS_HOTLINE/39088 deleted file mode 100644 index 5bfccd5e498b07e556281782a4a35a410ce2f49d..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/39088 +++ /dev/null @@ -1 +0,0 @@ - - ticket #39088 : Administration : Correction de l'affichage des listes de cases à cocher dans la nouvelle skin 7.4 \ No newline at end of file diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/IntegrationControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/IntegrationControllerTest.php index ddf0d1d9dcac6be17e10aeb3cd54a062fd888c16..a334c238a5deaddfe529ad44ddd1ebd92e7adf0c 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/IntegrationControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/IntegrationControllerTest.php @@ -170,7 +170,7 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo $subdir_calls = 0; $subdir_provider = function() use (&$subdir_calls) { $subdir_calls++; - $mapping = [1 => '.', 2 => '..', 3 => 'library1', 4 => 'test']; + $mapping = [1 => '.', 2 => '..', 3 => 'library', 4 => 'test']; return array_key_exists($subdir_calls, $mapping) ? $mapping[$subdir_calls] : false; }; @@ -184,43 +184,43 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo ->whenCalled('readdir')->with(true) ->willDo($subdir_provider) - ->whenCalled('is_dir')->with('../ftp/transfert/library1') + ->whenCalled('is_dir')->with('../ftp/transfert/library') ->answers(true) ->whenCalled('is_readable') - ->with('../ftp/transfert/library1/etalon') + ->with('../ftp/transfert/library/etalon') ->answers(true) ->whenCalled('is_readable') - ->with('../ftp/transfert/library1/etalon/annexes.txt') + ->with('../ftp/transfert/library/etalon/annexes.txt') ->answers(true) ->whenCalled('is_readable') - ->with('../ftp/transfert/library1/etalon/genres.txt') + ->with('../ftp/transfert/library/etalon/genres.txt') ->answers(true) ->whenCalled('is_readable') - ->with('../ftp/transfert/library1/etalon/sections.txt') + ->with('../ftp/transfert/library/etalon/sections.txt') ->answers(true) ->whenCalled('is_readable') - ->with('../ftp/transfert/library1/etalon/emplacements.txt') + ->with('../ftp/transfert/library/etalon/emplacements.txt') ->answers(true) ->whenCalled('file') - ->with('../ftp/transfert/library1/etalon/annexes.txt') + ->with('../ftp/transfert/library/etalon/annexes.txt') ->answers(['BIB_SPS_UTT|ID_SITE|LIBELLE', '20|library1', '12|library2']) ->whenCalled('file') - ->with('../ftp/transfert/library1/etalon/sections.txt') + ->with('../ftp/transfert/library/etalon/sections.txt') ->answers(['BIB_C_SECTION|CODE|LIBELLE', '1|Adulte', '2|Jeunesse']) ->whenCalled('file') - ->with('../ftp/transfert/library1/etalon/emplacements.txt') + ->with('../ftp/transfert/library/etalon/emplacements.txt') ->answers(['BIB_C_EMPLACEMENT|CODE|LIBELLE', '4|Coin des tout-petits', '5|Livres CD', @@ -228,7 +228,7 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo '7|Albums']) ->whenCalled('file') - ->with('../ftp/transfert/library1/etalon/genres.txt') + ->with('../ftp/transfert/library/etalon/genres.txt') ->answers(['BIB_GENRES|SUPPORT|CODE|LIBELLE|DOC', '0|1|Album|f', '0|2|Bande dessinée|f', @@ -269,7 +269,7 @@ class Cosmo_IntegrationControllerGenerateActionTest extends Cosmo_IntegrationCon /** @test */ public function library1ShouldBeSelectable() { - $this->assertXPath('//select[@name="path_ftp"]//option[@value="library1"]'); + $this->assertXPath('//select[@name="path_ftp"]//option[@value="library"]'); } @@ -321,12 +321,14 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest 'libelle' => 'Abonné Nanook', 'type_fichier' => 1]); + $this->_setupExistingDeletedBib(); + $time_source = $this->mock()->whenCalled('time')->answers(strtotime('2016-01-28')); Class_Cosmogramme_Generator::setTimeSource($time_source); Class_Cosmogramme_Generator_AbstractTask::setTimeSource($time_source); $this->postDispatch('cosmo/integration/generate', - ['path_ftp' => 'library1', + ['path_ftp' => 'library', 'type_sigb' => 13, 'service_nanook' => 'http://nanook-ws.net/ilsdi/', 'creer_annexes' => 1, @@ -334,6 +336,26 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest } + protected function _setupExistingDeletedBib() { + $lib = $this->fixture('Class_IntBib', + ['id_bib' => 6, + 'nom' => 'Existing deleted', + 'nom_court' => 'Deleted', + 'qualite' => 5, + 'sigb' => Class_IntBib::SIGB_NANOOK, + 'planif_mode' => 'r', + 'planif_jours' => '1111111', + 'comm_sigb' => Class_IntBib::COM_NANOOK]); + + $this->fixture('Class_IntMajAuto', + ['id_bib' => 20, + 'profil' => 103, + 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, + 'nom_fichier' => 'library/site6/reservations.txt']); + + } + + public function tearDown() { Class_Cosmogramme_Generator::setTimeSource(null); Class_Cosmogramme_Generator_AbstractTask::setTimeSource(null); @@ -365,11 +387,23 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest } + /** @test */ + public function shouldHaveDisabledExistingDeletedLibrary() { + $this->assertTrue(Class_IntBib::find(6)->isDisconnected()); + } + + + /** @test */ + public function shouldHaveDeletedExistingDeletedPlannedIntegrations() { + $this->assertEmpty(Class_IntMajAuto::findAllBy(['id_bib' => 6])); + } + + /** @test */ public function library1ShouldBeCreated() { $this->assertNotNull(Class_Bib::findFirstBy(['id_site' => 20, 'libelle' => 'library1', - 'ville' => 'library1', + 'ville' => 'library', 'id_zone' => 1, 'visibilite' => Class_Bib::V_DATA]), $this->_response->getBody()); @@ -426,7 +460,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest 'rang' => 2001, 'profil' => $profile->getId(), 'type_operation' => Class_IntMajAuto::OP_ITEMS_DELETION, - 'nom_fichier' => 'library1/site20/suppressions.txt'])); + 'nom_fichier' => 'library/site20/suppressions.txt'])); } @@ -435,7 +469,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => 104, 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, - 'nom_fichier' => 'library1/site20/notices_total.txt'])); + 'nom_fichier' => 'library/site20/notices_total.txt'])); } @@ -444,7 +478,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => 104, 'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT, - 'nom_fichier' => 'library1/site20/notices.txt'])); + 'nom_fichier' => 'library/site20/notices.txt'])); } @@ -453,7 +487,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => 105, 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, - 'nom_fichier' => 'library1/site20/abonnes.txt'])); + 'nom_fichier' => 'library/site20/abonnes.txt'])); } @@ -462,7 +496,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => 102, 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, - 'nom_fichier' => 'library1/site20/prets.txt'])); + 'nom_fichier' => 'library/site20/prets.txt'])); } @@ -471,7 +505,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => 103, 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, - 'nom_fichier' => 'library1/site20/reservations.txt'])); + 'nom_fichier' => 'library/site20/reservations.txt'])); } @@ -494,7 +528,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => $profile->getId(), 'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT, - 'nom_fichier' => 'library1/site20/paniers_total.txt'])); + 'nom_fichier' => 'library/site20/paniers_total.txt'])); } @@ -506,7 +540,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest $this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20, 'profil' => $profile->getId(), 'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT, - 'nom_fichier' => 'library1/site20/paniers.txt'])); + 'nom_fichier' => 'library/site20/paniers.txt'])); } diff --git a/library/Class/Cosmogramme/Generator.php b/library/Class/Cosmogramme/Generator.php index 65444446c19cb7c9eb810e2287bcfdd554e20086..ef9eb4931036f58cb9d53ff7dc30bf1e9c2e94de 100644 --- a/library/Class/Cosmogramme/Generator.php +++ b/library/Class/Cosmogramme/Generator.php @@ -78,6 +78,7 @@ class Class_Cosmogramme_Generator { return false; } + $this->_disableDeletedLibraries($libraries); $this->_generateLibrariesEntities($libraries); $this->_generateLibrariesBranches($libraries); $this->_generatePlannedIntegrations($libraries); @@ -86,6 +87,35 @@ class Class_Cosmogramme_Generator { } + protected function _disableDeletedLibraries($libraries) { + if ((!$ids = $this->_librariesIdsFrom($libraries)) + || !$libs = Class_IntBib::findAllBy(['id_bib not' => $ids])) + return; + + foreach($libs as $lib) + $this->_disableDeletedLibrary($lib); + } + + + protected function _disableDeletedLibrary($library) { + $library->beDisconnected()->save(); + Class_IntMajAuto::deleteBy(['id_bib' => $library->getId()]); + } + + + protected function _librariesIdsFrom($datas) { + if (!$datas) + return []; + + $ids = []; + foreach($datas as $data) + if ($elem = $this->_extractLibraryData($data)) + $ids[] = $elem[0]; + + return $ids; + } + + protected function _generateLibrariesEntities($libraries) { $this->logTitle($this->_('1 - Création des bibliothèques')); @@ -181,8 +211,7 @@ class Class_Cosmogramme_Generator { $id_bib = $elem[0]; Class_IntMajAuto::deleteBy(['id_bib' => $id_bib]); - $lib_label = trim($elem[1]); - return $this->getPlannedGenerator()->plan($id_bib, $lib_label); + return $this->getPlannedGenerator()->plan($id_bib, $this->_params['path_ftp']); } diff --git a/library/Class/IntBib.php b/library/Class/IntBib.php index 1163fb5c4b424313f6436399b73a64f2a91460bb..8c597fb1174bbbe15b8210b6e2f1f1aafc2f6129 100644 --- a/library/Class/IntBib.php +++ b/library/Class/IntBib.php @@ -177,6 +177,10 @@ class Class_IntBib extends Storm_Model_Abstract { return static::COM_NONE == $this->getCommSigb() && static::SIGB_NONE == $this->getSigb(); } -} -?> \ No newline at end of file + + public function beDisconnected() { + return $this->setSigb(static::SIGB_NONE) + ->setCommSigb(static::COM_NONE); + } +} \ No newline at end of file diff --git a/library/Class/Zone.php b/library/Class/Zone.php index f6a0e3afd13de9e4c37452f27463e041be283b1d..6a0b15bec2b471113b58a7a49aae198beb456d15 100644 --- a/library/Class/Zone.php +++ b/library/Class/Zone.php @@ -32,6 +32,15 @@ class ZoneLoader extends Storm_Model_Loader { $labels[$zone->getId()] = $zone->getLibelle(); return $labels; } + + + public function getMultiOptions($default=null) { + $options = $default ? [0 => $default] : []; + foreach(Class_Zone::findAllLabels() as $k => $v) + $options[$k] = $v; + + return $options; + } } diff --git a/library/ZendAfi/Form/Admin/Library.php b/library/ZendAfi/Form/Admin/Library.php index d7a6b19108c79399fbbfbce9244546378c0a9318..f611eadecb02aae5dc3c763fb5f380b19e42698a 100644 --- a/library/ZendAfi/Form/Admin/Library.php +++ b/library/ZendAfi/Form/Admin/Library.php @@ -100,19 +100,20 @@ class ZendAfi_Form_Admin_Library extends ZendAfi_Form { ], 'adress', ['legend' => $this->_('Adresse')]) - ->addElement('select', 'id_zone', ['label' => $this->_('Territoire'), - 'multiOptions' => array_merge(['0' => $this->_('Tous les territoires')], Class_Zone::findAllLabels()), - 'order' => 12]) + + ->addElement('select', 'id_zone', + ['label' => $this->_('Territoire'), + 'multiOptions' => Class_Zone::getMultiOptions($this->_('Tous les territoires')), + 'order' => 12]) ->addElement('text', 'lien_carto', ['label' => $this->_('Lien cartographique'), 'size' => 50, 'allowEmpty' => false]) - ->addDisplayGroup([ - 'id_zone','lien_carto' - ], + ->addDisplayGroup(['id_zone','lien_carto'], 'carto', ['legend' => $this->_('Territoire')]) + ->addElement('textarea', 'inscription', ['label' => $this->_('Inscription'), 'rows' => 4, diff --git a/library/startup.php b/library/startup.php index 111cf50cd8e5f27f240111bdc45d9e895b04167a..00dd9d79d7d42adac357a327e281a9d2c0e53f6a 100644 --- a/library/startup.php +++ b/library/startup.php @@ -65,7 +65,7 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.5'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.12'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.13'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/tests/application/modules/admin/controllers/BibControllerTest.php b/tests/application/modules/admin/controllers/BibControllerTest.php index 0f408e73b4f373df465c5009a47770a78bd980bc..04fb1b5d2604c042508f98b42ce2c1eea5465c92 100644 --- a/tests/application/modules/admin/controllers/BibControllerTest.php +++ b/tests/application/modules/admin/controllers/BibControllerTest.php @@ -234,9 +234,8 @@ class BibControllerWithAdminBibEditAnnecyTest extends BibControllerWithAdminBibT parent::setUp(); RessourcesNumeriquesFixtures::activateDilicom(); - $this->fixture('Class_Zone', - ['id' => 1, - 'libelle' => 'Territoire']); + $this->fixture('Class_Zone', ['id' => 1, 'libelle' => 'Territoire']); + $this->fixture('Class_Zone', ['id' => 6, 'libelle' => 'Auxerrois']); $this->dispatch('admin/bib/edit/id/2'); } @@ -264,6 +263,7 @@ class BibControllerWithAdminBibEditAnnecyTest extends BibControllerWithAdminBibT $this->assertXPath('//input[@name="'.$name.'"][@value="'.$value.'"]', $this->_response->getBody()); } + public function expectedTextArea() { return [ [ 'adresse', 'le paquier' ], @@ -276,7 +276,6 @@ class BibControllerWithAdminBibEditAnnecyTest extends BibControllerWithAdminBibT ]; } - /** * @dataProvider expectedTextArea * @test @@ -286,45 +285,33 @@ class BibControllerWithAdminBibEditAnnecyTest extends BibControllerWithAdminBibT } - /** @test */ - public function zoneAllShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="id_zone"][@id="id_zone"]//option[@value="0"]','Tous les territoires',$this->_response->getBody()); + public function expectedSelectOptions() { + return [ + ['id_zone', '0', 'Tous les territoires'], + ['id_zone', '1', 'Territoire'], + ['id_zone', '6', 'Auxerrois'], + ['visibilite', '0', 'Invisible'], + ['visibilite', '1', 'N\'envoie pas de données'], + ['visibilite', '2', 'Envoie des données'], + ['interdire_resa', '0', 'non'], + ]; } - - /** @test */ - public function zoneTerritoireShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="id_zone"][@id="id_zone"]//option[@value="1"]','Territoire',$this->_response->getBody()); + /** + * @test + * @dataProvider expectedSelectOptions + */ + public function selectOptionsShouldBePresent($id, $value, $label) { + $xpath = '//select[@name="' . $id . '"][@id="' . $id . '"]//option[@value="' . $value . '"]'; + $this->assertXPathContentContains($xpath, $label, $this->_response->getBody()); } - /** @test */ - public function visibiliteInvisibleShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="visibilite"][@id="visibilite"]//option[@value="0"]','Invisible',$this->_response->getBody()); - } - /** @test */ public function withNoRedmineAPISetRedmineAccountNameShouldNotBePresent() { $this->assertNotXPathContentContains('//table//tr//td', 'nom d\'utilsateur'); } - - - /** @test */ - public function visibiliteBibNoSendDataShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="visibilite"][@id="visibilite"]//option[@value="1"]','N\'envoie pas de données',$this->_response->getBody()); - } - - /** @test */ - public function visibiliteBibSendDatasShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="visibilite"][@id="visibilite"]//option[@value="2"]','Envoie des données',$this->_response->getBody()); - } - - - /** @test */ - public function forbidReservationShouldBeDisplayed() { - $this->assertXPathContentContains('//select[@name="interdire_resa"][@id="interdire_resa"]//option[@value="0"]','non',$this->_response->getBody()); - } }