File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
modules/os2forms_nemid/src/Service Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -147,9 +147,15 @@ public function retrieveCprLookupResult(FormStateInterface $form_state) {
147147 $ authProviderPlugin = $ this ->getAuthProvider ($ form_state );
148148
149149 $ userCpr = $ authProviderPlugin ->fetchValue ('cpr ' );
150- $ lookedUpCpr = $ cprLookupResult ->getCpr ();
151-
152- $ this ->auditLogger ->info ('DataLookup ' , 'User with cpr ' . $ userCpr . ' looked up cpr ' . $ lookedUpCpr );
150+ $ lookedUpCpr = $ cprLookupResult ->getFieldValue ('cpr ' );
151+
152+ // Current method is called whenever the webform is rendered.
153+ // As a result, it is also called in situations where both
154+ // userCpr and lookedUpCpr does not make sense, e.g.
155+ // adding an element to a webform.
156+ if ($ userCpr && $ lookedUpCpr ) {
157+ $ this ->auditLogger ->info ('DataLookup ' , 'User with cpr ' . $ userCpr . ' looked up cpr ' . $ lookedUpCpr );
158+ }
153159
154160 return $ cprLookupResult ;
155161 }
You can’t perform that action at this time.
0 commit comments