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

hotline #76601 fix RT

parent 109d33b3
Branches
Tags
3 merge requests!2723Master,!2721Hotline,!2709Hotline#76601 inscription non effective a notre newsletter
Pipeline #4492 passed with stage
in 34 minutes and 36 seconds
......@@ -292,8 +292,7 @@ class Class_Newsletter extends Storm_Model_Abstract {
public function subscribeToDedicatedGroup($user) {
Class_UserGroupMembership::newInstance(['user_group' => $this->getDedicatedGroup(),
'user' => $user])->save();
$this->getDedicatedGroup()->addUserOptimized($user);
return $this;
}
......
......@@ -82,11 +82,11 @@ class UserGroupLoader extends Storm_Model_Loader {
protected function _addUsersByIdsTo($ids, $group) {
foreach($ids as $id)
$this->_addUserByIdTo($id, $group);
Class_UserGroup::addUserByIdTo($id, $group);
}
protected function _addUserByIdTo($id, $group) {
public function addUserByIdTo($id, $group) {
Class_UserGroupMembership::newInstance(['user_id' => $id,
'user_group_id' => $group->getId()])
->save();
......@@ -94,6 +94,8 @@ class UserGroupLoader extends Storm_Model_Loader {
}
class Class_UserGroup extends Storm_Model_Abstract {
use Trait_TreeViewableItem, Trait_HasManyDomaines;
......@@ -622,4 +624,9 @@ class Class_UserGroup extends Storm_Model_Abstract {
$this->getLoader()->usersPaginatedDo($this, $closure);
return $this;
}
public function addUserOptimized($user) {
$this->getLoader()->addUserByIdTo($user->getId(), $this);
}
}
\ No newline at end of file
......@@ -1027,7 +1027,9 @@ class Class_Users extends Storm_Model_Abstract {
$this->checkAttribute('password', mb_strlen($this->getPassword(),
'UTF-8') <= 255, $this->_("Le champ 'Mot de passe' doit être inférieur à 255 caractères"));
if ($this->getRoleLevel() > 1 and $this->getRoleLevel() < 5 and $this->getIdSite() == 0) {
if ($this->getRoleLevel() > ZendAfi_Acl_AdminControllerRoles::ABONNE
and $this->getRoleLevel() < ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL
and $this->getIdSite() == 0) {
$cls_role= new ZendAfi_Acl_AdminControllerRoles();
$this->addError($this->_("La bibliothèque est obligatoire pour le rôle : %s",
$cls_role->getLibelleRole($this->getRoleLevel())));
......
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