Browse Source

Adding a few new basic features

 - Author selection in bulk update
 - Auto-set sprint from due date now configurable per-issue
Alan Hardman 3 years ago
parent
commit
12948175ac

+ 2 - 2
app/controller/issues.php

@@ -260,7 +260,7 @@ class Issues extends \Controller {
 					}
 
 					// Save to the sprint of the due date if no sprint selected
-					if (!empty($post['due_date']) && empty($post['sprint_id'])) {
+					if (!empty($post['due_date']) && empty($post['sprint_id']) && !empty($post['due_date_sprint'])) {
 						$sprint = new \Model\Sprint;
 						$sprint->load(array("DATE(?) BETWEEN start_date AND end_date",$issue->due_date));
 						$issue->sprint_id = $sprint->id;
@@ -565,7 +565,7 @@ class Issues extends \Controller {
 
 					// Save to the sprint of the due date unless one already set
 					if ($i=="due_date" && !empty($val)) {
-						if(empty($post['sprint_id'])) {
+						if(empty($post['sprint_id']) && !empty($post['due_date_sprint'])) {
 							$sprint = new \Model\Sprint;
 							$sprint->load(array("DATE(?) BETWEEN start_date AND end_date",$val));
 							$issue->sprint_id = $sprint->id;

+ 2 - 0
app/dict/en.ini

@@ -135,6 +135,7 @@ cols.repeat_cycle=Repeat Cycle
 cols.parent_id=Parent ID
 cols.parent=Parent
 cols.sprint=Sprint
+cols.due_date_sprint=Set Due Date by Sprint
 cols.created=Created
 cols.start=Start
 cols.due=Due
@@ -156,6 +157,7 @@ Low=Low
 ; Issue editing
 not_assigned=Not Assigned
 choose_option=Choose an option
+set_sprint_from_due_date=Add to sprint by due date
 
 repeating=Repeating
 not_repeating=Not Repeating

+ 1 - 1
app/model/issue.php

@@ -50,7 +50,7 @@ class Issue extends \Model {
 			if (!preg_match("/[0-9]{4}(-[0-9]{2}){2}/", $data["due_date"])) {
 				$data["due_date"] = date("Y-m-d", strtotime($data["due_date"]));
 			}
-			if (empty($data["sprint_id"])) {
+			if (empty($data["sprint_id"]) && !empty($data['due_date_sprint'])) {
 				$sprint = new Sprint();
 				$sprint->load(array("DATE(?) BETWEEN start_date AND end_date", $data["due_date"]));
 				$data["sprint_id"] = $sprint->id;

+ 26 - 1
app/view/blocks/issue-list/bulk-update.html

@@ -20,6 +20,27 @@
 						</select>
 					</div>
 				</div>
+				<check if="{{ @user.role=='admin' }}">
+					<div class="form-group">
+						<label class="col-md-3 control-label label-sm">{{ @dict.cols.author }}</label>
+						<div class="col-md-9">
+							<select class="form-control input-sm" name="author_id">
+								<option value="">{{ @dict.choose_option }}</option>
+								<option value="{{ @user.id }}">{{ @user.name | esc }}</option>
+								<optgroup label="{{ @dict.groups }}">
+									<repeat group="{{ @groups }}" value="{{ @group }}">
+										<option value="{{ @group.id }}">{{ @group.name | esc }}</option>
+									</repeat>
+								</optgroup>
+								<optgroup label="{{ @dict.users }}">
+									<repeat group="{{ @users }}" value="{{ @item }}">
+										<option value="{{ @item.id }}">{{ @item.name | esc }}</option>
+									</repeat>
+								</optgroup>
+							</select>
+						</div>
+					</div>
+				</check>
 				<div class="form-group">
 					<label class="col-sm-3 control-label label-sm">{{ @dict.cols.assignee }}</label>
 					<div class="col-sm-9">
@@ -49,7 +70,11 @@
 				<div class="form-group">
 					<label class="col-sm-3 control-label label-sm">{{ @dict.cols.due_date }}</label>
 					<div class="col-sm-9">
-						<input class="form-control input-sm bulk-input" id="due_date" type="text" name="due_date"  value="">
+						<input class="form-control input-sm bulk-input" id="due_date" type="text" name="due_date" value="">
+						<label class="checkbox-inline">
+							<input type="checkbox" name="due_date_sprint" value="1">
+							{{ @dict.set_sprint_from_due_date }}
+						</label>
 					</div>
 				</div>
 				<div class="form-group">

+ 4 - 0
app/view/issues/edit-form.html

@@ -173,6 +173,10 @@
 		<label class="col-md-2 control-label label-sm">{{ @dict.cols.due_date }}</label>
 		<div class="col-md-6">
 			<input class="form-control input-sm" id="due_date" type="text" name="due_date" autocomplete="off" value="{{ empty(@issue) ? '' : @issue.due_date }}">
+			<label class="checkbox-inline">
+				<input type="checkbox" name="due_date_sprint" value="1" {~ if(@@issue.due_date_sprint) echo 'checked' ~}>
+				{{ @dict.set_sprint_from_due_date }}
+			</label>
 		</div>
 	</div>
 	<div class="form-group">

+ 55 - 0
db/16.12.01.sql

@@ -0,0 +1,55 @@
+# Update issue table to include due_date_sprint setting
+ALTER TABLE `issue`
+	ADD COLUMN `due_date_sprint` TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL;
+
+ALTER VIEW `issue_detail` AS
+SELECT
+	`issue`.`id` AS `id`,
+	`issue`.`status` AS `status`,
+	`issue`.`type_id` AS `type_id`,
+	`issue`.`name` AS `name`,
+	`issue`.`description` AS `description`,
+	`issue`.`parent_id` AS `parent_id`,
+	`issue`.`author_id` AS `author_id`,
+	`issue`.`owner_id` AS `owner_id`,
+	`issue`.`priority` AS `priority`,
+	`issue`.`hours_total` AS `hours_total`,
+	`issue`.`hours_remaining` AS `hours_remaining`,
+	`issue`.`hours_spent` AS `hours_spent`,
+	`issue`.`created_date` AS `created_date`,
+	`issue`.`closed_date` AS `closed_date`,
+	`issue`.`deleted_date` AS `deleted_date`,
+	`issue`.`start_date` AS `start_date`,
+	`issue`.`due_date` AS `due_date`,
+	ISNULL(`issue`.`due_date`) AS `has_due_date`,
+	`issue`.`repeat_cycle` AS `repeat_cycle`,
+	`issue`.`sprint_id` AS `sprint_id`,
+	`issue`.`due_date_sprint` AS `due_date_sprint`,
+	`sprint`.`name` AS `sprint_name`,
+	`sprint`.`start_date` AS `sprint_start_date`,
+	`sprint`.`end_date` AS `sprint_end_date`,
+	`type`.`name` AS `type_name`,
+	`status`.`name` AS `status_name`,
+	`status`.`closed` AS `status_closed`,
+	`priority`.`id` AS `priority_id`,
+	`priority`.`name` AS `priority_name`,
+	`author`.`username` AS `author_username`,
+	`author`.`name` AS `author_name`,
+	`author`.`email` AS `author_email`,
+	`author`.`task_color` AS `author_task_color`,
+	`owner`.`username` AS `owner_username`,
+	`owner`.`name` AS `owner_name`,
+	`owner`.`email` AS `owner_email`,
+	`owner`.`task_color` AS `owner_task_color`,
+	`parent`.`name` AS `parent_name`
+FROM `issue`
+LEFT JOIN `user` `author` ON `issue`.`author_id` = `author`.`id`
+LEFT JOIN `user` `owner` ON `issue`.`owner_id` = `owner`.`id`
+LEFT JOIN `issue_status` `status` ON `issue`.`status` = `status`.`id`
+LEFT JOIN `issue_priority` `priority` ON `issue`.`priority` = `priority`.`value`
+LEFT JOIN `issue_type` `type` ON `issue`.`type_id` = `type`.`id`
+LEFT JOIN `sprint` ON `issue`.`sprint_id` = `sprint`.`id`
+LEFT JOIN `issue` `parent` ON `issue`.`parent_id` = `parent`.`id`;
+
+# Update version
+UPDATE `config` SET `value` = '16.12.01' WHERE `attribute` = 'version';

File diff suppressed because it is too large
+ 2 - 2
db/database.sql