" . T_("Go back") . "";
- xhtml_table($fs,array('fid','name','quest','link'),array(T_('Form ID'),T_('Operator'),T_('Questionnaire'),T_('Re verify')));
+ xhtml_table($fs,array('fid','name','quest','scan','link','linkrevise'),array(T_('Form ID'),T_('Operator'),T_('Questionnaire'),T_('Uploaded file'),T_('Re verify'),T_('Revise')));
}
else
{
- //print available questionnaires
+ //print available questionnaires
$sql = "SELECT qid,description
- FROM questionnaires
- ORDER BY qid DESC";
-
+ FROM questionnaires
+ ORDER BY qid DESC";
+
$qs = $db->GetAll($sql);
foreach($qs as $q)
@@ -91,7 +100,5 @@
}
}
-
xhtml_foot();
-
?>
diff --git a/functions/functions.database.php b/functions/functions.database.php
old mode 100755
new mode 100644
index 12fa890..aaede19
--- a/functions/functions.database.php
+++ b/functions/functions.database.php
@@ -1,5 +1,4 @@
Execute($sql);
-
$i++;
}
-
$db->CompleteTrans();
-
}
/* Sort box groups by their variable name
@@ -70,15 +62,12 @@ function sort_order_varname($qid)
{
global $db;
-
$db->StartTrans();
-
$sql = "SELECT b.bgid as bgid
FROM `boxgroupstype` AS b, pages AS p
WHERE p.qid = '$qid'
AND b.pid = p.pid
ORDER BY b.varname ASC";
-
$all = $db->GetAll($sql);
$i = 0;
@@ -87,29 +76,22 @@ function sort_order_varname($qid)
$sql = "UPDATE boxgroupstype
SET sortorder = '$i'
WHERE bgid = '{$row['bgid']}'";
-
$db->Execute($sql);
-
$i++;
}
$db->CompleteTrans();
-
}
-
/*
* Assign the next free form to a verifier
*/
-
function assign_to($vid)
{
global $db;
-
$db->StartTrans();
//only assign a form if none currently assigned
- //
$sql = "SELECT f.fid as fid
FROM forms as f
WHERE f.done IN (0,2,3)
@@ -130,61 +112,64 @@ function assign_to($vid)
}
}
- $fid = false;
+ $fid = false;
//check for supervisor forms first
-
$sql = "SELECT f.fid AS fid
FROM forms AS f
JOIN supervisorquestionnaire AS v ON (v.vid = '$vid' AND f.qid = v.qid) ";
-
$sql .= " WHERE f.done =2
AND f.assigned_vid IS NULL ";
-
- $sql .= " ORDER BY f.fid ASC LIMIT 1";
-
+ $sql .= " ORDER BY f.fid ASC LIMIT 1";
$rs = $db->GetRow($sql);
-
- if (empty($rs))
+
+ //check for revise forms second
+ $sql = "SELECT f.fid AS fid
+ FROM forms AS f
+ WHERE f.done = 4 AND f.assigned_vid = '$vid'
+ ORDER BY f.fid ASC LIMIT 1";
+ $rs = $db->GetRow($sql);
+ if (!empty($rs))
{
- //only get forms that are assigned to this verifier
-
- $sql = "SELECT f.fid AS fid
- FROM forms AS f
- JOIN verifierquestionnaire AS v ON (v.vid = '$vid' AND f.qid = v.qid) ";
-
- if (!MISSING_PAGE_ASSIGN){
- $sql .= " LEFT JOIN missingpages AS m ON (f.fid = m.fid) ";
- }
+ print T_("Revise forms fid=");
+ print($rs['fid']);
+ }
+ else
+ {
+ //only get forms that are assigned to this verifier
+ $sql = "SELECT f.fid AS fid
+ FROM forms AS f
+ JOIN verifierquestionnaire AS v ON (v.vid = '$vid' AND f.qid = v.qid) ";
- $sql .= " WHERE ((f.done =0
- AND f.assigned_vid IS NULL) OR
- (f.done = 3 AND f.assigned_vid IS NULL AND f.assigned_vid2 != '$vid')
- ) ";
+ if (!MISSING_PAGE_ASSIGN){
+ $sql .= " LEFT JOIN missingpages AS m ON (f.fid = m.fid) ";
+ }
- if (!MISSING_PAGE_ASSIGN) {
- $sql .= " AND m.fid IS NULL ";
- }
+ $sql .= " WHERE ((f.done = 0 AND f.assigned_vid IS NULL) OR
+ (f.done = 3 AND f.assigned_vid IS NULL AND f.assigned_vid2 != '$vid')) ";
- if (!VERIFY_WITH_MISSING_PAGES)
- {
- $sql .= "AND NOT EXISTS(
- SELECT p.pid
- FROM pages AS p
- WHERE p.qid = f.qid
- AND NOT EXISTS
- (SELECT fp.fid
- FROM formpages AS fp
- WHERE fp.fid = f.fid
- AND fp.pid = p.pid))";
- }
+ if (!MISSING_PAGE_ASSIGN) {
+ $sql .= " AND m.fid IS NULL ";
+ }
- $sql .= " ORDER BY f.done,f.fid ASC
- LIMIT 1";
+ if (!VERIFY_WITH_MISSING_PAGES)
+ {
+ $sql .= "AND NOT EXISTS(
+ SELECT p.pid
+ FROM pages AS p
+ WHERE p.qid = f.qid
+ AND NOT EXISTS
+ (SELECT fp.fid
+ FROM formpages AS fp
+ WHERE fp.fid = f.fid
+ AND fp.pid = p.pid))";
+ }
+ $sql .= " ORDER BY f.done,f.fid ASC LIMIT 1";
+ //var_dump($sql);exit();
- $rs = $db->GetRow($sql);
- }
+ $rs = $db->GetRow($sql);
+ }
if (!empty($rs))
{
@@ -207,8 +192,6 @@ function assign_to($vid)
}
-
-
function assign_to_merge($vid)
{
global $db;
@@ -235,12 +218,8 @@ function assign_to_merge($vid)
$db->CompleteTrans();
return $fid;
-
}
-
-
-
function get_vid()
{
global $db;
@@ -257,11 +236,8 @@ function get_vid()
{
return $rs['vid'];
}
-
-
}
-
function get_fid($vid = "")
{
global $db;
@@ -271,7 +247,7 @@ function get_fid($vid = "")
$sql = "SELECT fid
FROM forms
WHERE assigned_vid = '$vid'
- AND done IN (0,2,3)";
+ AND done IN (0,2,3,4)";
$rs = $db->GetRow($sql);
@@ -288,10 +264,8 @@ function get_fid($vid = "")
}
}
return false;
-
}
-
function detect_differences()
{
global $db;
@@ -341,27 +315,20 @@ function detect_differences()
print_r($diff);
print " ";
}
-
}
-
}
-
-
function get_qid_description($fid)
{
global $db;
$sql = "SELECT f.qid,f.description,q.double_entry
FROM `forms` as f, questionnaires as q
- WHERE f.fid = '$fid'
- AND q.qid = f.qid";
+ WHERE f.fid = '$fid'
+ AND q.qid = f.qid";
$rs = $db->GetRow($sql);
return $rs;
}
-
-
-
?>
diff --git a/verifyjs.php b/verifyjs.php
index 2d27391..8f64da0 100755
--- a/verifyjs.php
+++ b/verifyjs.php
@@ -1,5 +1,4 @@
";
- //display alignment markers
- $sql = "SELECT tlx,tly,trx,try,blx,bly,brx,bry FROM pages WHERE pid = $pid";
- $pmark = $db->GetRow($sql);
- print "
@@ -499,7 +476,7 @@ function bgidtocss($zoom,$fid,$pid)
$prs = $db->GetAll($sql);
- foreach($prs as $pr)
+ foreach($prs as $pr)
{
$pqid = $pr['qid'];
$pdes = $pr['description'];
@@ -510,6 +487,12 @@ function bgidtocss($zoom,$fid,$pid)
AND done IN (0,2)";
$remain = $db->GetOne($sql);
+
+ $sql = "SELECT count(*) as rem
+ FROM forms
+ WHERE qid = '$pqid'
+ AND done = 4";
+ $remainrev = $db->GetOne($sql);
$sql = "SELECT count(*) as ver
FROM forms
@@ -538,10 +521,10 @@ function bgidtocss($zoom,$fid,$pid)
$prss = $db->GetAll($sql);
print "
$pdes
";
- xhtml_table($prss,array('ve','c','CPH','PPH'),array(T_("Operator"),T_("Completed Forms"),T_("Completions Per Hour"),T_("Pages Per Hour")),"tclass",array
-("vid" => $vid));
+ xhtml_table($prss,array('ve','c','CPH','PPH'),array(T_("Operator"),T_("Completed Forms"),T_("Completions Per Hour"),T_("Pages Per Hour")),"tclass",array("vid" => $vid));
print "
" . T_("Remain to verify") . ": $remain
";
print "
" . T_("Waiting for double entry") . ": $verify
";
+ print "
" . T_("Remain to revise") . ": $remainrev
";
}
xhtml_foot();
@@ -556,27 +539,26 @@ function bgidtocss($zoom,$fid,$pid)
if (!isset($_SESSION['boxes'])) {
//nothing yet known about this form
- $ovid = 0;
+ $ovid = 0;
- $sql = "SELECT done,assigned_vid2
- FROM forms
- WHERE fid = $fid";
+ $sql = "SELECT done,assigned_vid2
+ FROM forms
+ WHERE fid = $fid";
- $dstatus = $db->GetRow($sql);
+ $dstatus = $db->GetRow($sql);
- if ($dstatus['done'] == 3)
- $ovid = $dstatus['assigned_vid2'];
+ if ($dstatus['done'] == 3)
+ $ovid = $dstatus['assigned_vid2'];
$sql = "SELECT b.bid as bid, b.tlx as tlx, b.tly as tly, b.brx as brx, b.bry as bry, b.pid as pid, bg.btid as btid, b.bgid as bgid, $fid as fid, bg.sortorder as sortorder, fb.filled, CASE WHEN d.fid IS NOT NULL THEN d.val ELSE c.val END as val
FROM boxes AS b
JOIN boxgroupstype as bg ON (bg.bgid = b.bgid AND bg.btid > 0)
- JOIN pages as p ON (p.pid = b.pid AND p.qid = '$qid')
- LEFT JOIN formboxes as fb ON (fb.bid = b.bid AND fb.fid = '$fid')
+ JOIN pages as p ON (p.pid = b.pid AND p.qid = '$qid')
+ LEFT JOIN formboxes as fb ON (fb.bid = b.bid AND fb.fid = '$fid')
LEFT JOIN formboxverifychar AS c ON (c.fid = '$fid' AND c.vid = '$ovid' AND c.bid = b.bid)
LEFT JOIN formboxverifytext AS d ON (d.fid = '$fid' AND d.vid = '$ovid' AND d.bid = b.bid)
ORDER BY bg.sortorder ASC";
-
$sql2 = "SELECT b.bgid,0 as done,MIN(b.pid) as pid,bg.varname,bg.btid
FROM boxes as b, boxgroupstype as bg, pages as p
WHERE p.pid = b.pid
@@ -594,10 +576,10 @@ function bgidtocss($zoom,$fid,$pid)
GROUP BY b.pid
ORDER BY MIN(bg.sortorder) ASC";
- $a = $db->GetAssoc($sql);
+ $a = $db->GetAssoc($sql);
if (empty($a))
{
- xhtml_head(T_("Verify: No more work"),true,false,false,"onload='document.form1.assign.focus();'");
+ xhtml_head(T_("Verify: No more work"),true,false,false,"onload='document.form1.assign.focus();'");
print "
";
@@ -619,53 +601,51 @@ function bgidtocss($zoom,$fid,$pid)
$_SESSION['assigned'] = time();
- if (SINGLE_CHOICE_AUTOMATIC_VERIFICATION)
- {
-
- //see if any boxes should be automatically marked as verified
-
- //search for single choice boxes (btid == 1), within box groups where > 1 box is available
- //if there is one and only one box within the filled range, and val is set as 1, then mark as done
-
- $tmpt = current($a);
- //set to first bgid
- $tmpbgid = $tmpt['bgid'];
- $tmpgroup = array();
- foreach($_SESSION['boxes'] as $key => $val)
- {
- if ($val['bgid'] != $tmpbgid)
- {
- //check the number of boxes in this group that fall within the restrictions
- $within = 0;
- $withinkey = 0;
- $withincount = 0;
- foreach($tmpgroup as $tkey => $tval)
- {
- if ($tval['filled'] < SINGLE_CHOICE_MIN_FILLED && $tval['filled'] > SINGLE_CHOICE_MAX_FILLED)
- {
- $within++;
- $withinkey = $tkey;
- }
- $withincount++;
- }
-
- //if one box within and also this is the selected box - mark this box group as done
- if ($withincount > 1 && $within == 1 && $_SESSION['boxes'][$withinkey]['val'] == 1)
- {
- $_SESSION['boxgroups'][$_SESSION['boxes'][$withinkey]['bgid']]['done'] = 1;
- }
+ if (SINGLE_CHOICE_AUTOMATIC_VERIFICATION)
+ {
+ //see if any boxes should be automatically marked as verified
+ //search for single choice boxes (btid == 1), within box groups where > 1 box is available
+ //if there is one and only one box within the filled range, and val is set as 1, then mark as done
+
+ $tmpt = current($a);
+ //set to first bgid
+ $tmpbgid = $tmpt['bgid'];
+ $tmpgroup = array();
+ foreach($_SESSION['boxes'] as $key => $val)
+ {
+ if ($val['bgid'] != $tmpbgid)
+ {
+ //check the number of boxes in this group that fall within the restrictions
+ $within = 0;
+ $withinkey = 0;
+ $withincount = 0;
+ foreach($tmpgroup as $tkey => $tval)
+ {
+ if ($tval['filled'] < SINGLE_CHOICE_MIN_FILLED && $tval['filled'] > SINGLE_CHOICE_MAX_FILLED)
+ {
+ $within++;
+ $withinkey = $tkey;
+ }
+ $withincount++;
+ }
- $tmpbgid = $val['bgid'];
- $tmpgroup = array();
- }
+ //if one box within and also this is the selected box - mark this box group as done
+ if ($withincount > 1 && $within == 1 && $_SESSION['boxes'][$withinkey]['val'] == 1)
+ {
+ $_SESSION['boxgroups'][$_SESSION['boxes'][$withinkey]['bgid']]['done'] = 1;
+ }
+
+ $tmpbgid = $val['bgid'];
+ $tmpgroup = array();
+ }
- //only for single choice boxes
- if ($val['btid'] == 1)
- {
- $tmpgroup[$key] = $val;
- }
- }
- }
+ //only for single choice boxes
+ if ($val['btid'] == 1)
+ {
+ $tmpgroup[$key] = $val;
+ }
+ }
+ }
}
@@ -696,9 +676,6 @@ function bgidtocss($zoom,$fid,$pid)
{
$_SESSION['boxes'][$bb['bid']]['val'] = "";
}
-
-
-
}
}
@@ -713,8 +690,6 @@ function bgidtocss($zoom,$fid,$pid)
$_SESSION['boxes'][$bid]['val'] = $getval;
}
}
-
-
}
$bgid = "";
@@ -741,7 +716,6 @@ function bgidtocss($zoom,$fid,$pid)
}
}
-
if ($bgid != "")
{
$sql = "SELECT pid
@@ -755,30 +729,26 @@ function bgidtocss($zoom,$fid,$pid)
else if ($pid == "")
{
//we are done
-// xhtml_head(T_("Verify: Done"));
- xhtml_head(T_("Verify: Done"),true,false,false,"onload='document.form1.complete.focus();'");
+ //xhtml_head(T_("Verify: Done"));
+ xhtml_head(T_("Verify: Done"),true,false,false,"onload='document.form1.complete.focus();'");
print "
" . T_("The required fields have been filled") . "