Skip to content
Snippets Groups Projects
Commit 40ed43aa authored by llaffont's avatar llaffont
Browse files

Suggestions d'achat: affichage nom + carte abonnée côté admin

parent 76ec13e6
Branches
Tags
No related merge requests found
......@@ -7,9 +7,9 @@
} else {
echo $this->tagModelTable($this->suggestions,
[$this->_('Date'), $this->_('Titre'), $this->_('Auteur')],
[$this->_('Date'), $this->_('Titre'), $this->_('Auteur'), $this->_('N° abonné'), $this->_('Compte')],
['date_creation', 'titre', 'auteur'],
['date_creation', 'titre', 'auteur', 'idabon', 'compte'],
[ ['action' => 'suggestion-achat-edit', 'content' => $this->boutonIco('type=edit')],
['action' => 'suggestion-achat-delete', 'content' => $this->boutonIco('type=del')] ],
......
<?php
echo $this->tagModelTable($this->suggestions,
[$this->_('Date'), $this->_('Titre'), $this->_('Auteur')],
[$this->_('Date'), $this->_('Titre'), $this->_('Auteur'), $this->_('N° abonné')],
['date_creation', 'titre', 'auteur'],
['date_creation', 'titre', 'auteur', 'idabon'],
[ ['action' => 'edit', 'content' => $this->boutonIco('type=edit')],
['action' => 'delete', 'content' => $this->boutonIco('type=del')] ],
......
......@@ -26,7 +26,9 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
protected $_belongs_to = ['user' => ['model' => 'Class_Users',
'referenced_in' => 'user_id']];
protected $_default_attribute_values = ['date_creation' => ''];
protected $_default_attribute_values = ['date_creation' => '',
'titre' => '',
'auteur' => ''];
public function setIsbn($isbn) {
return parent::_set('isbn', preg_replace('/[\s\.\-\_]/', '', (string)$isbn));
......@@ -93,5 +95,19 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
$mail->send();
}
public function getIdabon() {
if ($this->hasUser() && $this->getUser()->isAbonne())
return $this->getUser()->getIdabon();
return '';
}
public function getCompte() {
if ($this->hasUser())
return $this->getUser()->getNomComplet();
return '';
}
}
?>
\ No newline at end of file
......@@ -77,12 +77,27 @@ abstract class ModoControllerSuggestionAchatTestCase extends Admin_AbstractContr
->setAuteur('J.K.Rowling')
->setIsbn('1234567890')
->setDescriptionUrl('http://harrypotter.fr')
->setCommentaire('Je veux le lire'),
->setCommentaire('Je veux le lire')
->setUser(Class_Users::newInstanceWithId(6)
->setIdabon('3435')
->beAbonneSIGB()
->setPrenom('Petit')
->setNom('Poucet')),
Class_SuggestionAchat::newInstanceWithId(3)
->setDateCreation('2012-03-02')
->setTitre('Millenium')
->setAuteur('Stieg Larsson')
->setAuteur('Stieg Larsson'),
Class_SuggestionAchat::newInstanceWithId(3)
->setDateCreation('2012-03-19')
->setTitre('Habibi')
->setCommentaire('Une bonne BD')
->setUser(Class_Users::newInstanceWithId(10)
->beInvite()
->setIdabon('0')
->setPrenom('Marcel')
->setNom('Duchamp'))
]);
}
}
......@@ -114,6 +129,12 @@ class ModoControllerSuggestionAchatActionTest extends ModoControllerSuggestionAc
}
/** @test */
public function firstRowTDShouldContainsIdAbon3435() {
$this->assertXPathContentContains('//tr[1]//td', '3435');
}
/** @test */
public function firstRowTDShouldContainsDateCreation2012_03_01() {
$this->assertXPathContentContains('//tr[1]//td', '2012-03-01');
......@@ -136,6 +157,18 @@ class ModoControllerSuggestionAchatActionTest extends ModoControllerSuggestionAc
public function secondRowTDShouldContainsMillenium() {
$this->assertXPathContentContains('//tr[2]//td', 'Millenium');
}
/** @test */
public function thirdRowTDIdAbonShouldBeEmpty() {
$this->assertNotXPathContentContains('//tr[3]//td[4]', '0');
}
/** @test */
public function fourthRowTDShouldContainsMarcelDuchamp() {
$this->assertXPathContentContains('//tr[3]//td[5]', 'Marcel Duchamp');
}
}
......
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