diff --git a/includes/form.inc b/includes/form.inc
index 0a6f918..03725be 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -320,7 +320,8 @@ function upei_roblib_ill_request_form($form, &$form_state) {
module_load_include('inc', 'upei_roblib_ill', 'includes/utilities');
$form['#prefix'] = '
';
- $genre = empty(upei_roblib_ill_get_request_variable('genre')) ? 'article' : upei_roblib_ill_get_request_variable('genre');
+ $type = upei_roblib_ill_get_request_variable('genre');
+ $genre = empty($type) ? 'article' : $type;
$form['Genre'] = [
'#type' => 'select',
'#title' => t('Item Type'),
@@ -331,6 +332,9 @@ function upei_roblib_ill_request_form($form, &$form_state) {
],
'#required' => TRUE,
];
+ if(!empty($type)) {
+ $form['Genre']['#default_value'] = $type;
+ }
$form['doi'] = [
'#type' => 'textfield',
'#title' => t("DOI (ex: 10.1016/j.ypmed.2019.01.018) more info"),
diff --git a/includes/utilities.inc b/includes/utilities.inc
index b842fa7..e77fdbf 100644
--- a/includes/utilities.inc
+++ b/includes/utilities.inc
@@ -80,21 +80,22 @@ function upei_roblib_ill_clean_array($values) {
function upei_roblib_ill_get_request_variable($variable) {
if ($variable == 'author' && empty($_REQUEST[$variable])) {
//google scholar usually sends auinit aulast instead of author
- $initial = isset($_REQUEST['auinit']) ? $_REQUEST['auinit'] : NULL;
- $last_name = isset($_REQUEST['aulast']) ? $_REQUEST['aulast'] : NULL;
+ $initial = isset($_REQUEST['auinit']) ? check_plain($_REQUEST['auinit']) : NULL;
+ $last_name = isset($_REQUEST['aulast']) ? check_plain($_REQUEST['aulast']) : NULL;
return !empty($last_name) ? $last_name . ',' . $initial : '';
}
if ($variable == 'issn' && !empty($_REQUEST[$variable])) {
// ebsco sometimes sends garbage as issns verify this is a valid issn before displaying the value in the form.
- return preg_match('/^\d{4}-?\d{3}[\dxX]$/', $_REQUEST[$variable]) ? $_REQUEST[$variable] : '';
+ return preg_match('/^\d{4}-?\d{3}[\dxX]$/', $_REQUEST[$variable]) ? check_plain($_REQUEST[$variable]) : '';
}
// ebsco sometimes returns bookitem we only understand chapter
if (($variable == 'genre' && !empty($_REQUEST[$variable])) && $_REQUEST[$variable] == 'bookitem') {
return 'chapter';
}
- return isset($_REQUEST[$variable]) ? $_REQUEST[$variable] : '';
+ return isset($_REQUEST[$variable]) ? check_plain($_REQUEST[$variable]) : '';
}
+
function upei_roblib_ill_get_doi_from_request() {
return (!empty($_REQUEST['doi'])) ? $_REQUEST['doi'] : upei_roblib_ill_get_doi_from_id();
}