JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added "mark paid" link in mostly the right places
[contractor-progress.git] / tasks.php
index 03bca46..561c1d9 100644 (file)
--- a/tasks.php
+++ b/tasks.php
@@ -1,5 +1,20 @@
 <?php
 
+#  Copyright (C) 2008  Jason Woofenden
+#
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 require_once('code/tasks.php');
 
 $GLOBALS['tasks_form_recipient'] = "fixme@example.com";
@@ -111,6 +126,7 @@ function tasks_display_main() {
                                case TASK_NEEDS_TESTING:
                                case TASK_FINISHED:
                                        tem_show('price_row');
+                                       tem_show('mark_paid_link'); # FIXME
                                break;
                        }
                } else {
@@ -124,7 +140,7 @@ function tasks_display_main() {
                                case TASK_NEEDS_GO_AHEAD:
                                        tem_show('price_row');
                                        tem_show('approve_price_link');
-                                       tem_show('warning_edit_link');
+                                       tem_show('normal_edit_link');
                                break;
                                case TASK_QUEUED:
                                        tem_show('price_row');
@@ -173,6 +189,17 @@ function tasks_edit_main() {
                $state = TASK_BUG;
        }
 
+       if(isset($_REQUEST['tasks_mark_paid_id'])) {
+               if(!logged_in_as_contractor()) {
+                       message("Error: only Jason can mark tasks as paid.");
+                       return './';
+               }
+               $id = $_REQUEST['tasks_mark_paid_id'];
+               db_update('tasks', 'paid', 1, 'where id=%i', $id);
+               message('Marked as paid.');
+               return './';
+       }
+
        if(isset($_REQUEST['tasks_approve_price_id'])) {
                $id = $_REQUEST['tasks_approve_price_id'];
                $owner = db_get_value('tasks', 'client_id', 'where id=%i', $id);;