diff --git a/VERSIONS b/VERSIONS index e890976981afeafc1c16d5c1fee04ce48d45bf88..3afcad60204111996f85a635ad3b9b55f2c23fc0 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,14 @@ +27/09/2017 - v7.11.1 + + - ticket #64357 : Correction des problèmes d'affichage sur tablette Apple des popups + + - ticket #65092 : Administration : correction de l'affichage des boutons de gestion de la vignette d'une notice. + + - ticket #65312 : Administration : Explorateur de fichier : les modérateurs biliothèques peuvent accéder à l'explorateur. + + - ticket #63383 : Cosmogramme : correction de l'import des paniers. + + 25/09/2017 - v7.11.0 - ticket #61314 : Administration : mise en place d'un nouvel explorateur de fichiers. diff --git a/VERSIONS_HOTLINE/65312 b/VERSIONS_HOTLINE/65312 deleted file mode 100644 index b0e7322ee90c7beae809a01c252722706cb4b7cb..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/65312 +++ /dev/null @@ -1 +0,0 @@ - - ticket #65312 : Explorateur de fichier : les modérateurs biliothèques peuvent accéder à l'explorateur. diff --git a/application/modules/opac/views/scripts/recherche/viewnotice.phtml b/application/modules/opac/views/scripts/recherche/viewnotice.phtml index 7ccc61979428d44ba625ce615ade13d53634a274..c13acd9cebf388675fe8f11ce8413b73ff0ded22 100644 --- a/application/modules/opac/views/scripts/recherche/viewnotice.phtml +++ b/application/modules/opac/views/scripts/recherche/viewnotice.phtml @@ -53,21 +53,23 @@ $script_loader = Class_ScriptLoader::getInstance() ZendAfi_View_Helper_Notice_Vignette::MODE_VIEW); if ($this->display_modifier_vignette_link) - echo $this->tagAnchor(['module' => 'admin', 'controller' => 'records', 'action' => 'thumbnail'], - $this->_('Modifier la vignette'), - ['title' => $this->_('Modifier la vignette de la notice "%s"', - $this->notice->getTitrePrincipal()), - 'data-popup' => 'true', - 'class' => 'bouton'] - ); + echo $this->admin_button((new Class_Entity()) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'thumbnail'])) + ->setText($this->_('Modifier')) + ->setAttribs(['title' => $this->_('Modifier la vignette de la notice "%s"', + $this->notice->getTitrePrincipal()), + 'data-popup' => 'true'])); if ($this->show_reset_thumbnail_link) - echo $this->tagAnchor(['module' => 'admin', 'controller' => 'records', 'action' => 'reset-thumbnail'], - $this->_('Générer la vignette'), - ['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"', - $this->notice->getTitrePrincipal()), - 'class' => 'bouton'] - ); + echo $this->admin_button((new Class_Entity()) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'reset-thumbnail'])) + ->setText($this->_('Générer')) + ->setAttribs(['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"', + $this->notice->getTitrePrincipal())])); ?> <div id="reseaux-sociaux"><?php echo $this->reseauxSociaux($this->notice); ?></div> diff --git a/cosmogramme/sql/patch/patch_336.php b/cosmogramme/sql/patch/patch_336.php new file mode 100644 index 0000000000000000000000000000000000000000..637196d4b4957884977b619241a01c98d7ff640a --- /dev/null +++ b/cosmogramme/sql/patch/patch_336.php @@ -0,0 +1,7 @@ +<?php +try{ + $adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); + $adapter->query('alter table integrations add column nom_fichier varchar(255) not null'); + $adapter->query('alter table notices_paniers add column integration_hash varchar(255) not null'); +} catch(Exception $e) {} +?> diff --git a/library/Class/Cosmogramme/Integration.php b/library/Class/Cosmogramme/Integration.php index 44efcd02906af1cfaeba2df9faf1ffbb08ad3872..aa763e6c208b06a48100a4bfbe652b58cea3bd2d 100644 --- a/library/Class/Cosmogramme/Integration.php +++ b/library/Class/Cosmogramme/Integration.php @@ -38,7 +38,8 @@ class Class_Cosmogramme_Integration extends Storm_Model_Abstract { 'role' => 'integration', 'referenced_in' => 'profil']], - $_default_attribute_values = ['type_doc' => ''], + $_default_attribute_values = ['type_doc' => '', + 'nom_fichier' => ''], $_data_source; @@ -144,4 +145,18 @@ class Class_Cosmogramme_Integration extends Storm_Model_Abstract { $this->_data_source = $source; return $this; } + + + public function getHash() { + return md5(implode(',', $this->_getHashAttributes())); + } + + + protected function _getHashAttributes() { + return [$this->getIdBib(), + $this->getTypeOperation(), + $this->getProfil(), + $this->getTypeDoc(), + $this->getNomFichier()]; + } } \ No newline at end of file diff --git a/library/Class/Cosmogramme/Integration/PhasePanier.php b/library/Class/Cosmogramme/Integration/PhasePanier.php index a10acdc5e7d619827fafdb38bbd0a0faeac25446..b70e0cb0bda58d1770daebcd7827a49a423d5c8f 100644 --- a/library/Class/Cosmogramme/Integration/PhasePanier.php +++ b/library/Class/Cosmogramme/Integration/PhasePanier.php @@ -128,13 +128,14 @@ class Class_Cosmogramme_Integration_PhasePanier extends Class_Cosmogramme_Integr ->setIdIntBib($id_int_bib) ->setUser($owner) ->setIdabon($owner->getIdabon()) + ->setIntegrationHash($integration->getHash()) ->addNotice($exemplaire->getNotice()) ->save(); } protected function _clean($integration) { - $baskets = Class_PanierNotice::findAllBy(['id_int_bib' => $integration->getId()]); + $baskets = Class_PanierNotice::findAllBy(['integration_hash' => $integration->getHash()]); foreach($baskets as $basket) $basket->setNotices('')->save(); } @@ -151,7 +152,5 @@ class Class_Cosmogramme_Integration_PhasePanier extends Class_Cosmogramme_Integr protected function _afterFileProcessed($integration) { - Class_PanierNotice::deleteBy(['id_int_bib' => $integration->getId(), - 'notices' => '']); } } diff --git a/library/Class/Cosmogramme/Integration/PhasePrepareIntegrations.php b/library/Class/Cosmogramme/Integration/PhasePrepareIntegrations.php index 881664e446e425d8810d68d21b72a98e3aa47c73..a82d99b7e37acfc32250ce1879f708670a225a15 100644 --- a/library/Class/Cosmogramme/Integration/PhasePrepareIntegrations.php +++ b/library/Class/Cosmogramme/Integration/PhasePrepareIntegrations.php @@ -210,17 +210,13 @@ class Class_Cosmogramme_Integration_PhasePrepareIntegrations extends Class_Cosmo public function _newIntegration($filename, $majauto) { - $id_bib = $majauto->getIdBib(); - $id_profil = $majauto->getProfil(); - $type_operation = $majauto->getTypeOperation(); - $type_doc = $majauto->getTypeDoc(); - - $integration = Class_Cosmogramme_Integration::newInstance(['id_bib' => $id_bib, - 'type_operation' => $type_operation, - 'profil' => $id_profil, - 'type_doc' => $type_doc, + $integration = Class_Cosmogramme_Integration::newInstance(['id_bib' => $majauto->getIdBib(), + 'type_operation' => $majauto->getTypeOperation(), + 'profil' => $majauto->getProfil(), + 'type_doc' => $majauto->getTypeDoc(), 'date_transfert' => $this->getCurrentDate(), 'fichier' => $filename, + 'nom_fichier' => $majauto->getNomFichier(), 'traite' => 'non']); $integration->save(); } diff --git a/library/Class/PanierNotice.php b/library/Class/PanierNotice.php index d2e050b99a6d534b3e9fba13950296dbec11a336..d7e6a55b18ce219039c2e7e114e89eed65c18849 100644 --- a/library/Class/PanierNotice.php +++ b/library/Class/PanierNotice.php @@ -135,7 +135,8 @@ class Class_PanierNotice extends Storm_Model_Abstract { 'unique' => true]], $_default_attribute_values = ['notices' => '', - 'libelle' => '']; + 'libelle' => '', + 'integration_hash' => '']; public function index() { diff --git a/library/startup.php b/library/startup.php index d0c1ed3c40490ff7552503bd892570b86c57f951..1d1d5a6ecbaf27fd4e4915fdcd190a8ced44047e 100644 --- a/library/startup.php +++ b/library/startup.php @@ -82,7 +82,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.11'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.0'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.1'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/public/opac/js/subModal.js b/public/opac/js/subModal.js index 4445f2cc5283d2cf7709e54bccbbb206b1d30fd4..9d2d4afc2b54cb9f394236a07e1be497c04dce8d 100644 --- a/public/opac/js/subModal.js +++ b/public/opac/js/subModal.js @@ -6,15 +6,15 @@ window.initializePopups = function() { $('[data-popup="true"], [data-popup="1"]') - .unbind('onclick') - .unbind('click') + .prop('onclick', null) + .off('click') .click(function(event){ event.preventDefault(); current_anchor=$(this); addLoadingClass(); - var url = $(this).attr('data-url') - ? $(this).attr('data-url') - : $(this).attr('href'); + var url = $(this).attr('data-url') + ? $(this).attr('data-url') + : $(this).attr('href'); opacDialogFromUrl(addPath(url, '/render/popup')); }); @@ -46,10 +46,10 @@ form.submit(function(event) { event.preventDefault(); setTimeout( //wait for all bind events to be executed (ex: input manipulation events / treeselect) - function() { - window.doSubmit(form) ; - }, - 1); + function() { + window.doSubmit(form) ; + }, + 1); }); } @@ -138,20 +138,21 @@ var fixWindowPositionAndWidth = function(dialog) { var max_height = Math.round($(window).height() * 0.8); + var window_width = Math.round($(window).width()); + var min_width = 400; + dialog .css('position', 'fixed') .css('top', '15%') - .css('left', '20%') - .css('width', '60%') + .css('left', window_width < min_width ? '0' : '20%') + .css('width', window_width < min_width ? '100%' : '60%') .css('max-height', max_height + 'px') .find('.ui-dialog-content') .css('max-height', (max_height - 50) + 'px') .css('width', 'auto') .css('overflow-y', 'auto'); - - dialog.position({of: $(window)}); - } + } window.opacShowModal = function(url, width, height, returnFunc, showCloseBox, titleDialog) { @@ -204,8 +205,8 @@ window.opacDialog = function(container, data) { container[0].innerHTML = data['content']; var show_modal = (data['show_modal'] && data['show_modal']=='true') - ? true - : false; + ? true + : false; var dialog = null; @@ -213,18 +214,18 @@ title: data['title'], modal:show_modal, close: function(event, ui) { - onClose(event, ui) + onClose(event, ui) }, open: function(event, ui) { - dialog = $(event.target).closest('.ui-widget'); - setTimeout(onOpen(dialog), 100); + dialog = $(event.target).closest('.ui-widget'); + setTimeout(onOpen(dialog), 100); }, resizeStart: function(event, ui) { - dialog.css('position', 'absolute'); + dialog.css('position', 'absolute'); }, resizeStop: function(event, ui) { - dialog.css('position', 'fixed'); - dialog.position({of: $(window)}); + dialog.css('position', 'fixed'); + dialog.position({of: $(window)}); } }); @@ -236,19 +237,19 @@ window.addLoadingClass = function () { var initCurrentAnchor = function() { if (current_anchor != undefined) - return current_anchor; + return current_anchor; var dialog_form = $('#opac-dialog form'); if (!dialog_form.length) - return undefined; + return undefined; current_anchor = undefined; var action = dialog_form[0].getAttribute('action'); $('body').find('a[class*="edit_"], .configuration_module a').each(function() { - var href = $(this)[0].getAttribute('href'); - if(action.indexOf(href) > -1 || href.indexOf(action) > -1) { - return current_anchor = $(this); - } + var href = $(this)[0].getAttribute('href'); + if(action.indexOf(href) > -1 || href.indexOf(action) > -1) { + return current_anchor = $(this); + } }); return current_anchor; }; diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index fdcca390213b0d40f175ab21046e29e705977bf7..346d3e0484bee70513cf3801d5d4daeb2b9472ea 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -799,7 +799,7 @@ class RechercheControllerUploadVignetteTest extends RechercheControllerNoticeTes public function linkToUploadVignetteShouldBePresentForModoBib() { Class_Users::getIdentity()->changeRoleTo(ZendAfi_Acl_AdminControllerRoles::MODO_BIB); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a', 'Modifier la vignette'); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); } @@ -820,7 +820,7 @@ class RechercheControllerUploadVignetteTest extends RechercheControllerNoticeTes 'famille_id' => Class_CodifTypeDoc::LIVRE]); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a', 'Modifier la vignette'); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); } } @@ -833,7 +833,7 @@ class RechercheControllerGenerateThumbnailTest extends RechercheControllerNotice public function linkToGenerateThumbnailShouldNotBePresentForAbonneSIGB() { Class_Users::getIdentity()->beAbonneSIGB(); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertNotXPath('//a[contains(@href, "admin/records/reset-thumbnail")]'); + $this->assertNotXPath('//button[contains(@onclick, "admin/records/reset-thumbnail")][contains(@title, "Supprimer et re-générer la vignette")]'); } @@ -841,8 +841,7 @@ class RechercheControllerGenerateThumbnailTest extends RechercheControllerNotice public function linkToGenerateThumbnailShouldBePresentForModoBib() { Class_Users::getIdentity()->changeRoleTo(ZendAfi_Acl_AdminControllerRoles::MODO_BIB); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a[contains(@href, "admin/records/reset-thumbnail")]', - 'Générer la vignette'); + $this->assertXPath('//button[contains(@onclick, "admin/records/reset-thumbnail")][contains(@title, "Supprimer et re-générer la vignette")]'); } } @@ -861,7 +860,7 @@ class RechercheControllerViewNoticeAsAdminTest extends RechercheControllerNotice /** @test */ public function linkToUploadVignetteShouldBePresent() { - $this->assertXPathContentContains('//a', 'Modifier la vignette',$this->_response->getBody()); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); } diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index ecf28c4294d7ad4df8183a7aca38c8d6d792be2e..63ed32cc6d34442b9269a232482c707a3796f460 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -1733,4 +1733,28 @@ class UpgradeDB_335_Test extends UpgradeDBTestCase { $batch = $this->fetchBatchByType($type); $this->assertEquals($pick_day, $batch['pick_day']); } -} \ No newline at end of file +} + + + + +class UpgradeDB_336_Test extends UpgradeDBTestCase { + public function prepare() { + try { + $this->query('ALTER TABLE integrations DROP column nom_fichier'); + $this->query('ALTER TABLE notices_paniers DROP column integration_hash'); + } catch(Exception $e) {} + } + + + /** @test */ + public function columnNomFichierShouldBePresent() { + $this->assertColumn('integrations', 'nom_fichier'); + } + + + /** @test */ + public function columnIntegrationHashShouldBePresent() { + $this->assertColumn('notices_paniers', 'integration_hash'); + } +} diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php index 2a46a53d42b468464c13768262145f5b8fb7a7fa..1df36f2cad1bba9849d9923c8dce2210479829d1 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php @@ -44,11 +44,12 @@ abstract class PhasePanierTestCase extends Class_Cosmogramme_Integration_PhaseTe $this->fixture('Class_Cosmogramme_Integration', ['id' => 999, - 'bib' => Class_IntBib::find(2), - 'profil_donnees' => Class_IntProfilDonnees::find(102), + 'id_bib' => 2, + 'profil' => 102, 'type_operation' => Class_Cosmogramme_Integration::TYPE_OPERATION_TOTAL, 'traite' => 'non', 'fichier' => 'baskets.txt', + 'nom_fichier' => 'baskets.txt', 'pointeur_reprise' => 0]); } @@ -121,6 +122,7 @@ abstract class PhasePanierKohaTestCase extends PhasePanierTestCase { 'id_user' => 3, 'id_sigb' => 1, 'id_int_bib' => 2, + 'integration_hash' => '577f79a2c26968b6f5e1360df0dc17af', 'libelle' => 'will be killed', 'notices' => 'VOL714']); @@ -173,13 +175,23 @@ class PhasePanierKohaSameIdOrigine extends PhasePanierKohaTestCase { /** @test */ - public function firstBasketRecordsShouldContainNoticeLune() { - $this->assertEquals(['COKEENSTOCK', - 'CASTAFIORE', - 'LUNE'], - Class_PanierNotice::find(1)->getClesNotices()); + public function fourthBasketRecordsShouldBeEmpty() { + $this->assertEmpty(Class_PanierNotice::find(4)->getClesNotices()); } + + /** @test */ + public function fourthBasketIntegrationHashShouldBe577f79a2c26968b6f5e1360df0dc17af() { + $this->assertEquals('577f79a2c26968b6f5e1360df0dc17af', + Class_PanierNotice::find(4)->getIntegrationHash()); + } + + + /** @test */ + public function firstBasketIntegrationHashShouldBecome577f79a2c26968b6f5e1360df0dc17af() { + $this->assertEquals('577f79a2c26968b6f5e1360df0dc17af', + Class_PanierNotice::find(1)->getIntegrationHash()); + } } @@ -254,7 +266,7 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase { /** @test */ public function basketTitiShouldBeEmpty() { - $this->assertEmpty(Class_PanierNotice::findFirstBy(['id_sigb' => '7'])->getClesNotices()); + $this->assertEmpty(Class_PanierNotice::findFirstBy(['id_sigb' => 7])->getClesNotices()); } @@ -454,7 +466,7 @@ class PhasePanierNanookTest extends PhasePanierTestCase { /** @test */ - public function IdIntBibShouldBe2() { - $this->assertEquals('2', $this->_basket->getIdIntBib()); + public function IdIntBibShouldBe999() { + $this->assertEquals(2, $this->_basket->getIdIntBib()); } } diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php index fa3ed6aaea84df398803f04bda3c08f9a13b9957..fd524be7fbed5724ff46a383a323355cf6427d40 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php @@ -188,11 +188,23 @@ class PhasePrepareIntegrationsWithOAITest extends PhasePrepareIntegrationsWithOA /** @test */ - public function firstIntegrationURIShouldBeIntegre1179DotPan() { + public function firstIntegrationFileShouldBeIntegre1179DotPan() { $this->assertEquals('integre1179.pan', Class_Cosmogramme_Integration::find(2)->getFichier()); } + /** @test */ + public function firstIntegrationFileNameShouldBeMyLibraryTotalDotTxt() { + $this->assertEquals('foo/mylibrarytotal.txt', Class_Cosmogramme_Integration::find(2)->getNomFichier()); + } + + + /** @test */ + public function firstIntegrationKeyShouldBeHash() { + $this->assertEquals('a7be1b1bbdfe70b6fec563334accab3f', Class_Cosmogramme_Integration::find(2)->getHash()); + } + + /** @test */ public function secondIntegrationURIShouldBeOAIRepository() { $this->assertEquals('http://oai-repository.fr/oai', Class_Cosmogramme_Integration::find(3)->getFichier());