Browse Source

Make repeat_cycle nullable to remove "none" value

Alan Hardman 3 years ago
parent
commit
61ec9f37d8

+ 2 - 2
app/controller/issues.php

@@ -49,9 +49,9 @@ class Issues extends \Controller {
 			} elseif($i == "status" && $val == "closed") {
 				$filter_str .= "status_closed = 1 AND ";
 			} elseif($i == "repeat_cycle" && $val == "repeat") {
-				$filter_str .= "repeat_cycle NOT IN ('none', '') AND ";
+				$filter_str .= "repeat_cycle IS NOT NULL AND ";
 			} elseif($i == "repeat_cycle" && $val == "none") {
-				$filter_str .= "repeat_cycle IN ('none', '') AND ";
+				$filter_str .= "repeat_cycle IS NULL AND ";
 			} elseif(($i == "author_id" || $i== "owner_id") && !empty($val) && is_numeric($val)) {
 				// Find all users in a group if necessary
 				$user = new \Model\User;

+ 1 - 1
app/helper/dashboard.php

@@ -72,7 +72,7 @@ class Dashboard extends \Prefab {
 	public function repeat_work() {
 		$ownerString = implode(",", $this->getOwnerIds());
 		return $this->getIssue()->find(
-			"owner_id IN ($ownerString) AND deleted_date IS NULL AND closed_date IS NULL AND status_closed = 0 AND repeat_cycle NOT IN ('none', '')",
+			"owner_id IN ($ownerString) AND deleted_date IS NULL AND closed_date IS NULL AND status_closed = 0 AND repeat_cycle IS NOT NULL",
 			array("order" => $this->_order)
 		);
 	}

+ 1 - 1
app/model/issue.php

@@ -271,7 +271,7 @@ class Issue extends \Model {
 		}
 
 		// Create a new issue if repeating
-		if ($this->closed_date && $this->repeat_cycle && $this->repeat_cycle != "none") {
+		if ($this->closed_date && $this->repeat_cycle) {
 			$this->repeat($notify);
 			$this->repeat_cycle = null;
 		}

+ 1 - 1
app/view/blocks/dashboard-issue-list.html

@@ -7,7 +7,7 @@
 					<span class="fa fa-user"></span>&ensp;{{ @item.owner_name | esc }}
 				</p>
 			</check>
-			<check if="{{ @item.repeat_cycle && @item.repeat_cycle != 'none' }}">
+			<check if="{{ @item.repeat_cycle }}">
 				<p class="pull-right badge-sibling hidden-xs group has-tooltip" title="{{ @dict.cols.repeat_cycle }}">
 					<span class="fa fa-repeat"></span>&ensp;{{ @dict[@item.repeat_cycle] ?: @item.repeat_cycle }}
 				</p>

+ 2 - 2
app/view/blocks/issue-list/filters.html

@@ -140,9 +140,9 @@
 					<true><option value="repeat" selected>{{ @dict.repeating }}</option></true>
 					<false><option value="repeat">{{ @dict.repeating }}</option></false>
 				</check>
-				<check if="{{ !empty(@GET.repeat_cycle) && @GET.repeat_cycle == 'none' }}">
+				<check if="{{ isset(@GET.repeat_cycle) && @GET.repeat_cycle == null }}">
 					<true><option value="none" selected>{{ @dict.not_repeating }}</option></true>
-					<false><option value="none">{{ @dict.not_repeating }}</option></false>
+					<false><option value="">{{ @dict.not_repeating }}</option></false>
 				</check>
 			</optgroup>
 			<optgroup label="{{ @dict.exact_match }}">

+ 1 - 1
app/view/issues/single.html

@@ -145,7 +145,7 @@
 				<dt>{{ @dict.cols.status }}</dt>
 				<dd>{{ isset(@dict[@issue.status_name]) ? @dict[@issue.status_name] : str_replace('_', ' ', @issue.status_name) }}</dd>
 
-				<check if="{{ @issue.repeat_cycle && @issue.repeat_cycle != 'none' }}">
+				<check if="{{ @issue.repeat_cycle }}">
 					<dt>{{ @dict.cols.repeat_cycle }}</dt>
 					<dd>{{ ucfirst(@issue.repeat_cycle) }}</dd>
 				</check>

+ 9 - 0
db/16.06.28.sql

@@ -0,0 +1,9 @@
+# Update issues table to allow null repeat_cycle
+ALTER TABLE `issue` CHANGE `repeat_cycle`
+	`repeat_cycle` VARCHAR(10) CHARSET utf8 COLLATE utf8_general_ci NULL;
+
+# Change existing repeat_cycle 'none' values to NULL
+UPDATE issue SET repeat_cycle = NULL WHERE repeat_cycle IN('none', '');
+
+# Update version
+UPDATE `config` SET `value` = '16.06.28' WHERE `attribute` = 'version';