mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-28 05:38:42 +02:00
Start repository
This commit is contained in:
80
inc/casechange.class.php
Normal file
80
inc/casechange.class.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* SOC Case-Change relation class
|
||||
*/
|
||||
class PluginSocCaseChange extends CommonDBRelation {
|
||||
|
||||
// From CommonDBRelation
|
||||
static public $itemtype_1 = 'PluginSocCase';
|
||||
static public $items_id_1 = 'plugin_soc_cases_id';
|
||||
static public $itemtype_2 = 'Change';
|
||||
static public $items_id_2 = 'changes_id';
|
||||
|
||||
/**
|
||||
* Get changes for a case
|
||||
*
|
||||
* @param integer $cases_id
|
||||
* @return DBmysqlIterator
|
||||
*/
|
||||
static function getChangesForCase($cases_id) {
|
||||
global $DB;
|
||||
|
||||
$iterator = $DB->request([
|
||||
'SELECT' => [
|
||||
'glpi_changes.*',
|
||||
'glpi_plugin_soc_case_changes.id AS link_id'
|
||||
],
|
||||
'FROM' => 'glpi_plugin_soc_case_changes',
|
||||
'LEFT JOIN' => [
|
||||
'glpi_changes' => [
|
||||
'FKEY' => [
|
||||
'glpi_plugin_soc_case_changes' => 'changes_id',
|
||||
'glpi_changes' => 'id'
|
||||
]
|
||||
]
|
||||
],
|
||||
'WHERE' => [
|
||||
'glpi_plugin_soc_case_changes.plugin_soc_cases_id' => $cases_id
|
||||
],
|
||||
'ORDER' => [
|
||||
'glpi_changes.date_creation DESC'
|
||||
]
|
||||
]);
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cases for a change
|
||||
*
|
||||
* @param integer $changes_id
|
||||
* @return DBmysqlIterator
|
||||
*/
|
||||
static function getCasesForChange($changes_id) {
|
||||
global $DB;
|
||||
|
||||
$iterator = $DB->request([
|
||||
'SELECT' => [
|
||||
'glpi_plugin_soc_cases.*',
|
||||
'glpi_plugin_soc_case_changes.id AS link_id'
|
||||
],
|
||||
'FROM' => 'glpi_plugin_soc_case_changes',
|
||||
'LEFT JOIN' => [
|
||||
'glpi_plugin_soc_cases' => [
|
||||
'FKEY' => [
|
||||
'glpi_plugin_soc_case_changes' => 'plugin_soc_cases_id',
|
||||
'glpi_plugin_soc_cases' => 'id'
|
||||
]
|
||||
]
|
||||
],
|
||||
'WHERE' => [
|
||||
'glpi_plugin_soc_case_changes.changes_id' => $changes_id
|
||||
],
|
||||
'ORDER' => [
|
||||
'glpi_plugin_soc_cases.date_creation DESC'
|
||||
]
|
||||
]);
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user