Bonjour à tous,
En bossant sur les redirections via les notifications je me suis aperçu d'une
chose :
- on peut rediriger une personne sur une page du style
/plugins/order/front/order.form.php
- on ne peut pas rediriger une personne sur une page du style
/plugins/order/front/reference.form.php
Ce qui implique qu'on peut faire qu'une seule redirection pour un plugin :
- et donc une seule entrée $PLUGIN_HOOKS['redirect_page']['order']
Je propose le patch en pièce jointe pour améliorer ceci :
- l'entrée dans le setup du plugin est maintenant (par ex) :
$PLUGIN_HOOKS['redirect_page']['order-reference'] = "front/reference.form.php";
- l'url affichée dans le mail est la suivante (par ex) :
http://localhost/index.php?redirect=plugin_order-reference_1
- l'utilisateur est redirigé directement vers :
http://localhost/plugins/order/front/reference.form.php?id=1&forcetab=1
Qu'en penses-vous ?
++
François
--
François Legastelois ([email protected])
teclib' - Consultant Applications OpenSource - http://www.teclib.com
tel : 06 84 59 42 62 / 01 79 97 02 78
--- glpi_svn/inc/common.function.php 2011-01-27 12:34:50.000000000 +0100
+++ glpi_proposal_patch/inc/common.function.php 2011-01-27 12:37:12.000000000 +0100
@@ -1908,9 +1908,16 @@
&& isset($PLUGIN_HOOKS['redirect_page'][$data[1]])
&& !empty($PLUGIN_HOOKS['redirect_page'][$data[1]])) {
- glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data[1]."/".
- $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
- "&$forcetab");
+ $data2=explode("-",$data[1]);
+ if(count($data2)>=1) {
+ glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data2[0]."/".
+ $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
+ "&$forcetab");
+ } else {
+ glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data[1]."/".
+ $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
+ "&$forcetab");
+ }
} else {
glpi_header($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?$forcetab");
}
@@ -1944,9 +1951,16 @@
&& isset($PLUGIN_HOOKS['redirect_page'][$data[1]])
&& !empty($PLUGIN_HOOKS['redirect_page'][$data[1]])) {
- glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data[1]."/".
- $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
- "&$forcetab");
+ $data2=explode("-",$data[1]);
+ if(count($data2)>=1) {
+ glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data2[0]."/".
+ $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
+ "&$forcetab");
+ } else {
+ glpi_header($CFG_GLPI["root_doc"]."/plugins/".$data[1]."/".
+ $PLUGIN_HOOKS['redirect_page'][$data[1]]."?id=".$data[2].
+ "&$forcetab");
+ }
} else {
glpi_header($CFG_GLPI["root_doc"]."/front/central.php?$forcetab");
}
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev