mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-28 05:38:42 +02:00
Correction du fichier hook.php pour le plugin SOC
This commit is contained in:
@ -77,4 +77,101 @@ class PluginSocCaseChange extends CommonDBRelation {
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show cases for a change
|
||||
*
|
||||
* @param Change $change
|
||||
* @return void
|
||||
*/
|
||||
function showForChange(Change $change) {
|
||||
global $DB;
|
||||
|
||||
$change_id = $change->getID();
|
||||
|
||||
if (!$change->can($change_id, READ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cases = self::getCasesForChange($change_id);
|
||||
$nb = count($cases);
|
||||
|
||||
echo "<div class='spaced'>";
|
||||
|
||||
if ($nb > 0) {
|
||||
echo "<table class='tab_cadre_fixehov'>";
|
||||
|
||||
$header = "<tr>";
|
||||
$header .= "<th>" . __('Name') . "</th>";
|
||||
$header .= "<th>" . __('Status') . "</th>";
|
||||
$header .= "<th>" . __('Severity', 'soc') . "</th>";
|
||||
$header .= "<th>" . __('Creation date') . "</th>";
|
||||
$header .= "</tr>";
|
||||
|
||||
echo $header;
|
||||
|
||||
foreach ($cases as $data) {
|
||||
$case = new PluginSocCase();
|
||||
$case->getFromDB($data['id']);
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td><a href='".Plugin::getWebDir('soc')."/front/case.form.php?id=".$data['id']."'>".$data['name']."</a></td>";
|
||||
echo "<td><span class='soc-status soc-status-".$data['status']."'>".$case->getStatusOptions()[$data['status']]."</span></td>";
|
||||
echo "<td><span class='soc-severity soc-severity-".$data['severity']."'>".$case->getSeverityOptions()[$data['severity']]."</span></td>";
|
||||
echo "<td>".Html::convDateTime($data['date_creation'])."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
} else {
|
||||
echo "<p class='center'>".__('No SOC case associated with this change', 'soc')."</p>";
|
||||
}
|
||||
|
||||
// If user has rights to create cases
|
||||
if (Session::haveRight('plugin_soc_case', CREATE)) {
|
||||
echo "<div class='center'>";
|
||||
echo "<a href='".Plugin::getWebDir('soc')."/front/case.form.php?changes_id=".$change_id."' class='submit'>";
|
||||
echo __('Create SOC case from this change', 'soc');
|
||||
echo "</a>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Show form for linking a change to a case
|
||||
*
|
||||
* @param integer $cases_id
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
function showFormForCase($cases_id, $options = []) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$case = new PluginSocCase();
|
||||
$case->getFromDB($cases_id);
|
||||
|
||||
echo "<form method='post' action='".Plugin::getWebDir('soc')."/front/case.form.php'>";
|
||||
echo "<div class='spaced'>";
|
||||
echo "<table class='tab_cadre_fixe'>";
|
||||
echo "<tr class='tab_bg_2'><th colspan='2'>".__('Link a change to this case', 'soc')."</th></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'><td class='right'>".__('Change')."</td>";
|
||||
echo "<td class='left'>";
|
||||
|
||||
Change::dropdown(['name' => 'changes_id', 'entity' => $case->fields['entities_id']]);
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td class='center' colspan='2'>";
|
||||
echo "<input type='hidden' name='plugin_soc_cases_id' value='$cases_id'>";
|
||||
echo "<input type='submit' name='add_change' value=\""._sx('button', 'Add')."\" class='submit'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
Html::closeForm();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user