Skip to content
Snippets Groups Projects
Commit f431fd69 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #113404 : fix error on suggest creation

parent 6904ff72
Branches
Tags
2 merge requests!3578Hotline,!3570hotline #113404 : fix error on suggest creation
Pipeline #10599 passed with stage
in 45 minutes and 12 seconds
- 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
...@@ -85,5 +85,16 @@ class Class_WebService_SIGB_Koha_BuySuggestForm extends ZendAfi_Form_SuggestionA ...@@ -85,5 +85,16 @@ class Class_WebService_SIGB_Koha_BuySuggestForm extends ZendAfi_Form_SuggestionA
->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]); ->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
...@@ -95,5 +95,16 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio ...@@ -95,5 +95,16 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio
->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]); ->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]);
} }
/** @return string */
public function titleValue() {
return $this->getValue('Title');
}
/** @return string */
public function authorValue() {
return $this->getValue('Author');
}
} }
?>
...@@ -102,4 +102,16 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form_SuggestionAchat_Abstract ...@@ -102,4 +102,16 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form_SuggestionAchat_Abstract
$this->removeElement('submit'); $this->removeElement('submit');
return $this; return $this;
} }
/** @return string */
public function titleValue() {
return $this->getValue('titre');
}
/** @return string */
public function authorValue() {
return $this->getValue('auteur');
}
} }
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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; protected $_user;
...@@ -53,4 +53,12 @@ class ZendAfi_Form_SuggestionAchat_Abstract extends ZendAfi_Form { ...@@ -53,4 +53,12 @@ class ZendAfi_Form_SuggestionAchat_Abstract extends ZendAfi_Form {
->setAttrib('id', 'suggestion') ->setAttrib('id', 'suggestion')
->setAttrib('class', 'zend_form'); ->setAttrib('class', 'zend_form');
} }
/** @return string */
abstract public function titleValue();
/** @return string */
abstract public function authorValue();
} }
...@@ -63,8 +63,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_NewSuggestion extends Int ...@@ -63,8 +63,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_NewSuggestion extends Int
if ($this->_records) { if ($this->_records) {
$html [] = $this->_view->tag('p', $this->_('Les documents suivants sont dans le catalogue.')); $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 ?', $html [] = $this->_view->tag('p', $this->_('Votre suggestion %s de %s en fait-elle partie ?',
$this->_form->getElement('Title')->getValue(), $this->_form->titleValue(),
$this->_form->getElement('Author')->getValue())); $this->_form->authorValue()));
$html [] = $this->_view->button(new Class_Entity(['Text' => $this->_('Oui'), $html [] = $this->_view->button(new Class_Entity(['Text' => $this->_('Oui'),
'Url' => $this->_view->url(['action' => 'suggestion-achat']), 'Url' => $this->_view->url(['action' => 'suggestion-achat']),
......
...@@ -5471,6 +5471,66 @@ class TemplatesSuggestionAchatAddTest extends TemplatesIntonationTestCase { ...@@ -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 { class TemplatesDispatchLibraryWidgetWithOSMTest extends TemplatesIntonationTestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment