diff --git a/cosmogramme/VERSIONS_HOTLINE/123249 b/cosmogramme/VERSIONS_HOTLINE/123249 new file mode 100644 index 0000000000000000000000000000000000000000..a62cacb418e25b70efcb7372a07d75b4f0ed5eb5 --- /dev/null +++ b/cosmogramme/VERSIONS_HOTLINE/123249 @@ -0,0 +1 @@ + - ticket #123249 : Impossible de paramétrer le champ nouveauté en 995$0 dans cosmogramme \ No newline at end of file diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 6491a66541b5ef2ee6456f513a60e910707878c6..49916fe80e411611a800465c41e505aa7f1768be 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -427,13 +427,14 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo -class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo_DataProfileControllerTestCase { +abstract class Cosmo_DataProfileControllerUnimarcKohaFileFormatTestCase extends Cosmo_DataProfileControllerTestCase { protected $_koha; + protected $_mypostdata; public function setUp() { parent::setUp(); - $post = ['libelle' => 'New Koha', + $this->_mypostdata = ['libelle' => 'New Koha', 'accents' => Class_IntProfilDonnees::ENCODING_ISO2709, 'type_fichier' => Class_IntProfilDonnees::FT_RECORDS, 'format' => Class_IntProfilDonnees::FORMAT_UNIMARC, @@ -472,7 +473,18 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo 'loans' => 'ID_PERGAME; ID_PERGAME', 'patron_fields' => 'ORDREABON; ORDREABON']; - $this->postDispatch('cosmo/data-profile/edit/id/56', $post, true); + } +} + + + + +class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo_DataProfileControllerUnimarcKohaFileFormatTestCase { + + public function setUp() { + parent::setUp(); + + $this->postDispatch('cosmo/data-profile/edit/id/56', $this->_mypostdata, true); $this->_koha = Class_IntProfilDonnees::find(56); } @@ -613,6 +625,41 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo +class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatNoveltyTest extends Cosmo_DataProfileControllerUnimarcKohaFileFormatTestCase { + + public function setUp() { + parent::setUp(); + + $this->_mypostdata['nouveaute_zone']= [0 => '995']; + $this->_mypostdata['nouveaute_champ']= [0 => '0']; + + $this->postDispatch('cosmo/data-profile/edit/id/56', $this->_mypostdata, true); + + $this->_koha = Class_IntProfilDonnees::find(56); + } + + + /** @test */ + public function shouldRedirectToCosmoSlashDataProfileSlashEditSlashIdSlashOne() { + $this->assertRedirectTo('/cosmo/data-profile/edit/id/56'); + } + + + /** @test */ + public function noveltyLabelShouldBe995() { + $this->assertEquals(995, $this->_koha->getNoveltyLabel()); + } + + + /** @test */ + public function noveltyFieldShouldBeA() { + $this->assertEquals('0', $this->_koha->getNoveltyField()); + } +} + + + + class Cosmo_DataProfileControllerPostEditFieldsTest extends Cosmo_DataProfileControllerTestCase { protected $_nanook_profile; diff --git a/library/Class/ProfilePrefs.php b/library/Class/ProfilePrefs.php index c67d139bab3174d59d5dbbe1c8d9275cb6481d01..a7e1d86d1e2514d63faa719da27e197b17fe8063 100644 --- a/library/Class/ProfilePrefs.php +++ b/library/Class/ProfilePrefs.php @@ -102,7 +102,7 @@ class Class_ProfilePrefs extends Class_Entity { $zone_value = $this->getItemNoveltyZone(); $champ_value = $this->getItemNoveltyField(); - if(!$zone_value || !$champ_value) { + if(!$zone_value || ($champ_value === null)) { return ['nouveaute_zone' => [''], 'nouveaute_champ' => ['']]; }