Commit 25db8881 authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski

Check if ticket is not closed for assign; fixes #3769

No requester, watcher nor document add on closed tickets.
parent 64dd65bb
......@@ -3934,7 +3934,9 @@ abstract class CommonITILObject extends CommonDBTM {
if ($ID
&& $can_admin
&& (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester'])) {
&& (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester'])
&& !in_array($this->fields['status'], $this->getClosedStatusArray())
) {
$rand_requester = mt_rand();
echo " ";
echo "<span class='fa fa-plus pointer' title=\"".__s('Add')."\"
......@@ -4039,7 +4041,9 @@ abstract class CommonITILObject extends CommonDBTM {
if ($ID
&& $can_admin
&& (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer'])) {
&& (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer'])
&& !in_array($this->fields['status'], $this->getClosedStatusArray())
) {
$rand_observer = mt_rand();
echo "&nbsp;";
......
......@@ -274,7 +274,9 @@ class Ticket extends CommonITILObject {
function canAssign() {
if (isset($this->fields['is_deleted']) && ($this->fields['is_deleted'] == 1)) {
if (isset($this->fields['is_deleted']) && ($this->fields['is_deleted'] == 1)
|| isset($this->fields['status']) && in_array($this->fields['status'], $this->getClosedStatusArray())
) {
return false;
}
return Session::haveRight(self::$rightname, self::ASSIGN);
......@@ -283,7 +285,9 @@ class Ticket extends CommonITILObject {
function canAssignToMe() {
if (isset($this->fields['is_deleted']) && $this->fields['is_deleted'] == 1) {
if (isset($this->fields['is_deleted']) && $this->fields['is_deleted'] == 1
|| isset($this->fields['status']) && in_array($this->fields['status'], $this->getClosedStatusArray())
) {
return false;
}
return (Session::haveRight(self::$rightname, self::STEAL)
......@@ -5131,44 +5135,46 @@ class Ticket extends CommonITILObject {
echo "</td>";
echo "</tr>";
// View files added
echo "<tr class='tab_bg_1'>";
// Permit to add doc when creating a ticket
echo "<th style='width:$colsize1%'>";
echo $tt->getBeginHiddenFieldText('_documents_id');
$doctitle = sprintf(__('File (%s)'), Document::getMaxUploadSize());
printf(__('%1$s%2$s'), $doctitle, $tt->getMandatoryMark('_documents_id'));
// Do not show if hidden.
if (!$tt->isHiddenField('_documents_id')) {
DocumentType::showAvailableTypesLink();
}
echo $tt->getEndHiddenFieldText('_documents_id');
echo "</th>";
echo "<td colspan='3'>";
// Do not set values
echo $tt->getEndHiddenFieldValue('_documents_id');
if ($tt->isPredefinedField('_documents_id')) {
if (isset($options['_documents_id'])
&& is_array($options['_documents_id'])
&& count($options['_documents_id'])) {
echo "<span class='b'>".__('Default documents:').'</span>';
echo "<br>";
$doc = new Document();
foreach ($options['_documents_id'] as $key => $val) {
if ($doc->getFromDB($val)) {
echo "<input type='hidden' name='_documents_id[$key]' value='$val'>";
echo "- ".$doc->getNameID()."<br>";
if (!in_array($this->fields['status'], $this->getClosedStatusArray())) {
// View files added
echo "<tr class='tab_bg_1'>";
// Permit to add doc when creating a ticket
echo "<th style='width:$colsize1%'>";
echo $tt->getBeginHiddenFieldText('_documents_id');
$doctitle = sprintf(__('File (%s)'), Document::getMaxUploadSize());
printf(__('%1$s%2$s'), $doctitle, $tt->getMandatoryMark('_documents_id'));
// Do not show if hidden.
if (!$tt->isHiddenField('_documents_id')) {
DocumentType::showAvailableTypesLink();
}
echo $tt->getEndHiddenFieldText('_documents_id');
echo "</th>";
echo "<td colspan='3'>";
// Do not set values
echo $tt->getEndHiddenFieldValue('_documents_id');
if ($tt->isPredefinedField('_documents_id')) {
if (isset($options['_documents_id'])
&& is_array($options['_documents_id'])
&& count($options['_documents_id'])) {
echo "<span class='b'>".__('Default documents:').'</span>';
echo "<br>";
$doc = new Document();
foreach ($options['_documents_id'] as $key => $val) {
if ($doc->getFromDB($val)) {
echo "<input type='hidden' name='_documents_id[$key]' value='$val'>";
echo "- ".$doc->getNameID()."<br>";
}
}
}
}
Html::file(['filecontainer' => 'fileupload_info_ticket',
'editor_id' => $content_id,
'showtitle' => false,
'multiple' => true]);
echo "</td>";
echo "</tr>";
}
Html::file(['filecontainer' => 'fileupload_info_ticket',
'editor_id' => $content_id,
'showtitle' => false,
'multiple' => true]);
echo "</td>";
echo "</tr>";
Plugin::doHook("post_item_form", ['item' => $this, 'options' => &$options]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment