From c7d5b19969d74c189c2eb230dd5acd65f259b4cd Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.pergame.net> Date: Thu, 28 Apr 2016 11:51:22 +0200 Subject: [PATCH] dev #35088 fix rt comments --- .../views/scripts/data-profile/index.phtml | 7 ++--- .../controllers/DataProfileControllerTest.php | 30 +++++++++---------- cosmogramme/css/main.css | 22 ++++++++++++++ .../php/classes/classe_notice_integration.php | 22 +++++++------- cosmogramme/php/classes/classe_unimarc.php | 7 ++++- .../tests/php/classes/KohaPeriodiquesTest.php | 1 - .../Integration/Record/DublinCore.php | 7 +++-- .../Integration/PhaseNoticeDublinCoreTest.php | 2 +- 8 files changed, 62 insertions(+), 36 deletions(-) diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml index d08bd89110e..f03a8362344 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml @@ -16,11 +16,10 @@ $isUsed = function($model, $attrib) { $html = ''; foreach($labels as $label) - $html .= $this->tag('span', $label, ['style' => 'display:block;']); + $html .= $this->tag('li', $label); - $html = $this->tag('div', $html, ['style' => 'display:none;position:absolute;background:grey;padding:5px;margin-left: 2em;']); - return $this->tag('div', $this->_('Oui') . $html, ['onmouseover' => '$(this).find(\'>div\').show();', - 'onmouseout' => '$(this).find(\'>div\').hide();']); + $html = $this->tag('ul', $html, ['class' => 'table_tooltip']); + return $this->tag('div', $this->_('Oui (?)') . $html, ['class' => 'table_tooltip_wrapper']); }; echo $this->tagModelTable($this->data_profiles, diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 13df29d8699..6d8e35d69bf 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -1047,24 +1047,24 @@ class Cosmo_DataProfileControllerRecordsProfileTest extends Cosmo_DataProfileCon 'champ' => 'z'] ]]); - $this->dispatch('cosmo/data-profile/edit/id/321', true); - } + $this->dispatch('cosmo/data-profile/edit/id/321', true); + } - /** @test */ - public function nouveauteValeursShouldBeNouveauAndNew() { - $this->assertXPathContentContains('//script', 'values:{"nouveaute_valeurs":["nouveau","new"]}'); - } + /** @test */ + public function nouveauteValeursShouldBeNouveauAndNew() { + $this->assertXPathContentContains('//script', 'values:{"nouveaute_valeurs":["nouveau","new"]}'); + } - /** @test */ - public function interestShouldBeTakeIn995AndZ() { - $this->assertXPathContentContains('//script', 'values:{"interest_zone":["995"],"interest_champ":["z"]}'); - } + /** @test */ + public function interestShouldBeTakeIn995AndZ() { + $this->assertXPathContentContains('//script', 'values:{"interest_zone":["995"],"interest_champ":["z"]}'); + } - /** @test */ - public function itemUrlShouldBe995AndI() { - $this->assertXPathContentContains('//script', 'values:{"url_zone":["995"],"url_champ":["i"]}'); - } - } \ No newline at end of file + /** @test */ + public function itemUrlShouldBe995AndI() { + $this->assertXPathContentContains('//script', 'values:{"url_zone":["995"],"url_champ":["i"]}'); + } +} \ No newline at end of file diff --git a/cosmogramme/css/main.css b/cosmogramme/css/main.css index 6b8d2c6c2f6..b0efdad824c 100644 --- a/cosmogramme/css/main.css +++ b/cosmogramme/css/main.css @@ -297,4 +297,26 @@ table.tablesorter { table.tablesorter > tbody > tr:hover td { background-color: rgba(0, 0 , 0 , 0.15); +} + +.table_tooltip_wrapper { + position: relative; +} + +.table_tooltip { + display:none; + position:absolute; + top: -5px; + background: white; + padding:5px; + margin-left: 3.5em; + border: 1px solid #003687; +} + +.table_tooltip li:before { + content: ' - '; +} + +.table_tooltip_wrapper:hover .table_tooltip { + display: block; } \ No newline at end of file diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 26f4d5bf932..9feca7ec148 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -101,18 +101,18 @@ class notice_integration { $this->id_profil=$id_profil; if($id_profil < 0) - $format=1; // Paniers d'homogeneisation + $format = Class_IntProfilDonnees::FORMAT_TABBED_ASCII; // Paniers d'homogeneisation else { $profil = (new profil_donnees())->getProfil($id_profil); $this->id_article_periodique = $profil['id_article_periodique']; $format = $profil['format']; - if (!$format) $format=0; + if (!$format) $format = Class_IntProfilDonnees::FORMAT_UNIMARC; if ($profil['type_fichier']>9) $format = $profil['type_fichier']; } - $this->format=$format; + $this->format = $format; unset($this->analyseur); switch($format) { @@ -168,7 +168,7 @@ class notice_integration { $this->notice=$this->analyseur->getNoticeIntegration(); - if($this->notice['type_doc'] == 100) { + if($this->notice['type_doc'] == Class_TypeDoc::LIVRE_NUM) { $this->ecrireArticlePeriodique(); return; } @@ -178,7 +178,7 @@ class notice_integration { if($this->type_operation == 1) { $this->statut = static::RECORD_DELETE; - if($this->format == 0 ) + if($this->format == Class_IntProfilDonnees::FORMAT_UNIMARC ) $this->supprimerNotice($id_notice,$this->notice["id_origine"]); else $this->supprimerExemplaire($id_notice,$this->notice["exemplaires"][0]); @@ -191,7 +191,7 @@ class notice_integration { return; } - if($this->notice["type_doc"]==2) { + if($this->notice["type_doc"] == Class_TypeDoc::PERIODIQUE) { // Periodiques Koha et orphee (1 exemplaire pour chaque numéro) if(($this->id_article_periodique == 3 or $this->id_article_periodique == 4) @@ -477,7 +477,7 @@ class notice_integration { return false; } - if($this->format == 0 or $this->format==10) + if($this->format == Class_IntProfilDonnees::FORMAT_UNIMARC or $this->format == Class_IntProfilDonnees::FORMAT_CG68_ARCHIVES) $this->erreur = "pas de titre principal"; else $this->erreur = "Aucun identifiant valide"; @@ -1063,7 +1063,7 @@ class notice_integration { // Type de document $td=$notice["infos_type_doc"]; - if(!$td["code"]){ $statut=1; $libelle=" code non reconnu"; $ret["type_doc"]=0; } + if(!$td["code"]){ $statut=1; $libelle=" code non reconnu"; $ret["type_doc"] = Class_TypeDoc::UNKNOWN; } else {$statut=0; $libelle=$td["code"]." - ".$td["libelle"]; $ret["type_doc"]=$td["code"]; } $ret["lig"][]=array($statut,"Type de document", $libelle,$td["infos"]); @@ -1244,11 +1244,11 @@ class notice_integration { // Notice rejetee $ret["statut"]="rejet"; if(!$notice["titre_princ"]) {$ret["rejet"]="notice sans titre"; return $ret;} - if($notice["type_doc"]!="100" and !$notice["statut_exemplaires"]["nb_ex"]) {$ret["rejet"]="notice sans exemplaire"; return $ret;} + if($notice["type_doc"] != Class_TypeDoc::LIVRE_NUM and !$notice["statut_exemplaires"]["nb_ex"]) {$ret["rejet"]="notice sans exemplaire"; return $ret;} // Warnings $ret["statut"]="warning"; - if($notice["type_doc"]!="100") + if($notice["type_doc"] != Class_TypeDoc::LIVRE_NUM) { if(!$notice["statut_exemplaires"]["codes_barres"]) $ret["warnings"][]="code-barres non trouvé"; if(!$notice["statut_exemplaires"]["cotes"]) $ret["warnings"][]="cote non trouvée"; @@ -1259,7 +1259,7 @@ class notice_integration { if($notice["type_doc"]) $ret["type_doc"]=$notice["infos_type_doc"]["libelle"]; // Identifiants (isbn / ean) - if($notice["type_doc"]!="100") + if($notice["type_doc"] != Class_TypeDoc::LIVRE_NUM) { $isbn=$this->analyseur->getIsbn(); if(!$isbn) $isbn=$this->analyseur->getEan(); diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index 1100a1a7772..67de07b1e21 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -113,7 +113,7 @@ class notice_unimarc extends iso2709_record { public function getNoticeIntegration() { - $type_doc = $this->getTypeDoc(true); + $type_doc = $this->getTypeDocAsArray(); if ($type_doc['code'] == 100) return $this->getNoticeIntegrationArticlePeriodique(); @@ -996,6 +996,11 @@ class notice_unimarc extends iso2709_record { } + public function getTypeDocAsArray() { + return $this->getTypeDoc(true); + } + + public function calculDateNouveaute($valeur) { $valeur = trim($valeur); if (!$valeur) diff --git a/cosmogramme/tests/php/classes/KohaPeriodiquesTest.php b/cosmogramme/tests/php/classes/KohaPeriodiquesTest.php index 2b0ed9b83c1..d4b5429d568 100644 --- a/cosmogramme/tests/php/classes/KohaPeriodiquesTest.php +++ b/cosmogramme/tests/php/classes/KohaPeriodiquesTest.php @@ -112,7 +112,6 @@ class KohaPeriodiquesMarieClaireTest extends KohaPeriodiquesTestCase { /** @test */ public function recordsTitleShouldBeOriginTitle() { foreach (Class_Notice::findAll() as $notice) { - //echo $notice->getAlphaTitre()."\n"; $this->assertContains('MARIE CLAIRE', $notice->getTitrePrincipal()); } } diff --git a/library/Class/Cosmogramme/Integration/Record/DublinCore.php b/library/Class/Cosmogramme/Integration/Record/DublinCore.php index ab80749c636..701fa7f1e8c 100644 --- a/library/Class/Cosmogramme/Integration/Record/DublinCore.php +++ b/library/Class/Cosmogramme/Integration/Record/DublinCore.php @@ -89,11 +89,12 @@ class Class_Cosmogramme_Integration_Record_DublinCore extends notice_unimarc { public function getTypeDoc($infos = false) { - $type_doc_code = $this->_getTypeDocCode(); + return $this->_getTypeDocCode(); + } - if(!$infos) - return $type_doc_code; + public function getTypeDocAsArray() { + $type_doc_code = $this->_getTypeDocCode(); return ['code' => $type_doc_code, 'infos' => 'Label=dc', 'libelle' => Class_TypeDoc::getLabelFor($type_doc_code)]; diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeDublinCoreTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeDublinCoreTest.php index 421a8026431..f9d3106b56e 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeDublinCoreTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeDublinCoreTest.php @@ -211,7 +211,7 @@ class PhaseNoticeDublinCoreTest extends AbstractPhaseNoticeDublinCoreTestCase { /** * @test - + * @depends totalNumberOfRecordsFromOAIShouldBeNine */ public function recordWithAtlasPlanDoctypeShouldBePresent() { $this->assertNotNull(Class_Notice::findFirstBy(['type_doc' => 25])); -- GitLab