Skip to content
Snippets Groups Projects
Commit 2ee2c6a9 authored by Julian Maurice's avatar Julian Maurice
Browse files

dev #15265 Add document type to "new suggestion" form

parent ded9a7c6
Branches
Tags
2 merge requests!338Dev/15265,!330Dev/15265
<?php
// Constantes
error_reporting(E_ERROR | E_PARSE);
define("VERSION_COSMOGRAMME","6.54");
define("PATCH_LEVEL","211");
define("VERSION_COSMOGRAMME","6.55");
define("PATCH_LEVEL","212");
define("APPLI","cosmogramme");
define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs");
......
......@@ -49,6 +49,7 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
public function validate() {
$this
->validateTitleOrComment()
->validateDocumentType()
->validateAttribute('description_url', 'ZendAfi_Validate_Url')
->validateAttribute('isbn', 'ZendAfi_Validate_Isbn');
}
......@@ -67,12 +68,24 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
return $this;
}
public function validateDocumentType() {
$message = $this->_('Type de document requis');
$validator = new Zend_Validate_NotEmpty();
if (!$validator->isValid($this->getDocumentType())) {
$this->checkAttribute('document_type', false, $message);
}
return $this;
}
public function sendMail($from) {
$body_text = '';
$infos = [$this->_('Titre') => $this->getTitre(),
$this->_('Auteur') => $this->getAuteur(),
$this->_('Type de document') => $this->getDocumentType(),
$this->_('ISBN') => $this->getIsbn(),
$this->_('Lien') => $this->getDescriptionUrl(),
$this->_('Demandeur') => $this->getUser()->getNomComplet(),
......@@ -127,4 +140,4 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
}
}
?>
\ No newline at end of file
?>
......@@ -33,6 +33,12 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form {
'placeholder' => 'ex: Joanne Kathleen Rowling',
'size' => 80])
->addElement('text', 'document_type', [
'label' => $this->_('Type de document') . ' *',
'placeholder' => 'ex: Livre, DVD, ...',
'size' => 80,
])
->addElement('url', 'description_url', ['label' => $this->_('Lien internet vers une description'),
'placeholder' => 'ex: http://fr.wikipedia.org/wiki/Harry_Potter_à_l\'école_des_sorciers',
'size' => 80])
......@@ -45,7 +51,7 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form {
'cols' => 80,
'rows' => 10])
->addDisplayGroup(['titre', 'auteur', 'description_url', 'isbn'],
->addDisplayGroup(['titre', 'auteur', 'document_type', 'description_url', 'isbn'],
'suggestion',
['legend' => $this->_('Informations sur le document')])
......@@ -63,4 +69,4 @@ class ZendAfi_Form_SuggestionAchat extends ZendAfi_Form {
}
}
?>
\ No newline at end of file
?>
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