JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
auto-queue finally works for contractor entering a new task
[contractor-progress.git] / code / tasks.php
1 <?php
2
3 define('TASK_DRAFT', 0);
4 define('TASK_NEEDS_CLARIFICATION', 100);
5 define('TASK_NEEDS_QUOTE', 200);
6 define('TASK_NEEDS_GO_AHEAD', 300);
7 define('TASK_ON_HOLD', 350);
8 define('TASK_QUEUED', 400);
9 define('TASK_WORKING', 500);
10 define('TASK_BUG', 600);
11 define('TASK_NEEDS_TESTING', 700);
12 define('TASK_FINISHED', 800);
13
14 #       switch($state) {
15 #               case TASK_DRAFT:
16 #               case TASK_NEEDS_CLARIFICATION:
17 #               case TASK_NEEDS_QUOTE:
18 #               case TASK_NEEDS_GO_AHEAD:
19 #               case TASK_QUEUED:
20 #               case TASK_WORKING:
21 #               case TASK_BUG:
22 #               case TASK_NEEDS_TESTING:
23 #               case TASK_FINISHED:
24 #       }
25
26 # return true if $state is one where the client must act next
27 function needs_client_attention($state) {
28         switch($state) {
29                 case TASK_DRAFT:
30                 case TASK_NEEDS_CLARIFICATION:
31                 case TASK_NEEDS_GO_AHEAD:
32                 case TASK_NEEDS_TESTING:
33                         return true;
34                 default:
35                         return false;
36         }
37 }
38
39 function task_state_pretty($state) {
40         switch($state) {
41                 case TASK_DRAFT:
42                         return "draft";
43                 case TASK_NEEDS_CLARIFICATION:
44                         return "needs clarification";
45                 case TASK_NEEDS_QUOTE:
46                         return "to be priced";
47                 case TASK_NEEDS_GO_AHEAD:
48                         return "waiting for you to approve the price";
49                 case TASK_ON_HOLD:
50                         return "on hold";
51                 case TASK_QUEUED:
52                         return "queued";
53                 case TASK_WORKING:
54                         return "work in progress";
55                 case TASK_BUG:
56                         return "to be investigated";
57                 case TASK_NEEDS_TESTING:
58                         return "needs testing";
59                 case TASK_FINISHED:
60                         return "finished";
61                 default:
62                         return "unknown state #$state";
63         }
64 }