Portal template signature block throws error when reviewing completed document in Auditing tool

openEMR v7.0.2(1), hosted by xampp in windows. Edge for openEMR, chrome for patient portal

Hi @sjpadgett
I am getting an error when performing the “Chart to Onsite Portal Reviewed” action in the portal dashboard, for documents that contain a patient signature, where the signature came from a {PatientSignature} block in a document template.
When reviewing the document, I do see the patient’s signature displayed. Doing the Chart action does cause the document to show in the Documents | Onsite Portal | Reviewed list, but the pdf shows a broken link icon instead of the signature. After performing the Chart action, and clicking Done, the document continues to show in the Onsite Portal Activities page, with pending action = review, and status = waiting. The same can be found looking at the associated record in the onsite_portal_activity table
The error that shows (which is hard to capture, since it disappears quickly) is shown below
Nothing is getting added to php_errors.log
Thanks for pondering
– Hank

{“success”:false,“message”:“Style attribute ‘*’ is not supported (for information on implementing this, see the support forums) in CSSDefinition.php at line 534”,“errors”:,“stackTrace”:[“0 [internal function]: ExceptionThrower::HandleError(512, ‘Style attribute…’, ‘C:\\xampp\\htdocs…’, 534)”,“1 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\CSSDefinition.php(534): trigger_error(‘Style attribute…’, 512)”,“2 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\CSSDefinition.php(399): HTMLPurifier_CSSDefinition->setupConfigStuff(Object(HTMLPurifier_Config))”,“3 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\Definition.php(51): HTMLPurifier_CSSDefinition->doSetup(Object(HTMLPurifier_Config))”,“4 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\Config.php(515): HTMLPurifier_Definition->setup(Object(HTMLPurifier_Config))”,“5 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\Config.php(434): HTMLPurifier_Config->getDefinition(‘CSS’, false, false)”,“6 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\AttrDef\CSS.php(27): HTMLPurifier_Config->getCSSDefinition()”,“7 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\AttrValidator.php(96): HTMLPurifier_AttrDef_CSS->validate(‘cursor: default…’, Object(HTMLPurifier_Config), Object(HTMLPurifier_Context))”,“8 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\Strategy\RemoveForeignElements.php(89): HTMLPurifier_AttrValidator->validateToken(Object(HTMLPurifier_Token_Empty), Object(HTMLPurifier_Config), Object(HTMLPurifier_Context))”,“9 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier\Strategy\Composite.php(24): HTMLPurifier_Strategy_RemoveForeignElements->execute(Array, Object(HTMLPurifier_Config), Object(HTMLPurifier_Context))”,“10 C:\xampp\htdocs\openemr\vendor\ezyang\htmlpurifier\library\HTMLPurifier.php(211): HTMLPurifier_Strategy_Composite->execute(Array, Object(HTMLPurifier_Config), Object(HTMLPurifier_Context))”,“11 C:\xampp\htdocs\openemr\portal\patient\libs\Controller\OnsiteDocumentController.php(343): HTMLPurifier->purify(‘hello. how are …’)”,“12 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\verysimple\Phreeze\Dispatcher.php(172): OnsiteDocumentController->Update()”,“13 C:\xampp\htdocs\openemr\portal\patient\index.php(59): Dispatcher::Dispatch(Object(Phreezer), Object(SavantRenderEngine), ‘’, NULL, Object(GenericRouter))”,“14 {main}”]}

most likely patch 2 will resolve which works for me

Ok. Haven’t checked patch 2 yet, but for reference, the code throwing the error is in the vendor\ezyang\htmlpurifier library (library\HTMLPurifier\cssDefinition.php). Offending section of this file is below

For some reason, when doing the “chart to onsite portal reviewed” action, this piece of code finds a * in $this->info, and this causes the trigger_error line to fire, which stops further processing of the “submit” action, leaving the document in a “needing review” state. This seems to happen if the document contains a patient signature, but I can not always repro this. If I comment out the trigger_error line, the problem goes away, and there does not seem to be any negative consequences, but that is not a satisfying solution. Not sure if patch 2 includes an updated version of this library, or if you have any idea why a * style attribute might be in the document being processed.
Thanks

protected function setupConfigStuff($config)
    {
        // setup allowed elements
        $support = "(for information on implementing this, see the " .
            "support forums) ";
        $allowed_properties = $config->get('CSS.AllowedProperties');
        if ($allowed_properties !== null) {
            foreach ($this->info as $name => $d) {
                if (!isset($allowed_properties[$name])) {
                    unset($this->info[$name]);
                }
                unset($allowed_properties[$name]);
            }
            // emit errors
            foreach ($allowed_properties as $name => $d) {
                // :TODO: Is this htmlspecialchars() call really necessary?
                $name = htmlspecialchars($name);
                trigger_error("Style attribute '$name' is not supported $support", E_USER_WARNING);
            }
        }

        $forbidden_properties = $config->get('CSS.ForbiddenProperties');
        if ($forbidden_properties !== null) {
            foreach ($this->info as $name => $d) {
                if (isset($forbidden_properties[$name])) {
                    unset($this->info[$name]);
                }
            }
        }
    }```

This was fixed but unsure if patch 1 or before or after.

@hanksterr7
Fixed in patch 2 by removing $config->set('CSS.AllowedProperties', '*'); in around L-342 portal/patient/libs/Controller/OnsiteDocumentController.php

In case you want to fix before patch 2. Bye. :slight_smile:

Thanks for checking :slight_smile:

I checked, and I did have the line you mentioned, so that would explain why I get the error (in case anyone else finds this thread). Not sure why, but I can not reliably cause the error to happen. Even with the line in place, sometimes I get the error, sometimes not. Unclear what is different from one attempt to another, in terms of what is in the document template structure, or the data entered into the template, or ?