Skip to content

CFM-291_fixes #197

merged 1 commit into from May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/error.po
@@ -51,6 +51,9 @@ msgstr "API User \"{0}\" is not yet valid"
msgid "auth.api.unknown"
msgstr "Username \"{0}\" not found in api_users table"

msgid "auto.viewvar.type.unknown"
msgstr "Unknown Auto View Var Type {0}"

msgid "coid"
msgstr "CO ID not found"

9 changes: 7 additions & 2 deletions app/src/Controller/StandardController.php
@@ -660,6 +660,12 @@ protected function populateAutoViewVars(object $obj=null) {
case 'select':
$avvmodel = $avv['model'];
$this->$avvmodel = TableRegistry::getTableLocator()->get($avvmodel);
// XXX We should probably move to a more generic approach.
// Models can have various types of parent keys (and sometimes multiple concurrently),
// so it’s better to use PrimaryLinkTrait to handle this.
// if(method_exists($this->$avvmodel, "calculateCoForRecord")) {
// $avv['where']['co_id'] = $this->$avvmodel->calculateCoForRecord($obj)
// }
if($this->$avvmodel->getSchema()->hasColumn('co_id')) {
$avv['where']['co_id'] = $this->getCOID();
}
@@ -742,8 +748,7 @@ protected function populateAutoViewVars(object $obj=null) {
break;
default:
// XXX I18n? and in match?
throw new \LogicException('Unknonwn Auto View Var Type {0}', $avv['type']);
break;
throw new \LogicException(__d('error', 'auto.viewvar.type.unknown', [$avv['type']]));
}
}
}
7 changes: 5 additions & 2 deletions app/templates/element/filter/filter.php
@@ -36,7 +36,9 @@
filterForm.addEventListener('formdata', (event) => {
if(event.formData.has('person_id')) {
const personId = $(filterForm).find('#person_id')[0].getAttribute('datapersonid')
event.formData.set('person_id', personId)
if(personId != undefined && personId != '') {
event.formData.set('person_id', personId)
}
}
});
});
@@ -84,7 +86,8 @@
foreach($field_generic_columns as $key => $options) {
$elementArguments = compact('options', 'key');
// Set in SearchfilterTrait.php
if($vv_autocomplete_arguments['fieldName'] === $key) {
if(isset($vv_autocomplete_arguments)
&& $vv_autocomplete_arguments['fieldName'] === $key) {
// Picker is a custom type.
// This is why we calculate it here, and we
// only use it to pick the correct element