Commit 09e5634b authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'hotline#106412_probleme_version_mobile' into 'hotline'

hotline #106412 : fix adding js on search criteria construct

See merge request !3424
parents 4691db19 6222a01f
Pipeline #9654 passed with stage
in 41 minutes and 16 seconds
- ticket #106412 : Version mobile : correction d'une erreur lorsqu'un abonné faisant partie d'un groupe dynamique se connectait
\ No newline at end of file
......@@ -25,8 +25,6 @@ class Class_User_SearchCriteria_RoleLevel extends Class_SearchCriteria_Select {
public function buildElement() {
$this->_headScript();
if (!Class_Users::getIdentity())
return;
......@@ -41,6 +39,13 @@ class Class_User_SearchCriteria_RoleLevel extends Class_SearchCriteria_Select {
}
public function getElement() {
$this->_headScript();
return parent::getElement();
}
public function isAbonneSigb() {
return ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB == $this->_value;
}
......@@ -48,15 +53,15 @@ class Class_User_SearchCriteria_RoleLevel extends Class_SearchCriteria_Select {
protected function _headScript() {
$toggles = array_map(function($other)
{
return sprintf('formSelectToggleVisibilityForElement("#%s", $("#%s").closest("tr"), ["2"]);',
$this->getName(),
static::NAME_PREFIX . $other);
{
return sprintf('formSelectToggleVisibilityForElement("#%s", $("#%s").closest("tr"), ["2"]);',
$this->getName(),
static::NAME_PREFIX . $other);
},
['valid_subscription',
'end_subscription_days',
'statut',
'date_fin_start']);
['valid_subscription',
'end_subscription_days',
'statut',
'date_fin_start']);
Class_ScriptLoader::getInstance()->addJQueryReady(implode($toggles));
}
......
......@@ -21,7 +21,9 @@
require_once 'TelephoneAbstractControllerTestCase.php';
abstract class AbstractIndexControllerTelephoneWithModulesTest extends TelephoneAbstractControllerTestCase {
abstract class AbstractIndexControllerTelephoneWithModulesTest
extends TelephoneAbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
protected function _loginHook($account) {
......@@ -381,29 +383,35 @@ class IndexControllerTelephoneSimulationWithModulesTest extends AbstractIndexCon
class IndexControllerTelephoneWithModulesAndUserLoggedTest extends AbstractIndexControllerTelephoneWithModulesTest {
protected function _loginHook($account) {
$account->ROLE = "abonne_sigb";
$account->ROLE_LEVEL = 2;
$account->ID_USER = 54321;
$account->PSEUDO = "mario";
}
class IndexControllerTelephoneWithModulesAndUserLoggedTest
extends AbstractIndexControllerTelephoneWithModulesTest {
public function setUp() {
$emprunteur = Class_WebService_SIGB_Emprunteur::newInstance(2, 'mario')
->empruntsAddAll(array(Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire()))
->reservationsAddAll(array());
parent::setUp();
Class_Users::getLoader()
->newInstanceWithId(54321)
->setNom('Bros')
->setPrenom('Mario')
->setIdabon(23)
->setFicheSIGB(array('type_comm' => Class_IntBib::COM_NANOOK,
'fiche' => $emprunteur));
$emprunteur = Class_WebService_SIGB_Emprunteur::newInstance(2, 'mario')
->empruntsAddAll([Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire()])
->reservationsAddAll([]);
$this->fixture('Class_UserGroup',
['id' => 44,
'group_type' => Class_UserGroup::TYPE_DYNAMIC,
'filters' => json_encode(['search_role_level' => 2])]);
$mario = $this->fixture('Class_Users',
['id' => 54321,
'nom' => 'Bros',
'prenom' => 'Mario',
'login' => 'mariob',
'password' => 'superpass',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
'id_site' => 1,
'idabon' => '00022D2D2',
'fiche_sigb' => ['type_comm' => Class_IntBib::COM_NANOOK,
'fiche' => $emprunteur]]);
ZendAfi_Auth::getInstance()->logUser($mario);
parent::setUp();
$this->dispatch('/');
}
......@@ -412,6 +420,16 @@ class IndexControllerTelephoneWithModulesAndUserLoggedTest extends AbstractIndex
public function formLoginShouldNotBeVisible() {
$this->assertNotXPath('//form[contains(@action, "boitelogin")]');
}
/**
* @see http://forge.afi-sa.fr/issues/106412
* @test
*/
public function pageShouldNotContainsUserCriteriaJavascript() {
$this->assertNotXPathContentContains('//script', 'formSelectToggleVisibilityForElement',
$this->_response->getBody());
}
}
......
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