Skip to content

Commit

Permalink
Update/mtc 3811 plugin update printmailing version 5.0.0 (#43)
Browse files Browse the repository at this point in the history
* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0

* MTC-3811-update-to-version-5.0.0
  • Loading branch information
beetofly authored Jul 13, 2023
1 parent 1221eec commit 5f26380
Show file tree
Hide file tree
Showing 36 changed files with 383 additions and 384 deletions.
File renamed without changes
8 changes: 4 additions & 4 deletions Assets/js/triggerdialog.js → Assets/js/printmailing.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mautic.triggerdialogOnLoad = function (container) {
Mautic.printmailingOnLoad = function (container) {
var prefix = 'trigger_campaign';
var parent = mQuery('.dynamic-content-variable, .dwc-variable');
if (parent.length) {
Expand All @@ -8,7 +8,7 @@ Mautic.triggerdialogOnLoad = function (container) {
if (mQuery('#' + prefix + '_variables').length) {
mQuery('#available_variables').on('change', function () {
if (mQuery(this).val()) {
Mautic.addTriggerDialogVariable(mQuery(this).val(), mQuery('option:selected', this).data('field-object'));
Mautic.addPrintmailingVariable(mQuery(this).val(), mQuery('option:selected', this).data('field-object'));
mQuery(this).val('');
mQuery(this).trigger('chosen:updated');
}
Expand Down Expand Up @@ -111,7 +111,7 @@ Mautic.reorderTriggerCampaignVariables = function () {
mQuery('#' + prefix + '_variables .panel-heading').first().addClass('hide');
};

Mautic.addTriggerDialogVariable = function (elId, elObj) {
Mautic.addPrintmailingVariable = function (elId, elObj) {
var variableId = '#available_' + elObj + '_' + elId,
variableOption = mQuery(variableId),
label = variableOption.text(),
Expand Down Expand Up @@ -169,4 +169,4 @@ Mautic.addTriggerDialogVariable = function (elId, elObj) {

var variable = mQuery('#' + variableIdBase + 'variable');
variable.attr('type', fieldType);
};
};
70 changes: 35 additions & 35 deletions Config/config.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?php

use MauticPlugin\MauticTriggerdialogBundle\EventListener\CampaignSubscriber;
use MauticPlugin\MauticTriggerdialogBundle\EventListener\ConfigSubscriber;
use MauticPlugin\MauticTriggerdialogBundle\Form\Type\ActionType;
use MauticPlugin\MauticTriggerdialogBundle\Form\Type\ConfigType;
use MauticPlugin\MauticTriggerdialogBundle\Form\Type\TriggerCampaignType;
use MauticPlugin\MauticTriggerdialogBundle\Form\Type\VariableType;
use MauticPlugin\MauticTriggerdialogBundle\Generator\ClientIdGenerator;
use MauticPlugin\MauticTriggerdialogBundle\Integration\TriggerdialogIntegration;
use MauticPlugin\MauticTriggerdialogBundle\Model\TriggerCampaignModel;
use MauticPlugin\MauticTriggerdialogBundle\Utility\SingleSignOnUtility;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\EventListener\CampaignSubscriber;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\EventListener\ConfigSubscriber;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Form\Type\ActionType;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Form\Type\ConfigType;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Form\Type\TriggerCampaignType;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Form\Type\VariableType;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Generator\ClientIdGenerator;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Integration\PrintmailingIntegration;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Model\TriggerCampaignModel;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Utility\SingleSignOnUtility;

return [
'name' => 'Print Mailing DPAG Integration by Leuchtfeuer',
'description' => 'Send postcards or letters via Print Mailing',
'version' => '4.2.2',
'version' => '5.0.0',
'author' => 'Leuchtfeuer Digital Marketing GmbH',

'menu' => [
'main' => [
'plugin.triggerdialog.menu.index' => [
'route' => 'mautic_triggerdialog_index',
'plugin.printmailing.menu.index' => [
'route' => 'mautic_printmailing_index',
'parent' => 'mautic.core.channels',
'access' => [
'triggerdialog:campaigns:view',
'printmailing:campaigns:view',
],
'checks' => [
'integration' => [
'Triggerdialog' => [
'Printmailing' => [
'enabled' => true,
],
],
Expand All @@ -39,21 +39,21 @@

'routes' => [
'main' => [
'mautic_triggerdialog_index' => [
'mautic_printmailing_index' => [
'path' => '/triggertemplates/{page}',
'controller' => 'MauticTriggerdialogBundle:TriggerCampaign:index',
'controller' => 'LeuchtfeuerPrintmailingBundle:TriggerCampaign:index',
],
'mautic_triggerdialog_action' => [
'mautic_printmailing_action' => [
'path' => '/triggertemplates/{objectAction}/{objectId}',
'controller' => 'MauticTriggerdialogBundle:TriggerCampaign:execute',
'controller' => 'LeuchtfeuerPrintmailingBundle:TriggerCampaign:execute',
],
],
],

'services' => [
'integrations' => [
'mautic.integration.triggerdialog' => [
'class' => TriggerdialogIntegration::class,
'mautic.integration.printmailing' => [
'class' => PrintmailingIntegration::class,
'arguments' => [
'event_dispatcher',
'mautic.helper.cache_storage',
Expand All @@ -75,23 +75,23 @@
],
],
'events' => [
'mautic.triggerdialog.config.subscriber' => [
'mautic.printmailing.config.subscriber' => [
'class' => ConfigSubscriber::class,
],
'mautic.triggerdialog.campaign.subscriber' => [
'mautic.printmailing.campaign.subscriber' => [
'class' => CampaignSubscriber::class,
'arguments' => [
'mautic.helper.core_parameters',
'mautic.helper.ip_lookup',
'mautic.core.model.auditlog',
'mautic.triggerdialog.model.campaign',
'mautic.printmailing.model.campaign',
],
],
],
'forms' => [
'mautic.form.type.triggerdialogconfig' => [
'mautic.form.type.printmailingconfig' => [
'class' => ConfigType::class,
'alias' => 'triggerdialogconfig',
'alias' => 'printmailingconfig',
],
'mautic.form.type.trigger_campaign' => [
'class' => TriggerCampaignType::class,
Expand All @@ -109,17 +109,17 @@
'class' => ActionType::class,
'alias' => 'trigger_action',
'arguments' => [
'mautic.triggerdialog.model.campaign',
'mautic.printmailing.model.campaign',
],
],
],
'models' => [
'mautic.triggerdialog.model.campaign' => [
'mautic.printmailing.model.campaign' => [
'class' => TriggerCampaignModel::class,
],
],
'utilities' => [
'mautic.triggerdialog.utility.sso' => [
'mautic.printmailing.utility.sso' => [
'class' => SingleSignOnUtility::class,
'alias' => 'sso_utility',
'arguments' => [
Expand All @@ -131,11 +131,11 @@
],

'parameters' => [
'triggerdialog_masClientId' => ClientIdGenerator::generateClientId(),
'triggerdialog_masSecret' => null,
'triggerdialog_masId' => null,
'triggerdialog_rest_user' => null,
'triggerdialog_rest_password' => null,
'triggerdialog_contract_email' => '[email protected]',
'printmailing_masClientId' => ClientIdGenerator::generateClientId(),
'printmailing_masSecret' => null,
'printmailing_masId' => null,
'printmailing_rest_user' => null,
'printmailing_rest_password' => null,
'printmailing_contract_email' => '[email protected]',
],
];
58 changes: 29 additions & 29 deletions Controller/TriggerCampaignController.php
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
<?php

namespace MauticPlugin\MauticTriggerdialogBundle\Controller;
namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Controller;

use Doctrine\ORM\EntityNotFoundException;
use Mautic\CoreBundle\Controller\AbstractFormController;
use Mautic\CoreBundle\Helper\CoreParametersHelper;
use MauticPlugin\MauticTriggerdialogBundle\Entity\TriggerCampaign;
use MauticPlugin\MauticTriggerdialogBundle\Entity\TriggerCampaignRepository;
use MauticPlugin\MauticTriggerdialogBundle\Model\TriggerCampaignModel;
use MauticPlugin\MauticTriggerdialogBundle\Utility\SingleSignOnUtility;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Entity\TriggerCampaign;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Entity\TriggerCampaignRepository;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Model\TriggerCampaignModel;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Utility\SingleSignOnUtility;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

class TriggerCampaignController extends AbstractFormController
{
public const PERMISSIONS = [
'create' => 'triggerdialog:campaigns:create',
'delete' => 'triggerdialog:campaigns:delete',
'edit' => 'triggerdialog:campaigns:edit',
'publish' => 'triggerdialog:campaigns:publish',
'view' => 'triggerdialog:campaigns:view',
'create' => 'printmailing:campaigns:create',
'delete' => 'printmailing:campaigns:delete',
'edit' => 'printmailing:campaigns:edit',
'publish' => 'printmailing:campaigns:publish',
'view' => 'printmailing:campaigns:view',
];

public const ROUTES = [
'action' => 'mautic_triggerdialog_action',
'index' => 'mautic_triggerdialog_index',
'action' => 'mautic_printmailing_action',
'index' => 'mautic_printmailing_index',
];

public const SESSION_VARS = [
'limit' => 'plugin.triggerdialog.limit',
'orderBy' => 'plugin.triggerdialog.orderby',
'orderByDir' => 'plugin.triggerdialog.orderbydir',
'page' => 'plugin.triggerdialog.page',
'search' => 'plugin.triggerdialog.search',
'limit' => 'plugin.printmailing.limit',
'orderBy' => 'plugin.printmailing.orderby',
'orderByDir' => 'plugin.printmailing.orderbydir',
'page' => 'plugin.printmailing.page',
'search' => 'plugin.printmailing.search',
];

public const THEMES = [
'variables' => 'MauticTriggerdialogBundle:FormTheme\Variables',
'variables' => 'LeuchtfeuerPrintmailingBundle:FormTheme\Variables',
];

public const TEMPLATES = [
'form' => 'MauticTriggerdialogBundle:TriggerCampaign:form.html.php',
'index' => 'MauticTriggerdialogBundle:TriggerCampaign:index',
'list' => 'MauticTriggerdialogBundle:TriggerCampaign:list.html.php',
'form' => 'LeuchtfeuerPrintmailingBundle:TriggerCampaign:form.html.php',
'index' => 'LeuchtfeuerPrintmailingBundle:TriggerCampaign:index',
'list' => 'LeuchtfeuerPrintmailingBundle:TriggerCampaign:list.html.php',
];

public const ACTIVE_LINK = '#mautic_triggerdialog_index';
public const ACTIVE_LINK = '#mautic_printmailing_index';

public const MAUTIC_CONTENT = 'triggerdialog';
public const MAUTIC_CONTENT = 'printmailing';

protected $session;

Expand Down Expand Up @@ -213,7 +213,7 @@ public function editAction($objectId, $ignorePost = false, $clone = false)
'flashes' => [
[
'type' => 'error',
'msg' => 'plugin.triggerdialog.campaign.error.notfound',
'msg' => 'plugin.printmailing.campaign.error.notfound',
'msgVars' => ['%id%' => $objectId],
],
],
Expand Down Expand Up @@ -301,11 +301,11 @@ protected function getPermissions()
*/
protected function checkConfiguration(CoreParametersHelper $coreParametersHelper)
{
if (!$coreParametersHelper->has('triggerdialog_rest_user') || empty($coreParametersHelper->get('triggerdialog_rest_user'))) {
if (!$coreParametersHelper->has('printmailing_rest_user') || empty($coreParametersHelper->get('printmailing_rest_user'))) {
return false;
}

if (!$coreParametersHelper->has('triggerdialog_rest_password') || empty($coreParametersHelper->get('triggerdialog_rest_password'))) {
if (!$coreParametersHelper->has('printmailing_rest_password') || empty($coreParametersHelper->get('printmailing_rest_password'))) {
return false;
}

Expand Down Expand Up @@ -597,7 +597,7 @@ protected function deleteMultipleCampaigns($postActionVars, &$flashes)
if (null === $triggerCampaign) {
$flashes[] = [
'type' => 'error',
'msg' => 'plugin.triggerdialog.campaign.error.notfound',
'msg' => 'plugin.printmailing.campaign.error.notfound',
'msgVars' => ['%id%' => $triggerCampaignId],
];
} elseif (!$this->get('mautic.security')->hasEntityAccess(true, self::PERMISSIONS['delete'], $triggerCampaign->getCreatedBy())) {
Expand All @@ -615,7 +615,7 @@ protected function deleteMultipleCampaigns($postActionVars, &$flashes)

$flashes[] = [
'type' => 'notice',
'msg' => 'plugin.triggerdialog.campaign.notice.batch_deleted',
'msg' => 'plugin.printmailing.campaign.notice.batch_deleted',
'msgVars' => [
'%count%' => count($triggerCampaigns),
],
Expand All @@ -639,7 +639,7 @@ protected function deleteSingleCampaign($objectId, $postActionVars, &$flashes)
if (null === $triggerCampaign) {
$flashes[] = [
'type' => 'error',
'msg' => 'plugin.triggerdialog.campaign.error.notfound',
'msg' => 'plugin.printmailing.campaign.error.notfound',
'msgVars' => ['%id%' => $objectId],
];
} elseif (!$this->get('mautic.security')->hasEntityAccess(true, self::PERMISSIONS['delete'], $triggerCampaign->getCreatedBy())) {
Expand Down
24 changes: 12 additions & 12 deletions Entity/TriggerCampaign.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php

namespace MauticPlugin\MauticTriggerdialogBundle\Entity;
namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Entity;

use Doctrine\ORM\Mapping\ClassMetadata;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\CoreBundle\Entity\FormEntity;
use MauticPlugin\MauticTriggerdialogBundle\Validator\AllowedCharacters;
use MauticPlugin\MauticTriggerdialogBundle\Validator\Variable;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Validator\AllowedCharacters;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Validator\Variable;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Mapping\ClassMetadata as SymfonyClassMetadata;

class TriggerCampaign extends FormEntity
{
public const ALLOWED_TYPES = [
'string' => 'plugin.triggerdialog.form.types.string',
'integer' => 'plugin.triggerdialog.form.types.integer',
'boolean' => 'plugin.triggerdialog.form.types.boolean',
'date' => 'plugin.triggerdialog.form.types.date',
'image' => 'plugin.triggerdialog.form.types.image',
'imageurl' => 'plugin.triggerdialog.form.types.imageurl',
'float' => 'plugin.triggerdialog.form.types.float',
'zip' => 'plugin.triggerdialog.form.types.zip',
'countrycode' => 'plugin.triggerdialog.form.types.countrycode',
'string' => 'plugin.printmailing.form.types.string',
'integer' => 'plugin.printmailing.form.types.integer',
'boolean' => 'plugin.printmailing.form.types.boolean',
'date' => 'plugin.printmailing.form.types.date',
'image' => 'plugin.printmailing.form.types.image',
'imageurl' => 'plugin.printmailing.form.types.imageurl',
'float' => 'plugin.printmailing.form.types.float',
'zip' => 'plugin.printmailing.form.types.zip',
'countrycode' => 'plugin.printmailing.form.types.countrycode',
];

private $id;
Expand Down
2 changes: 1 addition & 1 deletion Entity/TriggerCampaignRepository.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace MauticPlugin\MauticTriggerdialogBundle\Entity;
namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Entity;

use Mautic\CoreBundle\Entity\CommonRepository;

Expand Down
4 changes: 2 additions & 2 deletions Event/TriggerCampaignEvent.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace MauticPlugin\MauticTriggerdialogBundle\Event;
namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Event;

use Mautic\CoreBundle\Event\CommonEvent;
use MauticPlugin\MauticTriggerdialogBundle\Entity\TriggerCampaign;
use MauticPlugin\LeuchtfeuerPrintmailingBundle\Entity\TriggerCampaign;

class TriggerCampaignEvent extends CommonEvent
{
Expand Down
Loading

0 comments on commit 5f26380

Please sign in to comment.