From 445329c5bbc49bc507f01f42dec2c1dd39b4f28a Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.pergame.net> Date: Mon, 4 Apr 2016 17:32:29 +0200 Subject: [PATCH] dev #35088 refacto profilte prefs --- .../modules/cosmo/views/scripts/data-profile/index.phtml | 6 ++++-- .../cosmo/controllers/DataProfileControllerTest.php | 6 ++++++ library/Class/IntProfilDonnees.php | 7 +++++++ 3 files changed, 17 insertions(+), 2 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 a14977fd2f1..f1524784bba 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 @@ -13,10 +13,12 @@ echo $this->tag('div', echo $this->tagModelTable($this->data_profiles, [$this->_('Libellé'), $this->_('Type de fichier'), - $this->_('Format')], + $this->_('Format'), + $this->_('Utilisé par une intégration')], ['libelle', 'filetype-label', - 'format-label'], + 'format-label', + 'is-used-label'], [['action' => 'edit', 'content' => $this->boutonIco('type=edit')], ['action' => 'delete', 'content' => $this->boutonIco('type=del')] ], '' ); diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 494405d9291..0537851b28e 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -103,6 +103,12 @@ class Cosmo_DataProfileControllerIndexTest extends Cosmo_DataProfileControllerTe } + /** @test */ + public function thirdTrShouldContainsNonUsedFlag() { + $this->assertXPathContentContains('//table//tr[3]/td[4]', 'Non'); + } + + /** @test */ public function secondTrShouldContainsLinkEditKohaProfile() { $this->assertXPath('//table//tr[2]/td/a[contains(@href, "/cosmo/data-profile/edit/id/56")]'); diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 748013479b3..af566875bed 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -769,6 +769,13 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { } + public function getIsUsedLabel() { + return 0 < Class_IntMajAuto::countBy(['profil' => $this->getId()]) + ? $this->_('Oui') + : $this->_('Non'); + } + + public function getXmlPatronField() { return $this->getProfilePrefs()->getPatronXmlField(); } -- GitLab