Skip to content

CFM-291_fixes #197

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/error.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
9 changes: 7 additions & 2 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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']]));
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions app/templates/element/filter/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
});
});
Expand Down Expand Up @@ -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
Expand Down