Skip to content

Commit a59d1bb

Browse files
committed
Fixes for GLPI 11
1 parent fdab4f2 commit a59d1bb

4 files changed

Lines changed: 44 additions & 27 deletions

File tree

hook.php

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -155,39 +155,57 @@ function plugin_tasklists_uninstall()
155155
$DB->doQuery("DROP TABLE IF EXISTS `$table`;");
156156
}
157157

158-
$tables_glpi = ["glpi_displaypreferences",
159-
"glpi_notepads",
160-
"glpi_savedsearches",
161-
"glpi_items_kanbans",
162-
"glpi_logs",
163-
"glpi_documents_items"];
164-
165-
foreach ($tables_glpi as $table_glpi) {
166-
$DB->doQuery("DELETE FROM `$table_glpi` WHERE `itemtype` LIKE 'GlpiPlugin\Tasklists\Task%';");
158+
$itemtypes = ['Alert',
159+
'DisplayPreference',
160+
'Document_Item',
161+
'ImpactItem',
162+
'Item_Ticket',
163+
'Item_Kanban',
164+
'Link_Itemtype',
165+
'Notepad',
166+
'SavedSearch',
167+
'DropdownTranslation',
168+
'NotificationTemplate',
169+
'Notification'];
170+
foreach ($itemtypes as $itemtype) {
171+
$item = new $itemtype;
172+
$item->deleteByCriteria(['itemtype' => Task::class]);
167173
}
168174

169-
$notif = new Notification();
170-
171-
$options = ['itemtype' => Task::class,
172-
'FIELDS' => 'id'];
173-
foreach ($DB->request('glpi_notifications', $options) as $data) {
175+
$notif = new Notification();
176+
$options = ['itemtype' => Task::class];
177+
foreach ($DB->request([
178+
'FROM' => 'glpi_notifications',
179+
'WHERE' => $options]) as $data) {
174180
$notif->delete($data);
175181
}
176182

177-
//templates
178-
$template = new NotificationTemplate();
179-
$translation = new NotificationTemplateTranslation();
180-
$options = ['itemtype' => Task::class,
181-
'FIELDS' => 'id'];
182-
foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
183-
$options_template = ['notificationtemplates_id' => $data['id'],
184-
'FIELDS' => 'id'];
185-
186-
foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
183+
//templates
184+
$template = new NotificationTemplate();
185+
$translation = new NotificationTemplateTranslation();
186+
$notif_template = new Notification_NotificationTemplate();
187+
$options = ['itemtype' => Task::class];
188+
foreach ($DB->request([
189+
'FROM' => 'glpi_notificationtemplates',
190+
'WHERE' => $options]) as $data) {
191+
$options_template = [
192+
'notificationtemplates_id' => $data['id']
193+
];
194+
195+
foreach ($DB->request([
196+
'FROM' => 'glpi_notificationtemplatetranslations',
197+
'WHERE' => $options_template]) as $data_template) {
187198
$translation->delete($data_template);
188199
}
189200
$template->delete($data);
201+
202+
foreach ($DB->request([
203+
'FROM' => 'glpi_notifications_notificationtemplates',
204+
'WHERE' => $options_template]) as $data_template) {
205+
$notif_template->delete($data_template);
206+
}
190207
}
208+
191209
//Delete rights associated with the plugin
192210
$profileRight = new ProfileRight();
193211
foreach (Profile::getAllRights() as $right) {

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function plugin_version_tasklists()
102102
'name' => __('Tasks list', 'tasklists'),
103103
'version' => PLUGIN_TASKLISTS_VERSION,
104104
'license' => 'GPLv2+',
105-
'author' => "<a href='http://blogglpi.infotel.com'>Infotel</a>",
105+
'author' => "<a href='https//blogglpi.infotel.com'>Infotel</a>, Xavier CAILLAUD",
106106
'homepage' => 'https://github.com/InfotelGLPI/tasklists',
107107
'requirements' => [
108108
'glpi' => [

src/Dashboard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
use Ajax;
3333
use CommonGLPI;
34+
use CommonITILObject;
3435
use DbUtils;
3536
use Dropdown;
3637
use Glpi\RichText\RichText;

src/Kanban.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public static function countTasksForKanban($id)
119119
* @param int $withtemplate
120120
*
121121
* @return array|bool|string
122-
* @throws GlpitestSQLError
123122
*/
124123
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
125124
{
@@ -167,7 +166,6 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
167166
* @param int $withtemplate
168167
*
169168
* @return bool
170-
* @throws GlpitestSQLError
171169
*/
172170
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
173171
{

0 commit comments

Comments
 (0)