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

Merge branch 'hotline_#17349_add_user_logged_info_to_contact_form' into 'hotline_6.55'

Hotline #17349 add user logged info to contact form

See merge request !521
parents 994d5d05 b1fa9820
1 merge request!529Hotline 6.56
- ticket: hotline #17349: Formulaire de contact
- Si un abonné est connecté, le formulaire sera prérempli avec ses informations
\ No newline at end of file
......@@ -63,6 +63,10 @@ class IndexController extends Zend_Controller_Action {
$this->_redirect('/');
$this->view->form = new ZendAfi_Form_ContactForm();
if($user = Class_Users::getIdentity()) {
$this->view->form->populate($user->toArray());
}
if (Class_Profil::getCurrentProfil()
->getCfgModulesPreferences('index', 'formulairecontact')['bib_selector'] == 1)
$this->view->form->displayBibSelector();
......
......@@ -368,6 +368,19 @@ class FormulaireContactActionWithBibSelectorSettingUncheckedTest extends Abstrac
public function setUp() {
parent::setUp();
$user = $this->fixture('Class_Users',
['id' => 1,
'login' => 'Tom',
'password' => 'mypassword',
'nom' => 'Joeram',
'prenom' => 'Joe',
'mail' => 'joe-joeram@afi-sa.fr',
'ville' => 'Annecy',
'code_postal' => '74000',
'adresse' => 'n°1']);
ZendAfi_Auth::getInstance()->logUser($user);
Class_Profil::getCurrentProfil()
->setCfgModules(['index' => ['formulairecontact' => ['bib_selector' => 0]]]);
......@@ -379,6 +392,12 @@ class FormulaireContactActionWithBibSelectorSettingUncheckedTest extends Abstrac
public function bibSelectorShouldNotBePresent() {
$this->assertNotXPath('//select[@name="bib_selector"]');
}
/** @test */
public function inputNameValueShouldBeJoeram() {
$this->assertXPath('//input[@name="nom"][@value="Joeram"]');
}
}
......
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