4242
4343/**
4444 * function to install the plugin
45- *
45+ *
4646 * @return boolean
4747 */
4848function plugin_mantis_install () {
4949 require_once ('inc/mantis.class.php ' );
50- PluginMantisMantis::install ();
50+ PluginMantisMantis::install ();
5151
5252 global $ DB ;
5353
5454 // création de la table du plugin
55- if (! TableExists ( "glpi_plugin_mantis_mantis " )) {
55+ if (! TableExists ( "glpi_plugin_mantis_mantis " )) {
5656 $ query = "CREATE TABLE `glpi_plugin_mantis_mantis` (
5757 `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
5858 `items_id` int(11) NOT NULL,
5959 `idMantis` int(11) NOT NULL,
6060 `dateEscalade` date NOT NULL,
6161 `itemtype` varchar(255) NOT NULL,
6262 `user` int(11) NOT NULL) " ;
63- $ DB ->query ( $ query ) or die ( $ DB ->error () );
63+ $ DB ->query ( $ query ) or die ( $ DB ->error () );
6464 } else {
65- $ mig = new Migration ( 200 );
65+ $ mig = new Migration ( 200 );
6666 $ table = 'glpi_plugin_mantis_mantis ' ;
67- $ mig ->addField ( $ table , 'itemType ' , 'string ' );
68- $ mig ->executeMigration ();
67+ $ mig ->addField ( $ table , 'itemType ' , 'string ' );
68+ $ mig ->executeMigration ();
6969
70- $ mig = new Migration ( 201 );
70+ $ mig = new Migration ( 201 );
7171 $ table = 'glpi_plugin_mantis_mantis ' ;
72- $ mig ->addField ( $ table , 'itemType ' , 'string ' );
73- $ mig ->changeField ( 'glpi_plugin_mantis_mantis ' , 'itemType ' , 'itemtype ' , 'string ' , array () );
74- $ mig ->changeField ( 'glpi_plugin_mantis_mantis ' , 'idTicket ' , 'items_id ' , 'integer ' , array () );
75- $ mig ->executeMigration ();
72+ $ mig ->addField ( $ table , 'itemType ' , 'string ' );
73+ $ mig ->changeField ( 'glpi_plugin_mantis_mantis ' , 'itemType ' , 'itemtype ' , 'string ' , array ());
74+ $ mig ->changeField ( 'glpi_plugin_mantis_mantis ' , 'idTicket ' , 'items_id ' , 'integer ' , array ());
75+ $ mig ->executeMigration ();
7676 }
7777
7878 // création de la table du plugin
79- if (! TableExists ( "glpi_plugin_mantis_userprefs " )) {
79+ if (! TableExists ( "glpi_plugin_mantis_userprefs " )) {
8080 $ query = "CREATE TABLE `glpi_plugin_mantis_userprefs` (
8181 `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
8282 `users_id` int(11) NOT NULL ,
@@ -88,26 +88,26 @@ function plugin_mantis_install() {
8888 `followCategorie` int(11) NOT NULL default '0',
8989 `followLinkedItem` int(11) NOT NULL default '0',
9090 UNIQUE KEY (`users_id`)) " ;
91- $ DB ->query ( $ query ) or die ( $ DB ->error () );
91+ $ DB ->query ( $ query ) or die ( $ DB ->error () );
9292 }
9393
9494 // Création de la table uniquement lors de la première installation
95- if (! TableExists ( "glpi_plugin_mantis_profiles " )) {
95+ if (! TableExists ( "glpi_plugin_mantis_profiles " )) {
9696 // requete de création de la table
9797 $ query = "CREATE TABLE `glpi_plugin_mantis_profiles` (
9898 `id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)',
9999 `right` char(1) collate utf8_unicode_ci default NULL,
100100 PRIMARY KEY (`id`)
101101 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci " ;
102- $ DB ->queryOrDie ( $ query , $ DB ->error () );
102+ $ DB ->queryOrDie ( $ query , $ DB ->error () );
103103
104104 // creation du premier accès nécessaire lors de l'installation du plugin
105105 include_once ("inc/profile.class.php " );
106- PluginMantisProfile::createAdminAccess ( $ _SESSION ['glpiactiveprofile ' ] ['id ' ] );
106+ PluginMantisProfile::createAdminAccess ( $ _SESSION ['glpiactiveprofile ' ] ['id ' ]);
107107 }
108108
109109 // création de la table pour la configuration du plugin
110- if (! TableExists ( "glpi_plugin_mantis_configs " )) {
110+ if (! TableExists ( "glpi_plugin_mantis_configs " )) {
111111 $ query = "CREATE TABLE `glpi_plugin_mantis_configs` (
112112 `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
113113 `host` varchar(255) NOT NULL default '',
@@ -123,40 +123,40 @@ function plugin_mantis_install() {
123123 `doc_categorie` int(3) NOT NULL default 0,
124124 `itemType` varchar(255) NOT NULL,
125125 `etatMantis` varchar(100) NOT NULL default '') " ;
126- $ DB ->query ( $ query ) or die ( $ DB ->error () );
126+ $ DB ->query ( $ query ) or die ( $ DB ->error () );
127127 // insertion du occcurence dans la table (occurrence par default)
128128 $ query = "INSERT INTO `glpi_plugin_mantis_configs`
129129 (`id`, `host`, `url`, `login`, `pwd`)
130130 VALUES (NULL, '','','','') " ;
131- $ DB ->query ( $ query ) or die ( "error in glpi_plugin_mantis_configs table " . $ DB ->error () );
131+ $ DB ->query ( $ query ) or die ( "error in glpi_plugin_mantis_configs table " . $ DB ->error () );
132132 } else {
133- $ mig = new Migration ( 200 );
133+ $ mig = new Migration ( 200 );
134134 $ table = 'glpi_plugin_mantis_configs ' ;
135- $ mig ->addField ( $ table , 'neutralize_escalation ' , 'integer ' , array (
135+ $ mig ->addField ( $ table , 'neutralize_escalation ' , 'integer ' , array (
136136 'value ' => 5
137- ) );
138- $ mig ->addField ( $ table , 'status_after_escalation ' , 'integer ' );
139- $ mig ->addField ( $ table , 'show_option_delete ' , 'integer ' , array (
137+ ));
138+ $ mig ->addField ( $ table , 'status_after_escalation ' , 'integer ' );
139+ $ mig ->addField ( $ table , 'show_option_delete ' , 'integer ' , array (
140140 'value ' => 0
141- ) );
142- $ mig ->addField ( $ table , 'doc_categorie ' , 'integer ' , array (
141+ ));
142+ $ mig ->addField ( $ table , 'doc_categorie ' , 'integer ' , array (
143143 'value ' => 0
144- ) );
145- $ mig ->addField ( $ table , 'itemType ' , 'string ' );
146- $ mig ->executeMigration ();
144+ ));
145+ $ mig ->addField ( $ table , 'itemType ' , 'string ' );
146+ $ mig ->executeMigration ();
147147 }
148148
149149 return true ;
150150}
151151
152152/**
153153 * function to uninstall the plugin
154- *
154+ *
155155 * @return boolean
156156 */
157157function plugin_mantis_uninstall () {
158158 require_once ('inc/mantis.class.php ' );
159- PluginMantisMantis::uninstall ();
159+ PluginMantisMantis::uninstall ();
160160 return true ;
161161}
162162
@@ -172,7 +172,7 @@ function plugin_mantis_getAddSearchOptions($itemtype) {
172172 $ sopt [78963 ] ['searchtype ' ] = 'equals ' ;
173173 $ sopt [78963 ] ['nosearch ' ] = true ;
174174 $ sopt [78963 ] ['datatype ' ] = 'bool ' ;
175- $ sopt [78963 ] ['name ' ] = __ ( 'ticket linked to mantis ' , 'mantis ' );
175+ $ sopt [78963 ] ['name ' ] = __ ( 'ticket linked to mantis ' , 'mantis ' );
176176 $ sopt [78963 ] ['joinparams ' ] = array (
177177 'jointype ' => "itemtype_item "
178178 );
@@ -184,21 +184,22 @@ function plugin_mantis_getAddSearchOptions($itemtype) {
184184 $ sopt [78964 ] ['searchtype ' ] = 'equals ' ;
185185 $ sopt [78964 ] ['nosearch ' ] = true ;
186186 $ sopt [78964 ] ['datatype ' ] = 'bool ' ;
187- $ sopt [78964 ] ['name ' ] = __ ( 'problem linked to mantis ' , 'mantis ' );
187+ $ sopt [78964 ] ['name ' ] = __ ( 'problem linked to mantis ' , 'mantis ' );
188188 $ sopt [78964 ] ['joinparams ' ] = array (
189189 'jointype ' => "itemtype_item "
190190 );
191191 }
192192 return $ sopt ;
193193}
194+
194195function plugin_mantis_giveItem ($ type , $ ID , $ data , $ num ) {
195- $ searchopt = &Search::getOptions ( $ type );
196+ $ searchopt = &Search::getOptions ( $ type );
196197 $ table = $ searchopt [$ ID ] ["table " ];
197198 $ field = $ searchopt [$ ID ] ["field " ];
198199
199200 switch ($ table . '. ' . $ field ) {
200201 case "glpi_plugin_mantis_mantis.idMantis " :
201- return Dropdown::getYesNo ( $ data ["ITEM_ $ num " ] );
202+ return Dropdown::getYesNo ( $ data ["ITEM_ $ num " ]);
202203 break ;
203204 }
204205
0 commit comments