diff --git a/library/ZendAfi/View/Helper/TagListeCoches.php b/library/ZendAfi/View/Helper/TagListeCoches.php index 8d5c8cecb605cbcd1a74e4bfe89e88358e4fa4d9..5e8f1d6ccdaa819463af892ce763d5a35883de95 100644 --- a/library/ZendAfi/View/Helper/TagListeCoches.php +++ b/library/ZendAfi/View/Helper/TagListeCoches.php @@ -66,12 +66,14 @@ class ZendAfi_View_Helper_TagListeCoches extends ZendAfi_View_Helper_BaseHelper // Texte affichage des libelles $selection = ''; - $coche = array(); + $coche = []; + $filtred_codes = []; if($valeurs) { $codes=explode(";",$valeurs); foreach($codes as $code) { if (array_key_exists($code, $liste)) { $selection.="«".$liste[$code]."» "; + $filtred_codes[] = $code; $coche[$code]=true; } } @@ -79,7 +81,7 @@ class ZendAfi_View_Helper_TagListeCoches extends ZendAfi_View_Helper_BaseHelper $cant_select_all = $this->selected_all_means_nothing ? 'true' : 'false'; // Champs code et libelle - $html = '<input id="' . $name . '" type="hidden" name="' . $name . '" value="' . $valeurs . '">'; + $html = '<input id="' . $name . '" type="hidden" name="' . $name . '" value="' . implode(';', $filtred_codes) . '">'; $html .= '<div class="tag_selection">'; $onclick = "ouvrirFermer(this,'" . $name . "_saisie');"; $html .= '<img onclick="' . $onclick . '" src="' . URL_ADMIN_IMG . 'ico/ouvrir.gif" style="margin-top:1px;margin-right:3px;float:left;cursor:pointer">'; diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php index 804263ac71a1dc63ea771412febee06702de775e..b533bd43c0a8e98d7a1bfc358b45822955abb6e0 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php @@ -907,7 +907,10 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC $this->fixture('Class_CodifGenre', ['id' => 12, 'libelle' => 'Romans']); $this->fixture('Class_CodifGenre', ['id' => 13, 'libelle' => 'BDs']); - + $this->fixture('Class_CodifGenre', ['id' => 65, 'libelle' => 'CD']); + $this->fixture('Class_CodifGenre', ['id' => 66, 'libelle' => 'DVD']); + $this->fixture('Class_CodifGenre', ['id' => 67, 'libelle' => 'Partitions']); + $this->fixture('Class_CodifLangue', ['id' => 'fre', 'libelle' => 'Français']); $this->fixture('Class_CodifLangue', ['id' => 'eng', 'libelle' => 'Anglais']); @@ -915,16 +918,23 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC $this->fixture('Class_Bib', ['id' => '74', 'libelle' => 'Annecy', 'visibilite' => 2]); $this->fixture('Class_Bib', ['id' => '77', 'libelle' => 'Lognes', 'visibilite' => 0]); - $this->fixture('Class_CodifAnnexe', ['id' => '4', + $this->fixture('Class_CodifAnnexe', ['id' => 4, 'libelle' => 'Patrimoine', 'invisible' => 1, 'code' => 32]); - $this->fixture('Class_CodifAnnexe', ['id' => '5', - 'libelle' => - 'Archives', + $this->fixture('Class_CodifAnnexe', ['id' => 5, + 'libelle' => 'Archives', 'invisible' => 0, 'code' => 33]); - + $this->fixture('Class_CodifAnnexe', ['id' => 73, + 'libelle' => 'News', + 'invisible' => 0, + 'code' => 73]); + $this->fixture('Class_CodifAnnexe', ['id' => 93, + 'libelle' => 'Bd', + 'invisible' => 0, + 'code' => 93]); + Class_Album::find(43) ->setCatId(2) ->setBibliotheques('74') @@ -1136,7 +1146,7 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC /** @test */ public function annexesAffichageShouldBeDisplayed() { - $this->assertXPath("//input[@name='annexes'][@value='73;93']"); + $this->assertXPath("//input[@name='annexes'][@value='73;93']", $this->_response->getBody()); } diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 273355f7424382cddc0c633af05f5c98164116a4..555803aa0d2d98507db529689ff89e5156d7db56 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -1294,4 +1294,28 @@ class CatalogueControllerDomaintePaniersJsonActionTest extends AbstractControlle $this->_response->getBody(),json_encode($this->_response->getBody())); } } + + + +class AdminCatalogueControllerEditCatalogueWithWrongGenre extends AbstractControllerTestCase { + public function setup() { + parent::setup(); + + Class_CodifGenre::beVolatile(); + + $this->fixture('Class_Catalogue', + ['id' => 15, + 'libelle' => 'Mon Cata', + 'description' => 'Mon catalogue', + 'genre' => 2]); + + $this->dispatch('/admin/catalogue/edit/id_catalogue/15'); + } + + + /** @test */ + public function inputGenreShouldBeEmpty() { + $this->assertXPath('//input[@name="genre"][@value=""]', $this->_response->getBody()); + } +} ?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/TypeDocsControllerTest.php b/tests/application/modules/admin/controllers/TypeDocsControllerTest.php index 911cf86688a74206402b3b035142f6ba61d90898..e51e39b194691281b20eb24a6031de85d0df5ba0 100644 --- a/tests/application/modules/admin/controllers/TypeDocsControllerTest.php +++ b/tests/application/modules/admin/controllers/TypeDocsControllerTest.php @@ -142,6 +142,23 @@ class TypeDocsControllerEditTest extends AbstractTypeDocsControllerTestCase { class TypeDocsControllerEditEPubTest extends AbstractTypeDocsControllerTestCase { public function setUp() { parent::setUp(); + + $this->fixture('Class_Bib', ['id' => '2', 'libelle' => 'Chambery', 'visibilite' => 2]); + $this->fixture('Class_Bib', ['id' => '3', 'libelle' => 'Annecy', 'visibilite' => 2]); + + $this->fixture('Class_CodifAnnexe', ['id' => 73, + 'libelle' => 'News', + 'invisible' => 0, + 'code' => 4]); + $this->fixture('Class_CodifAnnexe', ['id' => 93, + 'libelle' => 'Bd', + 'invisible' => 0, + 'code' => 8]); + + $this->fixture('Class_CodifSection', ['id' => 9, 'libelle' => 'Adultes']); + $this->fixture('Class_CodifSection', ['id' => 10, 'libelle' => 'Jeunes']); + + $this->fixture('Class_CodifTypeDoc', ['id' => 102, 'famille_id' => Class_CodifTypeDoc::LIVRE, 'bibliotheques' => '2;3',