From d560f84b374fa1b3345dc582eddd6bb7b9138674 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 23 Jun 2016 20:26:19 -0400 Subject: Added models for tags --- app/Schema/Mysql.php | 25 ++++++++++++++++++++++++- app/Schema/Postgres.php | 24 +++++++++++++++++++++++- app/Schema/Sqlite.php | 24 +++++++++++++++++++++++- 3 files changed, 70 insertions(+), 3 deletions(-) (limited to 'app/Schema') diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 934b063f..82ccb8c8 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,30 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 110; +const VERSION = 111; + +function version_111(PDO $pdo) +{ + $pdo->exec(" + CREATE TABLE tags ( + id INT NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + project_id INT NOT NULL, + UNIQUE(project_id, name), + PRIMARY KEY(id) + ) ENGINE=InnoDB CHARSET=utf8 + "); + + $pdo->exec(" + CREATE TABLE task_has_tags ( + task_id INT NOT NULL, + tag_id INT NOT NULL, + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE, + FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, + UNIQUE(tag_id, task_id) + ) ENGINE=InnoDB CHARSET=utf8 + "); +} function version_110(PDO $pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 3ef49498..229cbd25 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,29 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 89; +const VERSION = 90; + +function version_90(PDO $pdo) +{ + $pdo->exec(" + CREATE TABLE tags ( + id SERIAL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + project_id INTEGER NOT NULL, + UNIQUE(project_id, name) + ) + "); + + $pdo->exec(" + CREATE TABLE task_has_tags ( + task_id INTEGER NOT NULL, + tag_id INTEGER NOT NULL, + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE, + FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, + UNIQUE(tag_id, task_id) + ) + "); +} function version_89(PDO $pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 9ded7ed9..dac348d4 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,29 @@ use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; use PDO; -const VERSION = 101; +const VERSION = 102; + +function version_102(PDO $pdo) +{ + $pdo->exec(" + CREATE TABLE tags ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + project_id INTEGER NOT NULL, + UNIQUE(project_id, name) + ) + "); + + $pdo->exec(" + CREATE TABLE task_has_tags ( + task_id INTEGER NOT NULL, + tag_id INTEGER NOT NULL, + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE, + FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, + UNIQUE(tag_id, task_id) + ) + "); +} function version_101(PDO $pdo) { -- cgit v1.2.3 From 6c24ec578470ef9aa788c8c879ab689814ab22be Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 28 Jun 2016 21:13:59 -0400 Subject: Update SQL schema dumps --- app/Schema/Sql/mysql.sql | 27 ++++++++++++- app/Schema/Sql/postgres.sql | 93 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 115 insertions(+), 5 deletions(-) (limited to 'app/Schema') diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql index 92ca3686..9583989d 100644 --- a/app/Schema/Sql/mysql.sql +++ b/app/Schema/Sql/mysql.sql @@ -414,6 +414,17 @@ CREATE TABLE `swimlanes` ( CONSTRAINT `swimlanes_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tags` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `project_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `project_id` (`project_id`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `task_has_external_links`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -479,6 +490,18 @@ CREATE TABLE `task_has_metadata` ( CONSTRAINT `task_has_metadata_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `task_has_tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `task_has_tags` ( + `task_id` int(11) NOT NULL, + `tag_id` int(11) NOT NULL, + UNIQUE KEY `tag_id` (`tag_id`,`task_id`), + KEY `task_id` (`task_id`), + CONSTRAINT `task_has_tags_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE, + CONSTRAINT `task_has_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `tasks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -647,7 +670,7 @@ CREATE TABLE `users` ( LOCK TABLES `settings` WRITE; /*!40000 ALTER TABLE `settings` DISABLE KEYS */; -INSERT INTO `settings` VALUES ('api_token','e8a7a983f25efa80e203d44a832c9570a5083d3fefa91366989c00e931d0',0,0),('application_currency','USD',0,0),('application_date_format','m/d/Y',0,0),('application_language','en_US',0,0),('application_stylesheet','',0,0),('application_timezone','UTC',0,0),('application_url','',0,0),('board_columns','',0,0),('board_highlight_period','172800',0,0),('board_private_refresh_interval','10',0,0),('board_public_refresh_interval','60',0,0),('calendar_project_tasks','date_started',0,0),('calendar_user_subtasks_time_tracking','0',0,0),('calendar_user_tasks','date_started',0,0),('cfd_include_closed_tasks','1',0,0),('default_color','yellow',0,0),('integration_gravatar','0',0,0),('password_reset','1',0,0),('project_categories','',0,0),('subtask_restriction','0',0,0),('subtask_time_tracking','1',0,0),('webhook_token','296892f9c821909a92df539b028fdb384e47c9f7a34a8f9cad598e0edbba',0,0),('webhook_url','',0,0); +INSERT INTO `settings` VALUES ('api_token','19ffd9709d03ce50675c3a43d1c49c1ac207f4bc45f06c5b2701fbdf8929',0,0),('application_currency','USD',0,0),('application_date_format','m/d/Y',0,0),('application_language','en_US',0,0),('application_stylesheet','',0,0),('application_timezone','UTC',0,0),('application_url','',0,0),('board_columns','',0,0),('board_highlight_period','172800',0,0),('board_private_refresh_interval','10',0,0),('board_public_refresh_interval','60',0,0),('calendar_project_tasks','date_started',0,0),('calendar_user_subtasks_time_tracking','0',0,0),('calendar_user_tasks','date_started',0,0),('cfd_include_closed_tasks','1',0,0),('default_color','yellow',0,0),('integration_gravatar','0',0,0),('password_reset','1',0,0),('project_categories','',0,0),('subtask_restriction','0',0,0),('subtask_time_tracking','1',0,0),('webhook_token','1d62395a742260738a406789366a84138ced50a1be62e8862c5cf8d0a561',0,0),('webhook_url','',0,0); /*!40000 ALTER TABLE `settings` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -676,4 +699,4 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$kliMGeKgDYtx9Igek9jGDu0eZM.KXivgzvqtnMuWMkjvZiIc.8p8S', 'app-admin');INSERT INTO schema_version VALUES ('110'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$Kv6fus67I/ZG/3LYJ7bRLeis8bk8455Lwtu12ElgnGm3lhRs/z7Ni', 'app-admin');INSERT INTO schema_version VALUES ('111'); diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql index 6c17c1b1..94239054 100644 --- a/app/Schema/Sql/postgres.sql +++ b/app/Schema/Sql/postgres.sql @@ -739,6 +739,36 @@ CREATE SEQUENCE "swimlanes_id_seq" ALTER SEQUENCE "swimlanes_id_seq" OWNED BY "swimlanes"."id"; +-- +-- Name: tags; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE "tags" ( + "id" integer NOT NULL, + "name" character varying(255) NOT NULL, + "project_id" integer NOT NULL +); + + +-- +-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE "tags_id_seq" + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE "tags_id_seq" OWNED BY "tags"."id"; + + -- -- Name: task_has_external_links; Type: TABLE; Schema: public; Owner: - -- @@ -873,6 +903,16 @@ CREATE SEQUENCE "task_has_subtasks_id_seq" ALTER SEQUENCE "task_has_subtasks_id_seq" OWNED BY "subtasks"."id"; +-- +-- Name: task_has_tags; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE "task_has_tags" ( + "task_id" integer NOT NULL, + "tag_id" integer NOT NULL +); + + -- -- Name: tasks; Type: TABLE; Schema: public; Owner: - -- @@ -1232,6 +1272,13 @@ ALTER TABLE ONLY "subtasks" ALTER COLUMN "id" SET DEFAULT "nextval"('"task_has_s ALTER TABLE ONLY "swimlanes" ALTER COLUMN "id" SET DEFAULT "nextval"('"swimlanes_id_seq"'::"regclass"); +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "tags" ALTER COLUMN "id" SET DEFAULT "nextval"('"tags_id_seq"'::"regclass"); + + -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- @@ -1544,6 +1591,22 @@ ALTER TABLE ONLY "swimlanes" ADD CONSTRAINT "swimlanes_pkey" PRIMARY KEY ("id"); +-- +-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "tags" + ADD CONSTRAINT "tags_pkey" PRIMARY KEY ("id"); + + +-- +-- Name: tags_project_id_name_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "tags" + ADD CONSTRAINT "tags_project_id_name_key" UNIQUE ("project_id", "name"); + + -- -- Name: task_has_external_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -1584,6 +1647,14 @@ ALTER TABLE ONLY "subtasks" ADD CONSTRAINT "task_has_subtasks_pkey" PRIMARY KEY ("id"); +-- +-- Name: task_has_tags_tag_id_task_id_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "task_has_tags" + ADD CONSTRAINT "task_has_tags_tag_id_task_id_key" UNIQUE ("tag_id", "task_id"); + + -- -- Name: tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2030,6 +2101,22 @@ ALTER TABLE ONLY "subtasks" ADD CONSTRAINT "task_has_subtasks_task_id_fkey" FOREIGN KEY ("task_id") REFERENCES "tasks"("id") ON DELETE CASCADE; +-- +-- Name: task_has_tags_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "task_has_tags" + ADD CONSTRAINT "task_has_tags_tag_id_fkey" FOREIGN KEY ("tag_id") REFERENCES "tags"("id") ON DELETE CASCADE; + + +-- +-- Name: task_has_tags_task_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "task_has_tags" + ADD CONSTRAINT "task_has_tags_task_id_fkey" FOREIGN KEY ("task_id") REFERENCES "tasks"("id") ON DELETE CASCADE; + + -- -- Name: tasks_column_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -2155,8 +2242,7 @@ INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_high INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_public_refresh_interval', '60', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_private_refresh_interval', '10', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_columns', '', 0, 0); -INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('webhook_token', '85b9f242e49f4c50176591a2f9b812c626384b89ff985a02068455a5be07', 0, 0); -INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('api_token', '207d1aaeb9d6d5c01f9ef1e6d61baca86c4c66fdd0b95e76b5c5953681e4', 0, 0); +INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('webhook_token', '1aff324d30632aaed0d4f4dc1281be0d5bbc7b4fcddccc4badcd6c8f3d43', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_language', 'en_US', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_timezone', 'UTC', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_url', '', 0, 0); @@ -2174,6 +2260,7 @@ INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('default_co INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('subtask_time_tracking', '1', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('cfd_include_closed_tasks', '1', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('password_reset', '1', 0, 0); +INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('api_token', '19ffd9709d03ce50675c3a43d1c49c1ac207f4bc45f06c5b2701fbdf8929', 0, 0); -- @@ -2225,4 +2312,4 @@ SELECT pg_catalog.setval('links_id_seq', 11, true); -- PostgreSQL database dump complete -- -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$kliMGeKgDYtx9Igek9jGDu0eZM.KXivgzvqtnMuWMkjvZiIc.8p8S', 'app-admin');INSERT INTO schema_version VALUES ('89'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$Kv6fus67I/ZG/3LYJ7bRLeis8bk8455Lwtu12ElgnGm3lhRs/z7Ni', 'app-admin');INSERT INTO schema_version VALUES ('90'); -- cgit v1.2.3 From 6ccd8c11faff4a8b5209b45c140d12f94d97449b Mon Sep 17 00:00:00 2001 From: Busfreak Date: Tue, 5 Jul 2016 17:09:13 +0200 Subject: Hide tasks within specific columns in dashboard (#2424) --- app/Controller/ColumnController.php | 4 ++-- app/Locale/bs_BA/translations.php | 1 + app/Locale/cs_CZ/translations.php | 1 + app/Locale/da_DK/translations.php | 1 + app/Locale/de_DE/translations.php | 1 + app/Locale/el_GR/translations.php | 1 + app/Locale/es_ES/translations.php | 1 + app/Locale/fi_FI/translations.php | 1 + app/Locale/fr_FR/translations.php | 1 + app/Locale/hu_HU/translations.php | 1 + app/Locale/id_ID/translations.php | 1 + app/Locale/it_IT/translations.php | 1 + app/Locale/ja_JP/translations.php | 1 + app/Locale/ko_KR/translations.php | 1 + app/Locale/my_MY/translations.php | 1 + app/Locale/nb_NO/translations.php | 1 + app/Locale/nl_NL/translations.php | 1 + app/Locale/pl_PL/translations.php | 1 + app/Locale/pt_BR/translations.php | 1 + app/Locale/pt_PT/translations.php | 1 + app/Locale/ru_RU/translations.php | 1 + app/Locale/sr_Latn_RS/translations.php | 1 + app/Locale/sv_SE/translations.php | 1 + app/Locale/th_TH/translations.php | 1 + app/Locale/tr_TR/translations.php | 1 + app/Locale/zh_CN/translations.php | 1 + app/Model/ColumnModel.php | 6 ++++-- app/Model/TaskFinderModel.php | 3 ++- app/Schema/Mysql.php | 7 ++++++- app/Schema/Postgres.php | 7 ++++++- app/Schema/Sql/mysql.sql | 1 + app/Schema/Sql/postgres.sql | 1 + app/Schema/Sqlite.php | 7 ++++++- app/Template/column/create.php | 2 ++ app/Template/column/edit.php | 2 ++ app/Template/project_view/show.php | 10 +++++++++- 36 files changed, 66 insertions(+), 9 deletions(-) (limited to 'app/Schema') diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php index 95fbcaaa..e3f9bfff 100644 --- a/app/Controller/ColumnController.php +++ b/app/Controller/ColumnController.php @@ -66,7 +66,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateCreation($values); if ($valid) { - if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description']) !== false) { + if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) { $this->flash->success(t('Column created successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); } else { @@ -111,7 +111,7 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateModification($values); if ($valid) { - if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) { $this->flash->success(t('Board updated successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } else { diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 4213d10d..e3c29261 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index 78df7ecc..ce66eee5 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index bf595a01..f9bc0031 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index aa80f781..d3192f46 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1216,4 +1216,5 @@ return array( 'Global tags' => 'Globale Schlagwörter', 'There is no global tag at the moment.' => 'Es gibt zur Zeit kein globales Schlagwort', 'This field cannot be empty' => 'Dieses Feld kann nicht leer sein', + 'Hide tasks in this column in the Dashboard' => 'Aufgaben in dieser Spalte im Dashboard ausblenden', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index d4c55040..745acaea 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 40c9a8c0..604a5e3e 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 58360ab0..73b65463 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 8684d1e9..9431846d 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1217,4 +1217,5 @@ return array( 'Global tags' => 'Libellés globaux', 'There is no global tag at the moment.' => 'Il n\'y a aucun libellé global pour le moment.', 'This field cannot be empty' => 'Ce champ ne peut être vide', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index c80c0a20..9acdbd1a 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index d3776515..d8c42cf4 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 3d02201c..9d2af814 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1216,4 +1216,5 @@ return array( 'Global tags' => 'Tag globali', 'There is no global tag at the moment.' => 'Non sono definiti tag globali al momento.', 'This field cannot be empty' => 'Questo campo non può essere vuoto', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 692afb78..9f6ab88f 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 75d6be43..f48b7486 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 94e94780..bad6d919 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index cfd7ba1b..19372419 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 69f2b862..8ba0d394 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + //' Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 7c132bbd..09c247d8 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 343915b6..7659ba2b 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index d9ea27be..1f9a7030 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1216,4 +1216,5 @@ return array( 'Global tags' => 'Etiquetas globais', 'There is no global tag at the moment.' => 'De momento não existe nenhuma etiqueta global.', // 'This field cannot be empty' => '', + //'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 8e9fb7f1..5b182dbf 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1216,4 +1216,5 @@ return array( 'Global tags' => 'Глобальные метка', 'There is no global tag at the moment.' => 'Нет глобальных меток.', 'This field cannot be empty' => 'Это поле не может быть пустым', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 00e607fd..7aec7142 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 88db5d63..bce1ccfb 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index fd35d28c..48a0b3de 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 41e22596..b25ef122 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 2f456cc3..d000b706 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1216,4 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', + // 'Hide tasks in this column in the Dashboard' => '', ); diff --git a/app/Model/ColumnModel.php b/app/Model/ColumnModel.php index 795fe692..0a9c55a8 100644 --- a/app/Model/ColumnModel.php +++ b/app/Model/ColumnModel.php @@ -144,13 +144,14 @@ class ColumnModel extends Base * @param string $description Column description * @return boolean|integer */ - public function create($project_id, $title, $task_limit = 0, $description = '') + public function create($project_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) { $values = array( 'project_id' => $project_id, 'title' => $title, 'task_limit' => intval($task_limit), 'position' => $this->getLastColumnPosition($project_id) + 1, + 'hide_in_dashboard' => $hide_in_dashboard, 'description' => $description, ); @@ -167,11 +168,12 @@ class ColumnModel extends Base * @param string $description Optional description * @return boolean */ - public function update($column_id, $title, $task_limit = 0, $description = '') + public function update($column_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) { return $this->db->table(self::TABLE)->eq('id', $column_id)->update(array( 'title' => $title, 'task_limit' => intval($task_limit), + 'hide_in_dashboard' => $hide_in_dashboard, 'description' => $description, )); } diff --git a/app/Model/TaskFinderModel.php b/app/Model/TaskFinderModel.php index 0e8585ea..7268052c 100644 --- a/app/Model/TaskFinderModel.php +++ b/app/Model/TaskFinderModel.php @@ -81,7 +81,8 @@ class TaskFinderModel extends Base ->join(ColumnModel::TABLE, 'id', 'column_id') ->eq(TaskModel::TABLE.'.owner_id', $user_id) ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) - ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE); + ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE) + ->eq(ColumnModel::TABLE.'.hide_in_dashboard', 0); } /** diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 82ccb8c8..99fed66f 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,12 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 111; +const VERSION = 112; + +function version_112(PDO $pdo) +{ + $pdo->exec('ALTER TABLE columns ADD COLUMN hide_in_dashboard INT DEFAULT 0 NOT NULL'); +} function version_111(PDO $pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 229cbd25..b982bcae 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,12 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 90; +const VERSION = 91; + +function version_91(PDO $pdo) +{ + $pdo->exec("ALTER TABLE columns ADD COLUMN hide_in_dashboard BOOLEAN DEFAULT '0'"); +} function version_90(PDO $pdo) { diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql index 9583989d..8d2f2dc0 100644 --- a/app/Schema/Sql/mysql.sql +++ b/app/Schema/Sql/mysql.sql @@ -44,6 +44,7 @@ CREATE TABLE `columns` ( `position` int(11) NOT NULL, `project_id` int(11) NOT NULL, `task_limit` int(11) DEFAULT '0', + `hide_in_dashboard` int(11) DEFAULT '0', `description` text, PRIMARY KEY (`id`), UNIQUE KEY `idx_title_project` (`title`,`project_id`), diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql index 94239054..ae8b4fd5 100644 --- a/app/Schema/Sql/postgres.sql +++ b/app/Schema/Sql/postgres.sql @@ -98,6 +98,7 @@ CREATE TABLE "columns" ( "position" integer, "project_id" integer NOT NULL, "task_limit" integer DEFAULT 0, + "hide_in_dashboard" integer DEFAULT 0, "description" "text" ); diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index dac348d4..2a7735ee 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,12 @@ use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; use PDO; -const VERSION = 102; +const VERSION = 103; + +function version_103(PDO $pdo) +{ + $pdo->exec("ALTER TABLE columns ADD COLUMN hide_in_dashboard INTEGER DEFAULT 0 NOT NULL"); +} function version_102(PDO $pdo) { diff --git a/app/Template/column/create.php b/app/Template/column/create.php index 023de525..387b6a47 100644 --- a/app/Template/column/create.php +++ b/app/Template/column/create.php @@ -13,6 +13,8 @@ form->label(t('Task limit'), 'task_limit') ?> form->number('task_limit', $values, $errors) ?> + form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1) ?> + form->label(t('Description'), 'description') ?> form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php index a742e4b9..abd70119 100644 --- a/app/Template/column/edit.php +++ b/app/Template/column/edit.php @@ -15,6 +15,8 @@ form->label(t('Task limit'), 'task_limit') ?> form->number('task_limit', $values, $errors) ?> + form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1, $values['hide_in_dashboard'] == 1) ?> + form->label(t('Description'), 'description') ?> form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> diff --git a/app/Template/project_view/show.php b/app/Template/project_view/show.php index 5efe8ce6..0ad8852b 100644 --- a/app/Template/project_view/show.php +++ b/app/Template/project_view/show.php @@ -54,9 +54,10 @@ - + + @@ -70,6 +71,13 @@ +
+ + + + + +
-- cgit v1.2.3 From 397988dd8ddeefa57da085c7cc5ac9231c33370b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 9 Jul 2016 14:51:39 -0400 Subject: Fix a couple of bugs in PR #2424 --- app/Controller/ColumnController.php | 20 ++++- app/Locale/bs_BA/translations.php | 2 +- app/Locale/cs_CZ/translations.php | 2 +- app/Locale/da_DK/translations.php | 2 +- app/Locale/de_DE/translations.php | 2 +- app/Locale/el_GR/translations.php | 2 +- app/Locale/es_ES/translations.php | 2 +- app/Locale/fi_FI/translations.php | 2 +- app/Locale/fr_FR/translations.php | 2 +- app/Locale/hu_HU/translations.php | 2 +- app/Locale/id_ID/translations.php | 2 +- app/Locale/it_IT/translations.php | 2 +- app/Locale/ja_JP/translations.php | 2 +- app/Locale/ko_KR/translations.php | 2 +- app/Locale/my_MY/translations.php | 2 +- app/Locale/nb_NO/translations.php | 2 +- app/Locale/nl_NL/translations.php | 2 +- app/Locale/pl_PL/translations.php | 2 +- app/Locale/pt_BR/translations.php | 2 +- app/Locale/pt_PT/translations.php | 2 +- app/Locale/ru_RU/translations.php | 2 +- app/Locale/sr_Latn_RS/translations.php | 2 +- app/Locale/sv_SE/translations.php | 2 +- app/Locale/th_TH/translations.php | 2 +- app/Locale/tr_TR/translations.php | 2 +- app/Locale/zh_CN/translations.php | 2 +- app/Model/ColumnModel.php | 12 +-- app/Schema/Sql/mysql.sql | 4 +- app/Schema/Sql/postgres.sql | 10 +-- app/Template/column/create.php | 2 +- app/Template/column/edit.php | 2 +- app/Template/project_view/show.php | 2 +- tests/units/Model/TaskFinderModelTest.php | 142 ++++++++++++++++++++++++++++++ tests/units/Model/TaskFinderTest.php | 115 ------------------------ 34 files changed, 202 insertions(+), 157 deletions(-) create mode 100644 tests/units/Model/TaskFinderModelTest.php delete mode 100644 tests/units/Model/TaskFinderTest.php (limited to 'app/Schema') diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php index e3f9bfff..d3f0e36e 100644 --- a/app/Controller/ColumnController.php +++ b/app/Controller/ColumnController.php @@ -66,7 +66,15 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateCreation($values); if ($valid) { - if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) { + $result = $this->columnModel->create( + $project['id'], + $values['title'], + $values['task_limit'], + $values['description'], + isset($values['hide_in_dashboard']) ? $values['hide_in_dashboard'] : 0 + ); + + if ($result !== false) { $this->flash->success(t('Column created successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); } else { @@ -111,7 +119,15 @@ class ColumnController extends BaseController list($valid, $errors) = $this->columnValidator->validateModification($values); if ($valid) { - if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) { + $result = $this->columnModel->update( + $values['id'], + $values['title'], + $values['task_limit'], + $values['description'], + isset($values['hide_in_dashboard']) ? $values['hide_in_dashboard'] : 0 + ); + + if ($result) { $this->flash->success(t('Board updated successfully.')); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); } else { diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index e3c29261..5f513347 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index ce66eee5..1c28f4f9 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index f9bc0031..abebd394 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index d3192f46..f569206b 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1216,5 +1216,5 @@ return array( 'Global tags' => 'Globale Schlagwörter', 'There is no global tag at the moment.' => 'Es gibt zur Zeit kein globales Schlagwort', 'This field cannot be empty' => 'Dieses Feld kann nicht leer sein', - 'Hide tasks in this column in the Dashboard' => 'Aufgaben in dieser Spalte im Dashboard ausblenden', + 'Hide tasks in this column in the dashboard' => 'Aufgaben in dieser Spalte im Dashboard ausblenden', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 745acaea..c1d7c579 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 604a5e3e..5699ce6f 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 73b65463..6fe4852c 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index e3ee8a4b..7663da0f 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1217,5 +1217,5 @@ return array( 'Global tags' => 'Libellés globaux', 'There is no global tag at the moment.' => 'Il n\'y a aucun libellé global pour le moment.', 'This field cannot be empty' => 'Ce champ ne peut être vide', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 9acdbd1a..96db72ef 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index d8c42cf4..2d6e5aa3 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 9d2af814..e10b61da 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1216,5 +1216,5 @@ return array( 'Global tags' => 'Tag globali', 'There is no global tag at the moment.' => 'Non sono definiti tag globali al momento.', 'This field cannot be empty' => 'Questo campo non può essere vuoto', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 9f6ab88f..2fe13ac9 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index f48b7486..bd25d11f 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index bad6d919..ff8960aa 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 19372419..8752a159 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 8ba0d394..e07ea32c 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - //' Hide tasks in this column in the Dashboard' => '', + //' Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 09c247d8..896d2ed4 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 7659ba2b..40f3bb4d 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 1f9a7030..08375ad0 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1216,5 +1216,5 @@ return array( 'Global tags' => 'Etiquetas globais', 'There is no global tag at the moment.' => 'De momento não existe nenhuma etiqueta global.', // 'This field cannot be empty' => '', - //'Hide tasks in this column in the Dashboard' => '', + //'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index fe950172..c6285f6a 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1216,5 +1216,5 @@ return array( 'Global tags' => 'Глобальные метка', 'There is no global tag at the moment.' => 'Нет глобальных меток.', 'This field cannot be empty' => 'Это поле не может быть пустым', - 'Hide tasks in this column in the Dashboard' => 'Не показывать задачи из этой колонки в кабинете', + 'Hide tasks in this column in the dashboard' => 'Не показывать задачи из этой колонки в кабинете', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 7aec7142..92ed3424 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index bce1ccfb..eedcf0fc 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 48a0b3de..a6de8bce 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index b25ef122..35e29649 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index d000b706..0ef01ef7 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1216,5 +1216,5 @@ return array( // 'Global tags' => '', // 'There is no global tag at the moment.' => '', // 'This field cannot be empty' => '', - // 'Hide tasks in this column in the Dashboard' => '', + // 'Hide tasks in this column in the dashboard' => '', ); diff --git a/app/Model/ColumnModel.php b/app/Model/ColumnModel.php index 0a9c55a8..5498ef54 100644 --- a/app/Model/ColumnModel.php +++ b/app/Model/ColumnModel.php @@ -138,11 +138,12 @@ class ColumnModel extends Base * Add a new column to the board * * @access public - * @param integer $project_id Project id - * @param string $title Column title - * @param integer $task_limit Task limit - * @param string $description Column description - * @return boolean|integer + * @param integer $project_id Project id + * @param string $title Column title + * @param integer $task_limit Task limit + * @param string $description Column description + * @param integer $hide_in_dashboard + * @return bool|int */ public function create($project_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) { @@ -166,6 +167,7 @@ class ColumnModel extends Base * @param string $title Column title * @param integer $task_limit Task limit * @param string $description Optional description + * @param integer $hide_in_dashboard * @return boolean */ public function update($column_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0) diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql index 8d2f2dc0..67dd170a 100644 --- a/app/Schema/Sql/mysql.sql +++ b/app/Schema/Sql/mysql.sql @@ -44,8 +44,8 @@ CREATE TABLE `columns` ( `position` int(11) NOT NULL, `project_id` int(11) NOT NULL, `task_limit` int(11) DEFAULT '0', - `hide_in_dashboard` int(11) DEFAULT '0', `description` text, + `hide_in_dashboard` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `idx_title_project` (`title`,`project_id`), KEY `columns_project_idx` (`project_id`), @@ -700,4 +700,4 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$Kv6fus67I/ZG/3LYJ7bRLeis8bk8455Lwtu12ElgnGm3lhRs/z7Ni', 'app-admin');INSERT INTO schema_version VALUES ('111'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$g28mYPBdsf3/gX/ayd7A8.HSPBRQ/zM/PXlfijelJhXwhnukCRIDi', 'app-admin');INSERT INTO schema_version VALUES ('112'); diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql index ae8b4fd5..5b4142b7 100644 --- a/app/Schema/Sql/postgres.sql +++ b/app/Schema/Sql/postgres.sql @@ -98,8 +98,8 @@ CREATE TABLE "columns" ( "position" integer, "project_id" integer NOT NULL, "task_limit" integer DEFAULT 0, - "hide_in_dashboard" integer DEFAULT 0, - "description" "text" + "description" "text", + "hide_in_dashboard" boolean DEFAULT false ); @@ -2243,7 +2243,8 @@ INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_high INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_public_refresh_interval', '60', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_private_refresh_interval', '10', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('board_columns', '', 0, 0); -INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('webhook_token', '1aff324d30632aaed0d4f4dc1281be0d5bbc7b4fcddccc4badcd6c8f3d43', 0, 0); +INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('webhook_token', 'c9a7c2a4523f1724b2ca047c5685f8e2b26bba47eb69baf4f22d5d50d837', 0, 0); +INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('api_token', 'c57a6cb1789269547b616454e4e2f06d3de0514f83baf8fa5b5a8af44a08', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_language', 'en_US', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_timezone', 'UTC', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('application_url', '', 0, 0); @@ -2261,7 +2262,6 @@ INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('default_co INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('subtask_time_tracking', '1', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('cfd_include_closed_tasks', '1', 0, 0); INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('password_reset', '1', 0, 0); -INSERT INTO settings (option, value, changed_by, changed_on) VALUES ('api_token', '19ffd9709d03ce50675c3a43d1c49c1ac207f4bc45f06c5b2701fbdf8929', 0, 0); -- @@ -2313,4 +2313,4 @@ SELECT pg_catalog.setval('links_id_seq', 11, true); -- PostgreSQL database dump complete -- -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$Kv6fus67I/ZG/3LYJ7bRLeis8bk8455Lwtu12ElgnGm3lhRs/z7Ni', 'app-admin');INSERT INTO schema_version VALUES ('90'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$g28mYPBdsf3/gX/ayd7A8.HSPBRQ/zM/PXlfijelJhXwhnukCRIDi', 'app-admin');INSERT INTO schema_version VALUES ('91'); diff --git a/app/Template/column/create.php b/app/Template/column/create.php index 387b6a47..812e9139 100644 --- a/app/Template/column/create.php +++ b/app/Template/column/create.php @@ -13,7 +13,7 @@ form->label(t('Task limit'), 'task_limit') ?> form->number('task_limit', $values, $errors) ?> - form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1) ?> + form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1) ?> form->label(t('Description'), 'description') ?> form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php index abd70119..89487298 100644 --- a/app/Template/column/edit.php +++ b/app/Template/column/edit.php @@ -15,7 +15,7 @@ form->label(t('Task limit'), 'task_limit') ?> form->number('task_limit', $values, $errors) ?> - form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1, $values['hide_in_dashboard'] == 1) ?> + form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1, $values['hide_in_dashboard'] == 1) ?> form->label(t('Description'), 'description') ?> form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> diff --git a/app/Template/project_view/show.php b/app/Template/project_view/show.php index 0ad8852b..667a576c 100644 --- a/app/Template/project_view/show.php +++ b/app/Template/project_view/show.php @@ -57,7 +57,7 @@ - + diff --git a/tests/units/Model/TaskFinderModelTest.php b/tests/units/Model/TaskFinderModelTest.php new file mode 100644 index 00000000..72da3b6d --- /dev/null +++ b/tests/units/Model/TaskFinderModelTest.php @@ -0,0 +1,142 @@ +container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + $columnModel = new ColumnModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1))); + + $tasks = $taskFinderModel->getUserQuery(1)->findAll(); + $this->assertCount(2, $tasks); + + $this->assertTrue($columnModel->update(2, 'Test', 0, '', 1)); + + $tasks = $taskFinderModel->getUserQuery(1)->findAll(); + $this->assertCount(1, $tasks); + $this->assertEquals('Task #1', $tasks[0]['title']); + + $this->assertTrue($columnModel->update(2, 'Test', 0, '', 0)); + + $tasks = $taskFinderModel->getUserQuery(1)->findAll(); + $this->assertCount(2, $tasks); + } + + public function testGetOverdueTasks() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); + $this->assertEquals(3, $taskCreationModel->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => 0))); + $this->assertEquals(4, $taskCreationModel->create(array('title' => 'Task #3', 'project_id' => 1))); + + $tasks = $taskFinderModel->getOverdueTasks(); + $this->assertNotEmpty($tasks); + $this->assertTrue(is_array($tasks)); + $this->assertCount(1, $tasks); + $this->assertEquals('Task #1', $tasks[0]['title']); + } + + public function testGetOverdueTasksByProject() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 2, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(3, $taskCreationModel->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); + $this->assertEquals(4, $taskCreationModel->create(array('title' => 'Task #4', 'project_id' => 1, 'date_due' => 0))); + $this->assertEquals(5, $taskCreationModel->create(array('title' => 'Task #5', 'project_id' => 1))); + + $tasks = $taskFinderModel->getOverdueTasksByProject(1); + $this->assertNotEmpty($tasks); + $this->assertTrue(is_array($tasks)); + $this->assertCount(1, $tasks); + $this->assertEquals('Task #1', $tasks[0]['title']); + } + + public function testGetOverdueTasksByUser() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1, 'owner_id' => 1, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 2, 'owner_id' => 1, 'date_due' => strtotime('-1 day')))); + $this->assertEquals(3, $taskCreationModel->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); + $this->assertEquals(4, $taskCreationModel->create(array('title' => 'Task #4', 'project_id' => 1, 'date_due' => 0))); + $this->assertEquals(5, $taskCreationModel->create(array('title' => 'Task #5', 'project_id' => 1))); + + $tasks = $taskFinderModel->getOverdueTasksByUser(1); + $this->assertNotEmpty($tasks); + $this->assertTrue(is_array($tasks)); + $this->assertCount(2, $tasks); + + $this->assertEquals(1, $tasks[0]['id']); + $this->assertEquals('Task #1', $tasks[0]['title']); + $this->assertEquals(1, $tasks[0]['owner_id']); + $this->assertEquals(1, $tasks[0]['project_id']); + $this->assertEquals('Project #1', $tasks[0]['project_name']); + $this->assertEquals('admin', $tasks[0]['assignee_username']); + $this->assertEquals('', $tasks[0]['assignee_name']); + + $this->assertEquals('Task #2', $tasks[1]['title']); + } + + public function testCountByProject() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 2))); + $this->assertEquals(3, $taskCreationModel->create(array('title' => 'Task #3', 'project_id' => 2))); + + $this->assertEquals(1, $taskFinderModel->countByProjectId(1)); + $this->assertEquals(2, $taskFinderModel->countByProjectId(2)); + } + + public function testGetProjectToken() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); + + $this->assertTrue($projectModel->enablePublicAccess(1)); + + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 2))); + + $project = $projectModel->getById(1); + $this->assertEquals($project['token'], $taskFinderModel->getProjectToken(1)); + $this->assertEmpty($taskFinderModel->getProjectToken(2)); + } +} diff --git a/tests/units/Model/TaskFinderTest.php b/tests/units/Model/TaskFinderTest.php deleted file mode 100644 index 46792baf..00000000 --- a/tests/units/Model/TaskFinderTest.php +++ /dev/null @@ -1,115 +0,0 @@ -container); - $tf = new TaskFinderModel($this->container); - $p = new ProjectModel($this->container); - - $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); - $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); - $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); - $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => 0))); - $this->assertEquals(4, $tc->create(array('title' => 'Task #3', 'project_id' => 1))); - - $tasks = $tf->getOverdueTasks(); - $this->assertNotEmpty($tasks); - $this->assertTrue(is_array($tasks)); - $this->assertCount(1, $tasks); - $this->assertEquals('Task #1', $tasks[0]['title']); - } - - public function testGetOverdueTasksByProject() - { - $tc = new TaskCreationModel($this->container); - $tf = new TaskFinderModel($this->container); - $p = new ProjectModel($this->container); - - $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); - $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); - $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'date_due' => strtotime('-1 day')))); - $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2, 'date_due' => strtotime('-1 day')))); - $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); - $this->assertEquals(4, $tc->create(array('title' => 'Task #4', 'project_id' => 1, 'date_due' => 0))); - $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1))); - - $tasks = $tf->getOverdueTasksByProject(1); - $this->assertNotEmpty($tasks); - $this->assertTrue(is_array($tasks)); - $this->assertCount(1, $tasks); - $this->assertEquals('Task #1', $tasks[0]['title']); - } - - public function testGetOverdueTasksByUser() - { - $tc = new TaskCreationModel($this->container); - $tf = new TaskFinderModel($this->container); - $p = new ProjectModel($this->container); - - $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); - $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); - $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'owner_id' => 1, 'date_due' => strtotime('-1 day')))); - $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2, 'owner_id' => 1, 'date_due' => strtotime('-1 day')))); - $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => strtotime('+1 day')))); - $this->assertEquals(4, $tc->create(array('title' => 'Task #4', 'project_id' => 1, 'date_due' => 0))); - $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1))); - - $tasks = $tf->getOverdueTasksByUser(1); - $this->assertNotEmpty($tasks); - $this->assertTrue(is_array($tasks)); - $this->assertCount(2, $tasks); - - $this->assertEquals(1, $tasks[0]['id']); - $this->assertEquals('Task #1', $tasks[0]['title']); - $this->assertEquals(1, $tasks[0]['owner_id']); - $this->assertEquals(1, $tasks[0]['project_id']); - $this->assertEquals('Project #1', $tasks[0]['project_name']); - $this->assertEquals('admin', $tasks[0]['assignee_username']); - $this->assertEquals('', $tasks[0]['assignee_name']); - - $this->assertEquals('Task #2', $tasks[1]['title']); - } - - public function testCountByProject() - { - $tc = new TaskCreationModel($this->container); - $tf = new TaskFinderModel($this->container); - $p = new ProjectModel($this->container); - - $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); - $this->assertEquals(2, $p->create(array('name' => 'Project #2'))); - $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1))); - $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2))); - $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 2))); - - $this->assertEquals(1, $tf->countByProjectId(1)); - $this->assertEquals(2, $tf->countByProjectId(2)); - } - - public function testGetProjectToken() - { - $taskCreationModel = new TaskCreationModel($this->container); - $taskFinderModel = new TaskFinderModel($this->container); - $projectModel = new ProjectModel($this->container); - - $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); - $this->assertEquals(2, $projectModel->create(array('name' => 'Project #2'))); - - $this->assertTrue($projectModel->enablePublicAccess(1)); - - $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task #1', 'project_id' => 1))); - $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task #2', 'project_id' => 2))); - - $project = $projectModel->getById(1); - $this->assertEquals($project['token'], $taskFinderModel->getProjectToken(1)); - $this->assertEmpty($taskFinderModel->getProjectToken(2)); - } -} -- cgit v1.2.3 From c020a45ee1a1d62c06493ab916dea1da77ac921f Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 12 Jul 2016 22:19:37 -0400 Subject: Make sure that the table schema_version use InnoDB for Mysql --- ChangeLog | 1 + app/Schema/Sql/mysql.sql | 4 ++-- app/Schema/Sql/postgres.sql | 2 +- composer.json | 2 +- composer.lock | 14 +++++++------- 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'app/Schema') diff --git a/ChangeLog b/ChangeLog index 8074c3d7..881c3020 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ New features: Improvements: * Display TOTP issuer for 2FA +* Make sure that the table schema_version use InnoDB for Mysql Bug fixes: diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql index 67dd170a..8d494dcf 100644 --- a/app/Schema/Sql/mysql.sql +++ b/app/Schema/Sql/mysql.sql @@ -671,7 +671,7 @@ CREATE TABLE `users` ( LOCK TABLES `settings` WRITE; /*!40000 ALTER TABLE `settings` DISABLE KEYS */; -INSERT INTO `settings` VALUES ('api_token','19ffd9709d03ce50675c3a43d1c49c1ac207f4bc45f06c5b2701fbdf8929',0,0),('application_currency','USD',0,0),('application_date_format','m/d/Y',0,0),('application_language','en_US',0,0),('application_stylesheet','',0,0),('application_timezone','UTC',0,0),('application_url','',0,0),('board_columns','',0,0),('board_highlight_period','172800',0,0),('board_private_refresh_interval','10',0,0),('board_public_refresh_interval','60',0,0),('calendar_project_tasks','date_started',0,0),('calendar_user_subtasks_time_tracking','0',0,0),('calendar_user_tasks','date_started',0,0),('cfd_include_closed_tasks','1',0,0),('default_color','yellow',0,0),('integration_gravatar','0',0,0),('password_reset','1',0,0),('project_categories','',0,0),('subtask_restriction','0',0,0),('subtask_time_tracking','1',0,0),('webhook_token','1d62395a742260738a406789366a84138ced50a1be62e8862c5cf8d0a561',0,0),('webhook_url','',0,0); +INSERT INTO `settings` VALUES ('api_token','4064ef3d26efa9a0ff78fa7067d8bb9d99323455128edd89e9dc7c53ed76',0,0),('application_currency','USD',0,0),('application_date_format','m/d/Y',0,0),('application_language','en_US',0,0),('application_stylesheet','',0,0),('application_timezone','UTC',0,0),('application_url','',0,0),('board_columns','',0,0),('board_highlight_period','172800',0,0),('board_private_refresh_interval','10',0,0),('board_public_refresh_interval','60',0,0),('calendar_project_tasks','date_started',0,0),('calendar_user_subtasks_time_tracking','0',0,0),('calendar_user_tasks','date_started',0,0),('cfd_include_closed_tasks','1',0,0),('default_color','yellow',0,0),('integration_gravatar','0',0,0),('password_reset','1',0,0),('project_categories','',0,0),('subtask_restriction','0',0,0),('subtask_time_tracking','1',0,0),('webhook_token','c8f53c0bcd8aead902ad04f180ffafd7889b9c0062c2d510e2297ef543b8',0,0),('webhook_url','',0,0); /*!40000 ALTER TABLE `settings` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -700,4 +700,4 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$g28mYPBdsf3/gX/ayd7A8.HSPBRQ/zM/PXlfijelJhXwhnukCRIDi', 'app-admin');INSERT INTO schema_version VALUES ('112'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$yUJ9QnhG.f47yO.YvWKo3eMAHULukpluDNTOF9.Z7QQg0vOfFRB6u', 'app-admin');INSERT INTO schema_version VALUES ('112'); diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql index 5b4142b7..0add9c91 100644 --- a/app/Schema/Sql/postgres.sql +++ b/app/Schema/Sql/postgres.sql @@ -2313,4 +2313,4 @@ SELECT pg_catalog.setval('links_id_seq', 11, true); -- PostgreSQL database dump complete -- -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$g28mYPBdsf3/gX/ayd7A8.HSPBRQ/zM/PXlfijelJhXwhnukCRIDi', 'app-admin');INSERT INTO schema_version VALUES ('91'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$yUJ9QnhG.f47yO.YvWKo3eMAHULukpluDNTOF9.Z7QQg0vOfFRB6u', 'app-admin');INSERT INTO schema_version VALUES ('91'); diff --git a/composer.json b/composer.json index d82f3f0c..a619dc0a 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "eluceo/ical": "0.10.1", "erusev/parsedown" : "1.6.0", "fguillot/json-rpc" : "1.2.1", - "fguillot/picodb" : "1.0.12", + "fguillot/picodb" : "1.0.13", "fguillot/simpleLogger" : "1.0.1", "fguillot/simple-validator" : "1.0.1", "fguillot/simple-queue" : "1.0.1", diff --git a/composer.lock b/composer.lock index 03c5e523..a7697470 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ab5b2c960b3a6d9f93883606269085e0", - "content-hash": "bd5f17c3382d7f85e33a68023927704c", + "hash": "77e9464e13331b1dec5c810d1c186ebf", + "content-hash": "0d13e80c805e296f3765cc329d51358a", "packages": [ { "name": "christian-riesen/base32", @@ -245,16 +245,16 @@ }, { "name": "fguillot/picodb", - "version": "v1.0.12", + "version": "v1.0.13", "source": { "type": "git", "url": "https://github.com/fguillot/picoDb.git", - "reference": "dd088cb75e9035d083f511cdc77b268bc8e110b6" + "reference": "e8e02cd6a170811eed6c70d1edcbb419818d303a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoDb/zipball/dd088cb75e9035d083f511cdc77b268bc8e110b6", - "reference": "dd088cb75e9035d083f511cdc77b268bc8e110b6", + "url": "https://api.github.com/repos/fguillot/picoDb/zipball/e8e02cd6a170811eed6c70d1edcbb419818d303a", + "reference": "e8e02cd6a170811eed6c70d1edcbb419818d303a", "shasum": "" }, "require": { @@ -281,7 +281,7 @@ ], "description": "Minimalist database query builder", "homepage": "https://github.com/fguillot/picoDb", - "time": "2016-05-28 22:00:54" + "time": "2016-07-13 02:11:01" }, { "name": "fguillot/simple-queue", -- cgit v1.2.3