X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=index.php;h=03e307755e6895685e8a84a73312af2136fbe9e4;hb=98110d79b6536290baffd1468f22cb8b046902cd;hp=1c17785de788b0b0af5bdf6efc1a7ac40889f1e0;hpb=1f3edf2d29c76c8c2789f23e9f02869df72327e0;p=contractor-progress.git diff --git a/index.php b/index.php index 1c17785..03e3077 100644 --- a/index.php +++ b/index.php @@ -69,6 +69,10 @@ function task_summary($tem_prefix, $where_clause/*, ... */) { # status strings: 'finished_untested', 'finished_unpaid', 'queue' function totals_summary($arr) { if($arr) { + $total_finished_untested = 0; + $total_finished_unpaid = 0; + $total_queue = 0; + $total_working = 0; foreach($arr as $client_id => $t) { $finished_untested = 0; $finished_unpaid = 0; @@ -88,26 +92,45 @@ function totals_summary($arr) { } tem_set('tested_total', $finished_unpaid); tem_set('done_total', $finished_unpaid + $finished_untested); + tem_set('not_tested_total', $finished_untested); tem_set('queued_total', $queue + $working); tem_set('client', db_get_value('people', 'username', 'where id=%i', $client_id)); tem_show('unpaid_totals_row'); + $total_finished_untested += $finished_untested; + $total_finished_unpaid += $finished_unpaid; + $total_queue += $queue; + $total_working += $working; } + tem_set('tested_total', $total_finished_unpaid); + tem_set('done_total', $total_finished_unpaid + $total_finished_untested); + tem_set('not_tested_total', $total_finished_untested); + tem_set('queued_total', $total_queue + $total_working); + tem_set('client', 'all'); + tem_show('unpaid_totals_row'); + tem_show('unpaid_totals'); } } function _index_main() { $client_id = logged_in(); + $ever_was_contractor = ever_was_contractor(); - # make sure they've filled out the tiny user agreement - $tiny_agreement = db_get_value('people', 'tiny_agreement', 'where id=%i', $client_id); - if($tiny_agreement < 30) { - return './tiny_agreement'; + # make sure the client (not the contractor) has filled out the tiny agreement + if(!$ever_was_contractor) { + $tiny_agreement = db_get_value('people', 'tiny_agreement', 'where id=%i', $client_id); + if($tiny_agreement < 30 || $tiny_agreement > 999) { + return './tiny_agreement'; + } } - if(logged_in_as_contractor()) { + if($ever_was_contractor) { tem_show('su_link'); + } + + if(logged_in_as_contractor()) { + tem_show('contractor_links'); tem_show('needs_attention_header'); $GLOBALS['unpaid_totals'] = array(); @@ -122,10 +145,11 @@ function _index_main() { totals_summary($GLOBALS['unpaid_totals']); task_summary('finished_paid', 'where state=%i && paid = 1 order by finished_at desc limit 20', TASK_FINISHED); } else { - if(db_count('tasks', 'where client_id=%i && (state=%i || state=%i || state=%i || state=%i)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) { + tem_show('not_contractor_links'); + if(db_count('tasks', 'where client_id=%i && (state=%i || state=%i || state=%i || state=%i || state=%i)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_ON_HOLD, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) { tem_show('needs_attention_header'); task_summary('needs_approval', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING); - task_summary('needs_fixing', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION); + task_summary('needs_fixing', 'where client_id=%i && (state=%i || state=%i || state=%i) order by id', $client_id, TASK_ON_HOLD, TASK_DRAFT, TASK_NEEDS_CLARIFICATION); } task_summary('queue', 'where client_id=%i && state=%i order by ord desc', $client_id, TASK_QUEUED); task_summary('jason', 'where client_id=%i && (state=%i || state=%i) order by id desc', $client_id, TASK_NEEDS_QUOTE, TASK_BUG);