Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
afi
opacce
Commits
8e08b44f
Commit
8e08b44f
authored
Jul 09, 2018
by
Ghislain Loas
Browse files
dev #74786 : fix big bang with patrons
parent
0c4770d7
Pipeline
#4544
failed with stage
in 51 minutes and 16 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
45 deletions
+54
-45
application/modules/opac/controllers/AbonneController.php
application/modules/opac/controllers/AbonneController.php
+15
-13
application/modules/opac/controllers/AuthController.php
application/modules/opac/controllers/AuthController.php
+10
-3
library/Class/Users.php
library/Class/Users.php
+0
-26
library/Class/WebService/SIGB/Emprunteur.php
library/Class/WebService/SIGB/Emprunteur.php
+16
-0
library/ZendAfi/Controller/Plugin/Manager/User.php
library/ZendAfi/Controller/Plugin/Manager/User.php
+13
-3
No files found.
application/modules/opac/controllers/AbonneController.php
View file @
8e08b44f
...
@@ -611,24 +611,26 @@ class AbonneController extends ZendAfi_Controller_Action {
...
@@ -611,24 +611,26 @@ class AbonneController extends ZendAfi_Controller_Action {
Class_Newsletter
::
findAllBy
([
'id'
=>
$subscriptions
])
:
Class_Newsletter
::
findAllBy
([
'id'
=>
$subscriptions
])
:
[];
[];
try
{
$password
=
$this
->
_request
->
getParam
(
'password'
);
$password
=
$this
->
_request
->
getParam
(
'password'
);
if
(
empty
(
$password
))
if
(
empty
(
$password
))
$password
=
$this
->
_user
->
getPassword
();
$password
=
$this
->
_user
->
getPassword
();
$this
->
_user
->
updateSIGBOnSave
();
$fields_to_save
=
Class_AdminVar
::
getChampsFicheUtilisateur
();
$attributes
=
[];
foreach
(
$fields_to_save
as
$field
)
$attributes
[
$field
]
=
$this
->
_request
->
getParam
(
$field
);
$fields_to_save
=
Class_AdminVar
::
getChampsFicheUtilisateur
();
$this
->
_user
$attributes
=
[];
->
updateAttributes
(
$attributes
)
foreach
(
$fields_to_save
as
$fiel
d
)
->
setPassword
(
$passwor
d
)
$attributes
[
$field
]
=
$this
->
_request
->
getParam
(
$field
);
->
setNewsletters
(
$newsletters
);
$this
->
_user
$patron
=
$this
->
_user
->
getEmprunteur
();
->
updateAttributes
(
$attributes
)
$patron
->
updateFromUser
(
$this
->
_user
);
->
setPassword
(
$password
)
->
setNewsletters
(
$newsletters
);
try
{
if
(
$this
->
_user
->
save
())
{
if
(
$this
->
_user
->
save
())
{
$patron
->
ensureService
(
$this
->
_user
)
->
save
();
$this
->
_helper
->
notify
(
$this
->
_
(
'Vos modifications ont bien été enregistrées'
));
$this
->
_helper
->
notify
(
$this
->
_
(
'Vos modifications ont bien été enregistrées'
));
$this
->
_redirect
(
'/abonne/fiche'
);
$this
->
_redirect
(
'/abonne/fiche'
);
}
}
...
...
application/modules/opac/controllers/AuthController.php
View file @
8e08b44f
...
@@ -343,11 +343,18 @@ class AuthController extends ZendAfi_Controller_Action {
...
@@ -343,11 +343,18 @@ class AuthController extends ZendAfi_Controller_Action {
||
!
$form
->
isValid
(
$this
->
_request
->
getPost
()))
||
!
$form
->
isValid
(
$this
->
_request
->
getPost
()))
return
;
return
;
$user
->
setPassword
(
$form
->
getValue
(
'new_pass'
))
$user
->
setPassword
(
$form
->
getValue
(
'new_pass'
));
->
save
();
$patron
=
$user
->
getEmprunteur
();
$patron
->
updateFromUser
(
$user
);
try
{
if
(
$user
->
save
())
$patron
->
ensureService
(
$user
)
->
save
();
}
catch
(
Exception
$e
)
{
$this
->
_helper
->
notify
(
$e
->
getMessage
());
return
$this
->
_redirect
(
'/auth/login'
);
}
$this
->
_helper
->
notify
(
$this
->
_
(
'Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'
));
$this
->
_helper
->
notify
(
$this
->
_
(
'Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'
));
$this
->
_redirect
(
'/auth/login'
);
$this
->
_redirect
(
'/auth/login'
);
}
}
...
...
library/Class/Users.php
View file @
8e08b44f
...
@@ -1333,12 +1333,6 @@ class Class_Users extends Storm_Model_Abstract {
...
@@ -1333,12 +1333,6 @@ class Class_Users extends Storm_Model_Abstract {
}
}
public
function
updateSIGBOnSave
()
{
$this
->
getFicheSigb
();
return
$this
;
}
public
function
setFicheSIGB
(
$fiche
)
{
public
function
setFicheSIGB
(
$fiche
)
{
$this
->
_fiche_sigb
=
$fiche
;
$this
->
_fiche_sigb
=
$fiche
;
return
$this
;
return
$this
;
...
@@ -1364,30 +1358,10 @@ class Class_Users extends Storm_Model_Abstract {
...
@@ -1364,30 +1358,10 @@ class Class_Users extends Storm_Model_Abstract {
}
}
/**
* Hook AbstractModel::save
* Sauvegarde des données compte lecteur sur le SIGB
*/
public
function
afterSave
()
{
$this
->
getEmprunteur
()
->
ensureService
(
$this
)
->
save
(
$this
);
}
public
function
beforeSave
()
{
public
function
beforeSave
()
{
$this
->
setDateMaj
(
Class_Multimedia_Utils_DateTimeFormat
::
getInstance
()
$this
->
setDateMaj
(
Class_Multimedia_Utils_DateTimeFormat
::
getInstance
()
->
getCurrentDateFormatInYmdHMS
());
->
getCurrentDateFormatInYmdHMS
());
$this
->
getEmprunteur
()
->
setNom
(
$this
->
getNom
())
->
setPrenom
(
$this
->
getPrenom
())
->
setEMail
(
$this
->
getMail
())
->
setPassword
(
$this
->
getPassword
())
->
setTelephone
(
$this
->
getTelephone
())
->
setIsContactSms
(
$this
->
getIsContactSms
())
->
setIsContactEmail
(
$this
->
getIsContactMail
())
->
setLogin
(
$this
->
getLogin
())
;
$this
->
setPassword
((
new
Class_User_Password
(
$this
))
->
format
());
$this
->
setPassword
((
new
Class_User_Password
(
$this
))
->
format
());
}
}
...
...
library/Class/WebService/SIGB/Emprunteur.php
View file @
8e08b44f
...
@@ -744,6 +744,22 @@ class Class_WebService_SIGB_Emprunteur {
...
@@ -744,6 +744,22 @@ class Class_WebService_SIGB_Emprunteur {
}
}
public
function
updateFromUser
(
$user
)
{
$this
->
setNom
(
$user
->
getNom
())
->
setPrenom
(
$user
->
getPrenom
())
->
setEMail
(
$user
->
getMail
())
->
setPassword
(
$user
->
getPassword
())
->
setTelephone
(
$user
->
getTelephone
())
->
setIsContactSms
(
$user
->
getIsContactSms
())
->
setIsContactEmail
(
$user
->
getIsContactMail
())
->
setLogin
(
$user
->
getLogin
())
;
return
$this
;
}
/**
/**
* @codeCoverageIgnore
* @codeCoverageIgnore
* @return string
* @return string
...
...
library/ZendAfi/Controller/Plugin/Manager/User.php
View file @
8e08b44f
...
@@ -98,10 +98,20 @@ class ZendAfi_Controller_Plugin_Manager_User extends ZendAfi_Controller_Plugin_M
...
@@ -98,10 +98,20 @@ class ZendAfi_Controller_Plugin_Manager_User extends ZendAfi_Controller_Plugin_M
}
}
protected
function
_setupFormAndSave
(
$model
)
{
protected
function
_doBeforeSave
(
$model
)
{
if
(
$this
->
_request
->
isPost
())
parent
::
_doBeforeSave
(
$model
);
$model
->
updateSIGBOnSave
();
$model
->
getEmprunteur
()
->
updateFromUser
(
$model
);
return
$this
;
}
protected
function
_doAfterSave
(
$model
)
{
$model
->
getEmprunteur
()
->
ensureService
(
$model
)
->
save
();
return
parent
::
_doAfterSave
(
$model
);
}
protected
function
_setupFormAndSave
(
$model
)
{
try
{
try
{
return
parent
::
_setupFormAndSave
(
$model
);
return
parent
::
_setupFormAndSave
(
$model
);
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment