|
39 | 39 | use Glpi\Exception\Http\HttpException; |
40 | 40 | use Glpi\Features\KanbanInterface; |
41 | 41 | use Glpi\Features\TeamworkInterface; |
| 42 | +use GlpiPlugin\Tasklists\Item_Kanban; |
42 | 43 |
|
43 | 44 | use function Safe\json_encode; |
44 | 45 | use function Safe\preg_split; |
|
181 | 182 | $can_move = $kanban->canOrderKanbanCard($_POST['kanban']['items_id']); |
182 | 183 | } |
183 | 184 | if ($can_move) { |
184 | | - Item_Kanban::moveCard( |
| 185 | + \Item_Kanban::moveCard( |
185 | 186 | $_POST['kanban']['itemtype'], |
186 | 187 | $_POST['kanban']['items_id'], |
187 | 188 | $_POST['card'], |
|
191 | 192 | } |
192 | 193 | } elseif (($_POST['action'] ?? null) === 'show_column') { |
193 | 194 | $checkParams(['column', 'kanban']); |
194 | | - Item_Kanban::showColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
| 195 | + \Item_Kanban::showColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
195 | 196 | } elseif (($_POST['action'] ?? null) === 'hide_column') { |
196 | 197 | $checkParams(['column', 'kanban']); |
197 | | - Item_Kanban::hideColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
| 198 | + \Item_Kanban::hideColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
198 | 199 | } elseif (($_POST['action'] ?? null) === 'collapse_column') { |
199 | 200 | $checkParams(['column', 'kanban']); |
200 | | - Item_Kanban::collapseColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
| 201 | + \Item_Kanban::collapseColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
201 | 202 | } elseif (($_POST['action'] ?? null) === 'expand_column') { |
202 | 203 | $checkParams(['column', 'kanban']); |
203 | | - Item_Kanban::expandColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
| 204 | + \Item_Kanban::expandColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column']); |
204 | 205 | } elseif (($_POST['action'] ?? null) === 'move_column') { |
205 | 206 | $checkParams(['column', 'kanban', 'position']); |
206 | | - Item_Kanban::moveColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column'], $_POST['position']); |
| 207 | + \Item_Kanban::moveColumn($_POST['kanban']['itemtype'], $_POST['kanban']['items_id'], $_POST['column'], $_POST['position']); |
207 | 208 | } elseif ($_REQUEST['action'] === 'refresh') { |
208 | 209 | $checkParams(['column_field']); |
209 | 210 | // Get all columns to refresh the kanban |
210 | 211 | header("Content-Type: application/json; charset=UTF-8", true); |
211 | | - $force_columns = Item_Kanban::getAllShownColumns($itemtype, $_REQUEST['items_id']); |
| 212 | + $force_columns = \Item_Kanban::getAllShownColumns($itemtype, $_REQUEST['items_id']); |
212 | 213 | $columns = $itemtype::getKanbanColumns($_REQUEST['items_id'], $_REQUEST['column_field'], $force_columns, true); |
213 | 214 | echo json_encode($columns, JSON_FORCE_OBJECT); |
214 | 215 | } elseif ($_REQUEST['action'] === 'get_switcher_dropdown') { |
|
247 | 248 | if (!isset($_POST['state'])) { |
248 | 249 | // Do nothing with the state unless it isn't saved yet. Could be that no columns are shown or an error occurred. |
249 | 250 | // If the state is supposed to be cleared, it should come through as a clear_column_state request. |
250 | | - if (Item_Kanban::hasStateForItem($_POST['itemtype'], $_POST['items_id'])) { |
| 251 | + if (\Item_Kanban::hasStateForItem($_POST['itemtype'], $_POST['items_id'])) { |
251 | 252 | return; |
252 | 253 | } |
253 | | - Item_Kanban::saveStateForItem($_POST['itemtype'], $_POST['items_id'], []); |
| 254 | + \Item_Kanban::saveStateForItem($_POST['itemtype'], $_POST['items_id'], []); |
254 | 255 | return; |
255 | 256 | } |
256 | 257 | $checkParams(['items_id', 'state']); |
257 | | - Item_Kanban::saveStateForItem($_POST['itemtype'], $_POST['items_id'], $_POST['state']); |
| 258 | + \Item_Kanban::saveStateForItem($_POST['itemtype'], $_POST['items_id'], $_POST['state']); |
258 | 259 | } elseif ($_REQUEST['action'] === 'load_column_state') { |
259 | 260 | $checkParams(['items_id', 'last_load']); |
260 | 261 | header("Content-Type: application/json; charset=UTF-8", true); |
261 | 262 | $response = [ |
262 | | - 'state' => Item_Kanban::loadStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id'], $_REQUEST['last_load']), |
| 263 | + 'state' => \Item_Kanban::loadStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id'], $_REQUEST['last_load']), |
263 | 264 | 'timestamp' => $_SESSION['glpi_currenttime'], |
264 | 265 | ]; |
265 | 266 | echo json_encode($response, JSON_FORCE_OBJECT); |
266 | 267 | } elseif ($_REQUEST['action'] === 'clear_column_state') { |
267 | 268 | $checkParams(['items_id']); |
268 | | - $result = Item_Kanban::clearStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id']); |
| 269 | + $result = \Item_Kanban::clearStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id']); |
269 | 270 | if (!$result) { |
270 | 271 | throw new HttpException(500); |
271 | 272 | } |
|
0 commit comments