Skip to content
Snippets Groups Projects
Commit 23d1d7c9 authored by Jean-Christophe Gachod's avatar Jean-Christophe Gachod Committed by Laurent
Browse files

type doc suggestion achat nanook

parent 056132c7
Branches
Tags
3 merge requests!2080Sandbox detach zf from storm,!1940Dev#48981 3455 lier des cartes via bokeh,!1929Dev#48981 3455 lier des cartes via bokeh
......@@ -30,6 +30,10 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio
public function init() {
parent::init();
$sorted_type_docs = Class_TypeDoc::getUserFriendlyTypeDocs();
asort($sorted_type_docs, SORT_NATURAL | SORT_FLAG_CASE);
$this
->addElement('text', 'Title', ['label' => $this->_('Titre').' *',
......@@ -60,7 +64,12 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio
'value' => Class_Users::getIdentity()->getLibelleBib(),
'disabled' => true])
->addDisplayGroup(['Title',
->addElement('select', 'DocType', ['label' => $this->_('Type de document').' *',
'multioptions' => $sorted_type_docs,
'value' => Class_TypeDoc::LIVRE])
->addDisplayGroup(['DocType',
'Title',
'Author',
'Isbn',
'Library'],
......@@ -75,4 +84,4 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio
->addElement('submit', 'submit', ['label' => $this->_('Envoyer')]);
}
}
?>
\ No newline at end of file
?>
......@@ -107,8 +107,10 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
$url = $this->buildQueryURL(['service' => 'CreateSuggest',
'patronId' => $suggestion->getUser()->getIdSigb()]);
$doctype_label = Class_TypeDoc::find($suggestion->getDocType())->getLibelle();
$post_data = ['site' => (($user = Class_Users::getIdentity()) ? $user->getLibraryId() : 0),
'title' => $suggestion->getTitle(),
'title' => '[' . $doctype_label . '] ' . $suggestion->getTitle(),
'author' => $suggestion->getAuthor(),
'isbnean' => $suggestion->getIsbn(),
'desclink' => $suggestion->getUrl(),
......@@ -269,4 +271,4 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
return $this->_error_codes[$code];
}
}
?>
\ No newline at end of file
?>
......@@ -74,7 +74,7 @@ abstract class AbstractAbonneControllerSuggestionAchatNanookTestCase extends Abs
->whenCalled('postData')
->with('http://nanookService/service/CreateSuggest/patronId/187',
['site' => '12',
'title' => 'fu',
'title' => '[Livres] fu',
'author' => 'mf',
'isbnean' => '2-07-0541 27_4',
'desclink' => '',
......@@ -84,7 +84,7 @@ abstract class AbstractAbonneControllerSuggestionAchatNanookTestCase extends Abs
->whenCalled('postData')
->with('http://nanookService/service/CreateSuggest/patronId/187',
['site' => '12',
'title' => 'fu',
'title' => '[DVD] fu',
'author' => 'Ye',
'isbnean' => '2-07-0541 27_4',
'desclink' => '',
......@@ -195,6 +195,26 @@ class AbonneControllerSuggestionAchatNanookAddTest extends AbstractAbonneControl
public function formShouldContainsSite() {
$this->assertXPath('//form//input[@name="Library"][@value="Tatim bib"][@disabled="1"]');
}
/** @test */
public function formShouldContainsSelectForDocType() {
$this->assertXPathContentContains('//form//select[@name="DocType"]//option[@value="3"]',
'Disques');
}
/** @test */
public function docTypeForDiscsShouldBeAtFirstPlace() {
$this->assertXPathContentContains('//form//select[@name="DocType"]//option[1]', 'Disques');
}
/** @test */
public function defaultDocTypeShouldBeBook() {
$this->assertXPathContentContains('//form//select[@name="DocType"]//option[@value="1"][@selected]',
'Livres');
}
}
......@@ -208,7 +228,8 @@ class AbonneControllerSuggestionAchatNanookAddPostTest extends AbstractAbonneCon
$mock_transport = new MockMailTransport();
Zend_Mail::setDefaultTransport($mock_transport);
$this->postDispatch('/opac/abonne/suggestion-achat-add', ['Site' => '12',
$this->postDispatch('/opac/abonne/suggestion-achat-add', ['DocType' => Class_TypeDoc::LIVRE,
'Site' => '12',
'Title' => 'fu',
'Author' => 'mf',
'Isbn' => '2-07-0541 27_4',
......@@ -240,7 +261,8 @@ class AbonneControllerSuggestionAchatNanookAddPostErrorsTest extends AbstractAbo
$mock_transport = new MockMailTransport();
Zend_Mail::setDefaultTransport($mock_transport);
$this->postDispatch('/opac/abonne/suggestion-achat-add', ['Site' => '12',
$this->postDispatch('/opac/abonne/suggestion-achat-add', ['DocType' => Class_TypeDoc::DVD,
'Site' => '12',
'Title' => 'fu',
'Author' => 'Ye',
'Isbn' => '2-07-0541 27_4',
......
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