Skip to content

Commit

Permalink
Adding protected status archive back
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 29, 2024
1 parent 3940627 commit ef7720d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 12 additions & 3 deletions app/Domain/Projects/Templates/showProject.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@
<?php foreach ($tpl->get('todoStatus') as $key => $ticketStatus) { ?>
<li>
<div class="ticketBox">
<div class="row statusList" id="todostatus-<?=$key?>">

<div class="row statusList" id="todostatus-<?=$key ?>">

<input type="hidden" name="labelKeys[]" id="labelKey-<?=$key?>" class='labelKey' value="<?=$key?>"/>
<div class="sortHandle">
<br />
Expand All @@ -315,8 +317,9 @@
<input type="text" name="labelSort-<?=$key?>" class="sorter" id="labelSort-<?=$key ?>" value="<?=$tpl->escape($ticketStatus['sortKey']);?>" style="width:50px;"/>
</div>
<div class="col-md-2">

<label><?=$tpl->__("label.label") ?></label>
<input type="text" name="label-<?=$key?>" id="label-<?=$key?>" value="<?=$tpl->escape($ticketStatus['name']);?>" />
<input type="text" name="label-<?=$key?>" <?=$key==-1?'readonly':''?> id="label-<?=$key?>" value="<?=$tpl->escape($ticketStatus['name']);?>" />

</div>
<div class="col-md-2">
Expand Down Expand Up @@ -354,9 +357,15 @@
</div>
<div class="remove">
<br />
<a href="javascript:void(0);" onclick="leantime.projectsController.removeStatus(<?=$key?>)" class="delete"><span class="fa fa-trash"></span></a>
<?php if($key != -1){ ?>
<a href="javascript:void(0);" onclick="leantime.projectsController.removeStatus(<?=$key?>)" class="delete"><span class="fa fa-trash"></span></a>
<?php } ?>
</div>
</div>

<?php if ($key == -1) { ?>
<em>* the archive status is protected cannot be renamed or removed.</em>
<?php } ?>
</div>
</li>

Expand Down
7 changes: 6 additions & 1 deletion app/Domain/Tickets/Repositories/Tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ public function getStateLabels($projectId = null): array

//Override the state values that are in the db
if ($values !== false) {

$statusList = array();

//Archive is required and protected.
//Adding the original version back in case folks removed it
$statusList[-1] = $this->statusListSeed[-1];

foreach (unserialize($values['value']) as $key => $status) {
if (is_int($key)) {
//Backwards Compatibility with existing labels in db
Expand All @@ -197,7 +202,7 @@ public function getStateLabels($projectId = null): array
if (!is_array($status)) {
$statusList[$key] = $this->statusListSeed[$key];

if (is_array($statusList[$key]) && isset($statusList[$key]["name"])) {
if (is_array($statusList[$key]) && isset($statusList[$key]["name"]) && $key !== -1) {
$statusList[$key]["name"] = $status;
}
} else {
Expand Down

0 comments on commit ef7720d

Please sign in to comment.