Skip to content

MOST 0.70 zk136 workarounds

Axel Guckelsberger edited this page Jul 31, 2017 · 10 revisions

MOST 0.70 is the end of the line for new features and bug fixes for the zk136 target platform. Workarounds for issues discovered since then can be documented and found here.

Issues with php5.3

Short array syntax used for image presets

Per https://github.com/Guite/MostGenerator/issues/942 In AbstractUploadHandler.php, function performFileUpload(), change

$preset = new \SystemPlugin_Imagine_Preset('{module}_Shrinker', [
    'width' => $maxWidth,
    'height' => $maxHeight,
    'mode' => 'inset'
]);

to

$preset = new \SystemPlugin_Imagine_Preset('GSRA_Shrinker', array(
        'width' => $maxWidth,
        'height' => $maxHeight,
        'mode' => 'inset'
      ));

Issues with email notifications in workflows

Incorrect file name/path for notification templates

When you take an action that sends a notification, you will get an error like this one:

Error! The template [email/notify[entity]Moderator.tpl] is not available in the [modulename] module.

This is because the generated template is actually saved as /templates/emailnotify[entity]Moderator.tpl ... the "/" between "email" and "notify" is missing. To fix this, create folder "templates/email" and copy all the notification templates to that folder, then rename the templates by removing "email" from the front of the file name.

Variable substitution doesn't work in notification templates

The notifications you send will look something like this:

Hello %s,

Your proposal "%s" has been changed.
It's new state is: %s

Link to your proposal: http://localhost/domain/module/entity/test-notification.html
Edit your proposal: http://localhost/domain/module/edit/ot/entity/id/2/slug/test-notification

This mail has been sent automatically by %s.

The template passes variables to replace the "%s" placeholders incorrectly. They need to be numbered, for example "tag1" instead of just "tag". For example

{gt text='Hello %s' tag=$recipient.name}

should be

{gt text='Hello %s' tag1=$recipient.name}

Does not select correct moderator groups

If you are sending a notification to moderators or supermoderators, they are always sent to the default (admin) group instead. The selector searches for groups of an incorrect case and plurality. For example for entity "evaluation", it searches for "moderationGroupForevaluation" instead of "moderationGroupForEvaluations".

This can be fixed in collectRecipients() by changing

$moderatorGroupId = $this->getVar('moderationGroupFor' . $objectType), 2);
        if ($this->recipientType == 'superModerator') {
            $moderatorGroupId = $this->getVar('superModerationGroupFor' . $objectType, 2);
        }

to

$moderatorGroupId = $this->getVar('moderationGroupFor' . ucfirst($objectType) .'s', 2);
        if ($this->recipientType == 'superModerator') {
            $moderatorGroupId = $this->getVar('superModerationGroupFor' . ucfirst($objectType) .'s', 2);
        }

This presumes that the plural name for the entity simply ends in an "s". If you have entities that have different plural names, you might need to add some conditions for different entities to be handled individually.

Issues with different permissions for different entities

If you have a module in which you have multiple user groups, and one group is allowed to do some things to some entitites and not to others, the generated code allows too much access. Discussion here: https://github.com/Guite/MostGenerator/issues/963

PrepareActionItems in entity base classes

Look for "// more actions for adding new related items" and change

$authAdmin = SecurityUtil::checkPermission($component, $instance, ACCESS_ADMIN);

to $authAdmin = SecurityUtil::checkPermission($component, $instance, ACCESS_ADD);

or whatever permission level suits you.

There may be more than one related entity referenced in this function; check each for appropriate permission level.

Display templates restrict to too low access.

@guite says this depends on the workflow selected, but I haven't tested other workflows. This issue occurs in Enterprise. Look for

{assign var='permLevel' value='ACCESS_COMMENT'}
{if $lct eq 'admin'}
    {assign var='permLevel' value='ACCESS_ADMIN'}
{/if}
{checkpermission component='GSRA:Proposal:' instance='`$proposal.id`::' level=$permLevel assign='mayManage'}

and change the first line to {assign var='permLevel' value='ACCESS_ADD'} or whatever level suits you.