mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New Feature: Ability to disable and enable new records being drawn from a sample
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
queXS 1.11.0 - Changes since 1.10.4
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `questionnaire_sample` ADD `allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1';
|
||||||
|
|
||||||
|
|
||||||
queXS 1.10.4 - Changes since 1.10.3
|
queXS 1.10.4 - Changes since 1.10.3
|
||||||
|
|
||||||
Fixed bug: Quota priority could get below 0
|
Fixed bug: Quota priority could get below 0
|
||||||
|
|||||||
@@ -69,10 +69,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['
|
|||||||
$am = bigintval($_GET['answering_machine_messages']);
|
$am = bigintval($_GET['answering_machine_messages']);
|
||||||
$selecttype = 0;
|
$selecttype = 0;
|
||||||
if (isset($_GET['selecttype'])) $selecttype = 1;
|
if (isset($_GET['selecttype'])) $selecttype = 1;
|
||||||
|
$an = 0;
|
||||||
|
if (isset($_GET['allownew'])) $an = 1;
|
||||||
|
|
||||||
|
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new)
|
||||||
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages)
|
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
|
||||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am')";
|
|
||||||
|
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
|
|
||||||
@@ -89,13 +90,17 @@ if (isset($_POST['edit']))
|
|||||||
$am = bigintval($_POST['answering_machine_messages']);
|
$am = bigintval($_POST['answering_machine_messages']);
|
||||||
$selecttype = 0;
|
$selecttype = 0;
|
||||||
if (isset($_POST['selecttype'])) $selecttype = 1;
|
if (isset($_POST['selecttype'])) $selecttype = 1;
|
||||||
|
$an = 0;
|
||||||
|
if (isset($_POST['allownew'])) $an = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "UPDATE questionnaire_sample
|
$sql = "UPDATE questionnaire_sample
|
||||||
SET call_max = '$cm',
|
SET call_max = '$cm',
|
||||||
call_attempt_max = '$cam',
|
call_attempt_max = '$cam',
|
||||||
random_select = '$selecttype',
|
random_select = '$selecttype',
|
||||||
answering_machine_messages = '$am'
|
answering_machine_messages = '$am',
|
||||||
|
allow_new = '$an'
|
||||||
WHERE questionnaire_id = '$questionnaire_id'
|
WHERE questionnaire_id = '$questionnaire_id'
|
||||||
AND sample_import_id = '$sid'";
|
AND sample_import_id = '$sid'";
|
||||||
|
|
||||||
@@ -119,7 +124,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
|||||||
q.call_max,
|
q.call_max,
|
||||||
q.call_attempt_max,
|
q.call_attempt_max,
|
||||||
q.random_select,
|
q.random_select,
|
||||||
q.answering_machine_messages
|
q.answering_machine_messages,
|
||||||
|
q.allow_new
|
||||||
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
|
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
|
||||||
WHERE q.sample_import_id = si.sample_import_id
|
WHERE q.sample_import_id = si.sample_import_id
|
||||||
AND q.questionnaire_id = '$questionnaire_id'
|
AND q.questionnaire_id = '$questionnaire_id'
|
||||||
@@ -134,9 +140,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
|||||||
|
|
||||||
print "<p><a href='?questionnaire_id=$questionnaire_id'>" . T_("Go back") . "</a></p>";
|
print "<p><a href='?questionnaire_id=$questionnaire_id'>" . T_("Go back") . "</a></p>";
|
||||||
|
|
||||||
$selected ="";
|
$allownew = $selected ="";
|
||||||
if ($qs['random_select'] == 1)
|
if ($qs['random_select'] == 1)
|
||||||
$selected = "checked=\"checked\"";
|
$selected = "checked=\"checked\"";
|
||||||
|
if ($qs['allow_new'] == 1)
|
||||||
|
$allownew = "checked=\"checked\"";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post">
|
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post">
|
||||||
@@ -144,6 +152,7 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
|||||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>"/> <br/>
|
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>"/> <br/>
|
||||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>"/> <br/>
|
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>"/> <br/>
|
||||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> /> <br/>
|
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> /> <br/>
|
||||||
|
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> /> <br/>
|
||||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||||
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
||||||
<input type="submit" name="edit" value="<?php echo T_("Edit"); ?>"/></p>
|
<input type="submit" name="edit" value="<?php echo T_("Edit"); ?>"/></p>
|
||||||
@@ -181,6 +190,7 @@ if ($questionnaire_id != false)
|
|||||||
CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||||
CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select,
|
CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select,
|
||||||
CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||||
|
CASE WHEN q.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Edit") ."</a>') as edit,
|
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Edit") ."</a>') as edit,
|
||||||
CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Click to unassign") ."</a>') as unassign
|
CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Click to unassign") ."</a>') as unassign
|
||||||
FROM questionnaire_sample as q, sample_import as si
|
FROM questionnaire_sample as q, sample_import as si
|
||||||
@@ -190,7 +200,7 @@ if ($questionnaire_id != false)
|
|||||||
$qs = $db->GetAll($sql);
|
$qs = $db->GetAll($sql);
|
||||||
|
|
||||||
if (!empty($qs))
|
if (!empty($qs))
|
||||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Edit"), T_("Unassign sample") ));
|
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample") ));
|
||||||
else
|
else
|
||||||
print "<p>" . T_("No samples selected for this questionnaire") . "</p>";
|
print "<p>" . T_("No samples selected for this questionnaire") . "</p>";
|
||||||
|
|
||||||
@@ -223,6 +233,7 @@ if ($questionnaire_id != false)
|
|||||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
|
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
|
||||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
|
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
|
||||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
|
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
|
||||||
|
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" checked="checked" /> <br/>
|
||||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||||
<input type="submit" name="add_sample" value="<?php echo T_("Add sample");?>"/></p>
|
<input type="submit" name="add_sample" value="<?php echo T_("Add sample");?>"/></p>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1447,6 +1447,7 @@ CREATE TABLE `questionnaire_sample` (
|
|||||||
`call_attempt_max` int(11) NOT NULL default '0',
|
`call_attempt_max` int(11) NOT NULL default '0',
|
||||||
`random_select` tinyint(1) NOT NULL default '0',
|
`random_select` tinyint(1) NOT NULL default '0',
|
||||||
`answering_machine_messages` int(11) NOT NULL default '1',
|
`answering_machine_messages` int(11) NOT NULL default '1',
|
||||||
|
`allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1',
|
||||||
PRIMARY KEY (`questionnaire_id`,`sample_import_id`)
|
PRIMARY KEY (`questionnaire_id`,`sample_import_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ function get_case_id($operator_id, $create = false)
|
|||||||
|
|
||||||
$sql = "SELECT s.sample_id as sample_id,c.case_id as case_id,qs.questionnaire_id as questionnaire_id,CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) as resptime, q.testing as testing
|
$sql = "SELECT s.sample_id as sample_id,c.case_id as case_id,qs.questionnaire_id as questionnaire_id,CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) as resptime, q.testing as testing
|
||||||
FROM sample as s
|
FROM sample as s
|
||||||
JOIN (questionnaire_sample as qs, operator_questionnaire as o, questionnaire as q, operator as op, sample_import as si, operator_skill as os) on (op.operator_id = '$operator_id' and qs.sample_import_id = s.import_id and o.operator_id = op.operator_id and o.questionnaire_id = qs.questionnaire_id and q.questionnaire_id = o.questionnaire_id and si.sample_import_id = s.import_id and os.operator_id = op.operator_id and os.outcome_type_id = 1 and q.enabled = 1)
|
JOIN (questionnaire_sample as qs, operator_questionnaire as o, questionnaire as q, operator as op, sample_import as si, operator_skill as os) on (op.operator_id = '$operator_id' and qs.sample_import_id = s.import_id and o.operator_id = op.operator_id and o.questionnaire_id = qs.questionnaire_id and q.questionnaire_id = o.questionnaire_id and si.sample_import_id = s.import_id and os.operator_id = op.operator_id and os.outcome_type_id = 1 and q.enabled = 1 and qs.allow_new = 1)
|
||||||
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
||||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||||
|
|||||||
Reference in New Issue
Block a user