diff --git a/CHANGELOG b/CHANGELOG index b84fbc69..d51dc247 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Fixed bug: Quota priority could get below 0 diff --git a/admin/assignsample.php b/admin/assignsample.php index 1e84d2a4..1369f11c 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -69,10 +69,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET[' $am = bigintval($_GET['answering_machine_messages']); $selecttype = 0; 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) - VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am')"; + $sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new) + VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')"; $db->Execute($sql); @@ -89,13 +90,17 @@ if (isset($_POST['edit'])) $am = bigintval($_POST['answering_machine_messages']); $selecttype = 0; if (isset($_POST['selecttype'])) $selecttype = 1; + $an = 0; + if (isset($_POST['allownew'])) $an = 1; + $sql = "UPDATE questionnaire_sample SET call_max = '$cm', call_attempt_max = '$cam', random_select = '$selecttype', - answering_machine_messages = '$am' + answering_machine_messages = '$am', + allow_new = '$an' WHERE questionnaire_id = '$questionnaire_id' AND sample_import_id = '$sid'"; @@ -119,7 +124,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) q.call_max, q.call_attempt_max, 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 WHERE q.sample_import_id = si.sample_import_id AND q.questionnaire_id = '$questionnaire_id' @@ -134,9 +140,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) print "

" . T_("Go back") . "

"; - $selected =""; + $allownew = $selected =""; if ($qs['random_select'] == 1) $selected = "checked=\"checked\""; + if ($qs['allow_new'] == 1) + $allownew = "checked=\"checked\""; ?>
@@ -144,6 +152,7 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))

/>
+ />
"/>

@@ -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.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.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new, CONCAT('" . TQ_("Edit") ."') as edit, CONCAT('" . TQ_("Click to unassign") ."') as unassign FROM questionnaire_sample as q, sample_import as si @@ -190,7 +200,7 @@ if ($questionnaire_id != false) $qs = $db->GetAll($sql); 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 print "

" . T_("No samples selected for this questionnaire") . "

"; @@ -223,6 +233,7 @@ if ($questionnaire_id != false)


+
"/>

diff --git a/database/quexs.sql b/database/quexs.sql index bf50273b..011725b6 100644 --- a/database/quexs.sql +++ b/database/quexs.sql @@ -1447,6 +1447,7 @@ CREATE TABLE `questionnaire_sample` ( `call_attempt_max` int(11) NOT NULL default '0', `random_select` tinyint(1) NOT NULL default '0', `answering_machine_messages` int(11) NOT NULL default '1', + `allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1', PRIMARY KEY (`questionnaire_id`,`sample_import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/functions/functions.operator.php b/functions/functions.operator.php index c9f57024..9afbc7e1 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -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 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 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))