diff --git a/VERSIONS_HOTLINE/113404 b/VERSIONS_HOTLINE/113404 new file mode 100644 index 0000000000000000000000000000000000000000..113ba36cb1ea43fb61922b7b10691d33d14a8de0 --- /dev/null +++ b/VERSIONS_HOTLINE/113404 @@ -0,0 +1 @@ + - ticket #113404 : Magasin de thème : Correction d'une erreur possible lors de la création d'une suggestion d'achat \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Koha/BuySuggestForm.php b/library/Class/WebService/SIGB/Koha/BuySuggestForm.php index 0925c8593772c7b500366f2472b3a85c57d5528f..6c27c7fe9cb2fbc449ea02e627698b665528f483 100644 --- a/library/Class/WebService/SIGB/Koha/BuySuggestForm.php +++ b/library/Class/WebService/SIGB/Koha/BuySuggestForm.php @@ -85,5 +85,16 @@ class Class_WebService_SIGB_Koha_BuySuggestForm extends ZendAfi_Form_SuggestionA ->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]); } + + + /** @return string */ + public function titleValue() { + return $this->getValue('Title'); + } + + + /** @return string */ + public function authorValue() { + return $this->getValue('Author'); + } } -?> \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php b/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php index b053bc092ba16efa7d64c48fa57589c13b4d8d77..3d4a3e9b6bf003142d6671cf3472467650464302 100644 --- a/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php +++ b/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php @@ -95,5 +95,16 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio ->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]); } + + + /** @return string */ + public function titleValue() { + return $this->getValue('Title'); + } + + + /** @return string */ + public function authorValue() { + return $this->getValue('Author'); + } } -?> diff --git a/library/ZendAfi/Form/SuggestionAchat.php b/library/ZendAfi/Form/SuggestionAchat.php index d7ec5dde9844e8d5cb7bf561a3f4f88e41366fd1..2c762ba0b3f899ffd80db312e9ea08f712262d30 100644 --- a/library/ZendAfi/Form/SuggestionAchat.php +++ b/library/ZendAfi/Form/SuggestionAchat.php @@ -102,4 +102,16 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form_SuggestionAchat_Abstract $this->removeElement('submit'); return $this; } + + + /** @return string */ + public function titleValue() { + return $this->getValue('titre'); + } + + + /** @return string */ + public function authorValue() { + return $this->getValue('auteur'); + } } diff --git a/library/ZendAfi/Form/SuggestionAchat/Abstract.php b/library/ZendAfi/Form/SuggestionAchat/Abstract.php index 76555df9ef29a4cd4991076ccbb180e25b6328f3..20ee177b367466a9b8a7a35f1cc0355b490aa332 100644 --- a/library/ZendAfi/Form/SuggestionAchat/Abstract.php +++ b/library/ZendAfi/Form/SuggestionAchat/Abstract.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_Form_SuggestionAchat_Abstract extends ZendAfi_Form { +abstract class ZendAfi_Form_SuggestionAchat_Abstract extends ZendAfi_Form { protected $_user; @@ -53,4 +53,12 @@ class ZendAfi_Form_SuggestionAchat_Abstract extends ZendAfi_Form { ->setAttrib('id', 'suggestion') ->setAttrib('class', 'zend_form'); } + + + /** @return string */ + abstract public function titleValue(); + + + /** @return string */ + abstract public function authorValue(); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php index 97ef534e223a21c13b21f116d4fe5b2df09e0bc5..1a1c2670e715b5804f1e72a6914537fc7414422e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php @@ -63,8 +63,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_NewSuggestion extends Int if ($this->_records) { $html [] = $this->_view->tag('p', $this->_('Les documents suivants sont dans le catalogue.')); $html [] = $this->_view->tag('p', $this->_('Votre suggestion %s de %s en fait-elle partie ?', - $this->_form->getElement('Title')->getValue(), - $this->_form->getElement('Author')->getValue())); + $this->_form->titleValue(), + $this->_form->authorValue())); $html [] = $this->_view->button(new Class_Entity(['Text' => $this->_('Oui'), 'Url' => $this->_view->url(['action' => 'suggestion-achat']), diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index d5fd63eaaa371f478ada9082c3e96093764f1b76..c661221273ac90178efc50e99988de8dd43a4435 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -5471,6 +5471,66 @@ class TemplatesSuggestionAchatAddTest extends TemplatesIntonationTestCase { +class TemplatesSuggestionAchatAddPostWithSearchRecordTest extends TemplatesIntonationTestCase { + public function setUp() { + parent::setUp(); + + Class_AdminVar::set('SEARCH_RECORD_BEFORE_SUGGEST', 1); + + $search_result = $this->mock() + ->whenCalled('fetchRecords') + ->answers([$this->fixture('Class_Notice', ['id' => 12])]); + + Class_MoteurRecherche::setInstance($this->mock() + ->whenCalled('lancerRecherche') + ->answers($search_result)); + + Class_Profil::find(72) + ->setModulePreference('abonne', + 'suggestion-achat-add', + 'help-text', + 'Entrez votre suggestion'); + + $this->postDispatch('/opac/abonne/suggestion-achat-add/id_profil/72', + ['titre' => 'Les Dieux eux-même', + 'auteur' => 'Isaac Asimov', + 'type_doc_id' => '1', + 'description_url' => '', + 'isbn' => '', + 'bib_id' => '2', + 'commentaire' => 'Indispensable', + 'submit' => 'Envoyer']); + } + + + public function tearDown() { + Class_MoteurRecherche::setInstance(null); + parent::tearDown(); + } + + + /** @test */ + public function pageShouldContainsIsYourSuggestionInResult() { + $this->assertXPathContentContains('//p', + 'Votre suggestion Les Dieux eux-même de Isaac Asimov en fait-elle partie ?'); + } + + + /** @test */ + public function pageShouldContainsYesChoice() { + $this->assertXPathContentContains('//button', 'Oui'); + } + + + /** @test */ + public function pageShouldContainsNoChoice() { + $this->assertXPathContentContains('//button', 'Non'); + } +} + + + + class TemplatesDispatchLibraryWidgetWithOSMTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp();