Commit 1fe6aa0a authored by Laurent's avatar Laurent

Merge branch 'hotline#113404_la_suggestion_d_achat_ne_fonctionne_plus' into 'hotline'

hotline #113404 : fix error on suggest creation

See merge request !3570
parents 6904ff72 f431fd69
Pipeline #10638 passed with stage
in 44 minutes and 43 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
->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
->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
$this->removeElement('submit');
return $this;
}
/** @return string */
public function titleValue() {
return $this->getValue('titre');
}
/** @return string */
public function authorValue() {
return $this->getValue('auteur');
}
}
......@@ -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();
}
......@@ -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']),
......
......@@ -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();
......
Markdown is supported
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