|
8 | 8 |
|
9 | 9 | class StringUtils extends \ExternalModules\AbstractExternalModule {
|
10 | 10 |
|
11 |
| - const annotation = ["@TOLOWER", "@TOUPPER", "@SUBSTR", "@LTRIM", "@RTRIM", "@TRIM", "@STRLEN", "@INDEXOF", "@CONCAT"]; |
| 11 | + const annotation = ["@TOLOWER", "@TOUPPER", "@SUBSTR", "@LTRIM", "@RTRIM", "@TRIM", "@STRLEN", "@INDEXOF", "@CONCAT", "@RIGHT"]; |
12 | 12 |
|
13 | 13 |
|
14 | 14 | public function redcap_data_entry_form($project_id, $record, $instrument, $event_id, $group_id, $repeat_instance)
|
@@ -127,6 +127,16 @@ public function getListenersFromAnot($field_annotation, $field, $annotation, arr
|
127 | 127 | }
|
128 | 128 | $listeners[$selectedFields[0]] .= '$("input[name=\'' . $destinationField . '\']").val($("input[name=\'' . $selectedFields[0] . '\']").val().substr(' . $selectedFields[1] . ', ' . $selectedFields[2] . '));';
|
129 | 129 | break;
|
| 130 | + case "@RIGHT": |
| 131 | + $selectedFields = explode(",", $sourceField); |
| 132 | + if (!is_numeric($selectedFields[1])) { |
| 133 | + $warnings [] = 'For field: ' . $destinationField . ' ' . $selectedFields[1] . ' is not numeric'; |
| 134 | + } |
| 135 | + if (!in_array($selectedFields[0], $fieldNames)) { |
| 136 | + $warnings [] = 'For field: ' . $destinationField . ' ' . $selectedFields[0] . ' is not a field.'; |
| 137 | + } |
| 138 | + $listeners[$selectedFields[0]] .= '$("input[name=\'' . $destinationField . '\']").val($("input[name=\'' . $selectedFields[0] . '\']").val().substr($("input[name=\'' . $selectedFields[0] . '\']").val().length - ' . $selectedFields[1] . ', $("input[name=\'' . $selectedFields[0] . '\']").val().length));'; |
| 139 | + break; |
130 | 140 | case "@CONCAT":
|
131 | 141 | $sourceFieldsConcat = [];
|
132 | 142 | $explodedSource = explode (",", $sourceField);
|
|
0 commit comments