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
86b6d482
Commit
86b6d482
authored
Aug 21, 2018
by
Ghislain Loas
Browse files
hotline #78169 add inspector_gadget to provide suggest
parent
1a768b5d
Pipeline
#4757
failed with stage
in 45 minutes and 43 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
4 deletions
+53
-4
VERSIONS_HOTLINE/78169
VERSIONS_HOTLINE/78169
+2
-0
application/modules/opac/controllers/AbonneController.php
application/modules/opac/controllers/AbonneController.php
+4
-2
library/ZendAfi/Controller/Plugin/InspectorGadget.php
library/ZendAfi/Controller/Plugin/InspectorGadget.php
+9
-2
tests/application/modules/opac/controllers/IndexControllerTest.php
...lication/modules/opac/controllers/IndexControllerTest.php
+38
-0
No files found.
VERSIONS_HOTLINE/78169
0 → 100644
View file @
86b6d482
- ticket #78169 : Compte lecteur : ajout de l'inspecteur gadget dans l'écran d'ajout de suggestions d'achat
\ No newline at end of file
application/modules/opac/controllers/AbonneController.php
View file @
86b6d482
...
@@ -946,6 +946,7 @@ class AbonneController extends ZendAfi_Controller_Action {
...
@@ -946,6 +946,7 @@ class AbonneController extends ZendAfi_Controller_Action {
}
}
$form
=
ZendAfi_Form_SuggestionAchat
::
forUser
(
$this
->
_user
);
$form
=
ZendAfi_Form_SuggestionAchat
::
forUser
(
$this
->
_user
);
$form
->
setAction
(
$this
->
view
->
url
());
if
(
$this
->
_request
->
isPost
())
{
if
(
$this
->
_request
->
isPost
())
{
$post
=
$this
->
_request
->
getPost
();
$post
=
$this
->
_request
->
getPost
();
...
@@ -961,11 +962,12 @@ class AbonneController extends ZendAfi_Controller_Action {
...
@@ -961,11 +962,12 @@ class AbonneController extends ZendAfi_Controller_Action {
try
{
try
{
$suggestion
->
sendMail
(
'noreply@'
.
$this
->
_request
->
getHttpHost
());
$suggestion
->
sendMail
(
'noreply@'
.
$this
->
_request
->
getHttpHost
());
}
catch
(
Zend_Mail_Exception
$e
)
{
}
catch
(
Zend_Mail_Exception
$e
)
{
$this
->
_helper
->
notify
(
$this
->
_
(
'Aucun courriel envoyé, erreur: '
)
.
$this
->
_
(
$e
->
getMessage
()));
$this
->
_helper
->
notify
(
$this
->
_
(
'Aucun courriel envoyé, erreur: %s'
,
$this
->
_
(
$e
->
getMessage
())));
}
}
$this
->
_helper
->
notify
(
$this
->
_
(
'Suggestion d\'achat enregistrée'
));
$this
->
_helper
->
notify
(
$this
->
_
(
'Suggestion d\'achat enregistrée'
));
$this
->
_redirect
(
'/opac/abonne/
suggestion-achat'
);
return
$this
->
_redirect
(
Class_Url
::
absolute
(
$this
->
view
->
url
([
'action'
=>
'
suggestion-achat'
]))
);
}
}
}
}
...
...
library/ZendAfi/Controller/Plugin/InspectorGadget.php
View file @
86b6d482
...
@@ -24,7 +24,9 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
...
@@ -24,7 +24,9 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
const
PARAM_NAME
=
'inspector_gadget'
;
const
PARAM_NAME
=
'inspector_gadget'
;
protected
$_enabled
=
false
,
protected
$_enabled
=
false
,
$_keep
=
false
,
$_calls
=
[],
$_calls
=
[],
$_buttons
=
[],
$_buttons
=
[],
$_session
,
$_session
,
...
@@ -32,7 +34,9 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
...
@@ -32,7 +34,9 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
public
function
preDispatch
(
Zend_Controller_Request_Abstract
$request
)
{
public
function
preDispatch
(
Zend_Controller_Request_Abstract
$request
)
{
$this
->
_session
=
Zend_Registry
::
get
(
'session'
);
$this
->
_session
=
Zend_Registry
::
get
(
'session'
);
$this
->
_keep
=
(
'keep'
==
$request
->
getParam
(
self
::
PARAM_NAME
));
$this
->
_calls
=
$this
->
_session
->
inspectorCalls
;
$this
->
_calls
=
$this
->
_session
->
inspectorCalls
;
if
((
!
$request
->
getParam
(
self
::
PARAM_NAME
,
false
))
&&
(
!
$this
->
_calls
))
if
((
!
$request
->
getParam
(
self
::
PARAM_NAME
,
false
))
&&
(
!
$this
->
_calls
))
return
;
return
;
...
@@ -154,7 +158,10 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
...
@@ -154,7 +158,10 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
foreach
(
array_filter
(
$this
->
_calls
,
'is_object'
)
as
$call
)
foreach
(
array_filter
(
$this
->
_calls
,
'is_object'
)
as
$call
)
$items
[]
=
$this
->
_view
->
tag
(
'li'
,
$call
->
renderOn
(
$this
->
_view
));
$items
[]
=
$this
->
_view
->
tag
(
'li'
,
$call
->
renderOn
(
$this
->
_view
));
$this
->
_session
->
inspectorCalls
=
[];
if
(
!
$this
->
_keep
)
$this
->
_session
->
inspectorCalls
=
[];
$content
=
$this
->
_view
->
tag
(
'ol'
,
implode
(
''
,
$items
));
$content
=
$this
->
_view
->
tag
(
'ol'
,
implode
(
''
,
$items
));
return
$this
return
$this
...
...
tests/application/modules/opac/controllers/IndexControllerTest.php
View file @
86b6d482
...
@@ -674,6 +674,44 @@ class IndexControllerInspectorGadgetTest extends AbstractControllerTestCase {
...
@@ -674,6 +674,44 @@ class IndexControllerInspectorGadgetTest extends AbstractControllerTestCase {
class
IndexControllerInspectorGadgetKeepTest
extends
AbstractControllerTestCase
{
/** @test */
public
function
sessionShouldBeEmpty
()
{
$this
->
dispatch
(
'/index/index/inspector_gadget/keep'
,
true
);
$session
=
Zend_Registry
::
get
(
'session'
);
$calls
=
isset
(
$session
->
inspectorCalls
)
?
$session
->
inspectorCalls
:
[];
$this
->
assertEquals
([],
$calls
);
}
/** @test */
public
function
sessionShouldContainsStringTest
()
{
$session
=
Zend_Registry
::
get
(
'session'
);
$session
->
inspectorCalls
=
[
serialize
(
'test'
)];
$this
->
dispatch
(
'/index/index/inspector_gadget/keep'
,
true
);
$calls
=
isset
(
$session
->
inspectorCalls
)
?
$session
->
inspectorCalls
:
[];
$this
->
assertEquals
([
's:4:"test";'
],
$calls
);
}
/** @test */
public
function
sessionShouldNotContainsStringTest
()
{
$session
=
Zend_Registry
::
get
(
'session'
);
$session
->
inspectorCalls
=
[
serialize
(
'test'
)];
$this
->
dispatch
(
'/index/index/inspector_gadget/1'
,
true
);
$calls
=
isset
(
$session
->
inspectorCalls
)
?
$session
->
inspectorCalls
:
[];
$this
->
assertEquals
([],
$calls
);
}
}
class
IndexControllerHeartBeatTest
extends
Admin_AbstractControllerTestCase
{
class
IndexControllerHeartBeatTest
extends
Admin_AbstractControllerTestCase
{
/** @test */
/** @test */
...
...
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