diff --git a/VERSIONS_HOTLINE/106412 b/VERSIONS_HOTLINE/106412 new file mode 100644 index 0000000000000000000000000000000000000000..b21c6a0d4ef715c92de9e8a64bab6c9ee575dbdc --- /dev/null +++ b/VERSIONS_HOTLINE/106412 @@ -0,0 +1 @@ + - 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 diff --git a/library/Class/User/SearchCriteria/RoleLevel.php b/library/Class/User/SearchCriteria/RoleLevel.php index 8b012e06b7167115a0a1348339f057cb90ebf9eb..b44c989f03d8c352be0d7d3f97cbbf81b7f01f59 100644 --- a/library/Class/User/SearchCriteria/RoleLevel.php +++ b/library/Class/User/SearchCriteria/RoleLevel.php @@ -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)); } diff --git a/tests/application/modules/telephone/controllers/IndexControllerTest.php b/tests/application/modules/telephone/controllers/IndexControllerTest.php index 45580461e2af2b60016b519fab8dd0b4970b6b0e..f7f0d750765706063ff83dfb780cc36667c5a673 100644 --- a/tests/application/modules/telephone/controllers/IndexControllerTest.php +++ b/tests/application/modules/telephone/controllers/IndexControllerTest.php @@ -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()); + } }