Commit a3eadfa8 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent 8713b7c0
{ {
"name": "arter/amos-notify", "name": "elitedivision/amos-notify",
"description": "Modulo di gestione notifiche - plugin", "description": "Modulo di gestione notifiche - plugin",
"keywords": [ "keywords": [
"amos", "amos",
"notifiche", "notifiche",
"yii2" "yii2"
], ],
"homepage": "http://www.arter.it/", "homepage": "http://www.elitedivision.it/",
"type": "component", "type": "component",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"support": { "support": {
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
}, },
"require": { "require": {
"php": ">=7.0", "php": ">=7.0",
"arter/amos-admin": "^2.2.0", "elitedivision/amos-admin": "^2.2.0",
"arter/amos-core": "^1.19.0", "elitedivision/amos-core": "^1.19.0",
"arter/amos-email-manager": "^1.1.19", "elitedivision/amos-email-manager": "^1.1.19",
"arter/amos-workflow": "^1.0" "elitedivision/amos-workflow": "^1.0"
}, },
"config": { "config": {
"process-timeout": 1800, "process-timeout": 1800,
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"arter\\amos\\notificationmanager\\": "src" "elitedivision\\amos\\notificationmanager\\": "src"
} }
}, },
"scripts": { "scripts": {
"post-install-cmd": "php yii migrate --migrationPath=@vendor/arter/amos-notify/migrations --interactive=0" "post-install-cmd": "php yii migrate --migrationPath=@vendor/elitedivision/amos-notify/migrations --interactive=0"
} }
} }
#!/bin/bash
#First Mail Batch
php yii notify/notifier/mail-channel --dayMails
while [ $? -eq 0 ]; do
echo "WAIT 10 SECS"
sleep 10
# Limit while cycle
((c++)) && ((c==100)) && break
# Send Mails In Loop
php yii notify/notifier/mail-channel --dayMails
done
\ No newline at end of file
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\notify * @package elitedivision\amos\notify
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\notificationmanager; namespace elitedivision\amos\notificationmanager;
/** /**
* Plugin per la gestione delle notifiche. * Plugin per la gestione delle notifiche.
...@@ -50,14 +50,14 @@ namespace arter\amos\notificationmanager; ...@@ -50,14 +50,14 @@ namespace arter\amos\notificationmanager;
* CHANNEL_ALL -- Tutti i Canali * CHANNEL_ALL -- Tutti i Canali
*/ */
use arter\amos\core\module\AmosModule; use elitedivision\amos\core\module\AmosModule;
use arter\amos\core\record\Record; use elitedivision\amos\core\record\Record;
use arter\amos\notificationmanager\base\NotifierRepository; use elitedivision\amos\notificationmanager\base\NotifierRepository;
use arter\amos\notificationmanager\base\NotifyWidget; use elitedivision\amos\notificationmanager\base\NotifyWidget;
use arter\amos\notificationmanager\listeners\NotifyWorkflowListener; use elitedivision\amos\notificationmanager\listeners\NotifyWorkflowListener;
use arter\amos\notificationmanager\models\NotificationChannels; use elitedivision\amos\notificationmanager\models\NotificationChannels;
use arter\amos\notificationmanager\models\NotificationsConfOpt; use elitedivision\amos\notificationmanager\models\NotificationsConfOpt;
use arter\amos\notificationmanager\utility\NotifyUtility; use elitedivision\amos\notificationmanager\utility\NotifyUtility;
use raoul2000\workflow\base\SimpleWorkflowBehavior; use raoul2000\workflow\base\SimpleWorkflowBehavior;
use Yii; use Yii;
use yii\base\Event; use yii\base\Event;
...@@ -66,7 +66,7 @@ use yii\log\Logger; ...@@ -66,7 +66,7 @@ use yii\log\Logger;
/** /**
* Class AmosNotify * Class AmosNotify
* @package arter\amos\notificationmanager * @package elitedivision\amos\notificationmanager
*/ */
class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, NotifyWidget class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, NotifyWidget
{ {
...@@ -81,11 +81,11 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -81,11 +81,11 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
]; ];
public $orderEmailSummary = [ public $orderEmailSummary = [
'arter\amos\events\models\Event', 'elitedivision\amos\events\models\Event',
'arter\amos\news\models\News', 'elitedivision\amos\news\models\News',
'arter\amos\partnershipprofiles\models\PartnershipProfile', 'elitedivision\amos\partnershipprofiles\models\PartnershipProfile',
'arter\amos\discussioni\models\DiscussioniTopic', 'elitedivision\amos\discussioni\models\DiscussioniTopic',
'arter\amos\sondaggi\models\Sondaggi', 'elitedivision\amos\sondaggi\models\Sondaggi',
]; ];
/** @var bool */ /** @var bool */
...@@ -99,7 +99,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -99,7 +99,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/** /**
* @var array * @var array
* $personalizedValidatedEmail => [ * $personalizedValidatedEmail => [
* "arter\amos\admin\models\UserProfile" => [ * "elitedivision\amos\admin\models\UserProfile" => [
'class' => 'backend\modules\poiadmin\utility\PoiAdminEmailUtility', 'class' => 'backend\modules\poiadmin\utility\PoiAdminEmailUtility',
'method' => 'sendEmailUserValidated' 'method' => 'sendEmailUserValidated'
] ]
...@@ -110,8 +110,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -110,8 +110,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/** /**
* @var null |string * @var null |string
* [ * [
* 'arter\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validator_user_profile', * 'elitedivision\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validator_user_profile',
* 'arter\amos\news\models\News' => '@common/mail/notify_validation/validator_news', * 'elitedivision\amos\news\models\News' => '@common/mail/notify_validation/validator_news',
* ] * ]
* *
*/ */
...@@ -120,8 +120,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -120,8 +120,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/** /**
* @var null |string * @var null |string
* [ * [
* 'arter\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validated_user_profile', * 'elitedivision\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validated_user_profile',
* 'arter\amos\news\models\News' => '@common/mail/notify_validation/validated_news', * 'elitedivision\amos\news\models\News' => '@common/mail/notify_validation/validated_news',
* ] * ]
*/ */
public $viewPathEmailNotifyValidated = []; public $viewPathEmailNotifyValidated = [];
...@@ -157,8 +157,25 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -157,8 +157,25 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $controllerNamespace = 'arter\amos\notificationmanager\controllers'; public $controllerNamespace = 'elitedivision\amos\notificationmanager\controllers';
/**
* If set to true it enables the sending of segmented notifications
* @var bool $enableSegmentedSend
*/
public $enableSegmentedSend = false;
/**
* Indicates for which types of notifications segmentation is used
* @var array $segmentationEnabledFor
*/
public $segmentationEnabledFor = [2];
/**
* Set the number of emails for each segment
* @var int $baseOffset
*/
public $segmentationOffset = 3000;
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -194,7 +211,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -194,7 +211,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
if (isset(Yii::$app->params['layoutMailConfigurations']['textContrastBgPrimaryDark'])) { if (isset(Yii::$app->params['layoutMailConfigurations']['textContrastBgPrimaryDark'])) {
$this->mailThemeColor['textContrastBgPrimaryDark'] = Yii::$app->params['layoutMailConfigurations']['textContrastBgPrimaryDark']; $this->mailThemeColor['textContrastBgPrimaryDark'] = Yii::$app->params['layoutMailConfigurations']['textContrastBgPrimaryDark'];
} }
\Yii::setAlias('@arter/amos/notificationmanager/commands', __DIR__ . '/commands/'); \Yii::setAlias('@elitedivision/amos/notificationmanager/commands', __DIR__ . '/commands/');
// initialize the module with the configuration loaded from config.php // initialize the module with the configuration loaded from config.php
\Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php')); \Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'));
$this->orderEmailSummary = array_unique($this->orderEmailSummary); $this->orderEmailSummary = array_unique($this->orderEmailSummary);
...@@ -206,7 +223,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not ...@@ -206,7 +223,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
public function bootstrap($app) public function bootstrap($app)
{ {
if ($app instanceof \yii\console\Application) { if ($app instanceof \yii\console\Application) {
$this->controllerNamespace = 'arter\amos\notificationmanager\commands'; $this->controllerNamespace = 'elitedivision\amos\notificationmanager\commands';
} else { } else {
if (self::$registerEvent == false) { if (self::$registerEvent == false) {
self::$registerEvent = true; self::$registerEvent = true;
......
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.8.0]
### Added
- Added the creation of newsletters, with relative dashboard plugin.
### Fix
- Bugfixes and refactors.
\ No newline at end of file
# Amos Notify
Notify management.
### Installation
You need to require this package and enable the module in your configuration.
add to composer requirements in composer.json
```
"elitedivision/amos-news": "dev-master",
```
or run command bash:
```bash
composer require "elitedivision/amos-news:dev-master"
```
Enable the Notify modules in common modules-amos.php, add :
```php
'notify' => [
'class' => 'elitedivision\amos\news\AmosNews',
],
```
add news migrations to console modules (console/config/migrations-amos.php):
```
'@vendor/elitedivision/amos-notify/src/migrations'
```
The content is suitable to be used with cwh content management.
To do so:
- Activate cwh plugin
- Open cwh configuration wizard (admin privilege is required) url: <yourPlatformurl>/cwh/configuration/wizard
- search for news in content configuration section
- edit configuration of news and save
If tags are needed enable this module in "modules-amos.php" (backend/config folder in main project) in tag section.
After that, enable the trees in tag manager.
If platform uses report and/or comments and you want to enable News to be commented/to report a content,
add the model to the configuration in modules-amos.php:
for reports:
```
'report' => [
'class' => 'elitedivision\amos\report\AmosReport',
'modelsEnabled' => [
.
.
'elitedivision\amos\news\models\News', //line to add
.
.
]
],
```
### Configure contents for notification summary
- You have to configure the model in cwh/configuration/wizard
- If you want to personalize the views of the contents in the notification email summary you have to put the module in /common/config/modules-amos
```
'news' => [
'class' => 'elitedivision\amos\news\AmosNews',
'viewPathEmailSummary' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary'
'viewPathEmailSummaryNetwork' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary_network'
]
],
```
* **viewPathEmailSummary** - view path for content in summary email
* **viewPathEmailSummaryNetwork** - view path for content the inside a network (COmmunity) in summary email
### Configurable fields
* **$orderEmailSummary** - array
-Is used to define their order in the email summury
```php
public $orderEmailSummary = [
'elitedivision\amos\events\models\Event',
'elitedivision\amos\news\models\News',
'elitedivision\amos\partnershipprofiles\models',
'elitedivision\amos\discussioni\models\DiscussioniTopic',
'elitedivision\amos\sondaggi\models\Sondaggi',
];
```
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\notificationmanager\base\builder * @package elitedivision\amos\notificationmanager\base\builder
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\notificationmanager\assets; namespace elitedivision\amos\notificationmanager\assets;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**
* Class NotifyAsset * Class NotifyAsset
* @package arter\amos\notificationmanager\assets * @package elitedivision\amos\notificationmanager\assets
*/ */
class NotifyAsset extends AssetBundle class NotifyAsset extends AssetBundle
{ {
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $sourcePath = '@vendor/arter/amos-notify/src/assets/web'; public $sourcePath = '@vendor/elitedivision/amos-notify/src/assets/web';
/** /**
* @inheritdoc * @inheritdoc
...@@ -55,9 +55,9 @@ class NotifyAsset extends AssetBundle ...@@ -55,9 +55,9 @@ class NotifyAsset extends AssetBundle
{ {
$moduleL = \Yii::$app->getModule('layout'); $moduleL = \Yii::$app->getModule('layout');
if (!is_null($moduleL)) { if (!is_null($moduleL)) {
$this->depends [] = 'arter\amos\layout\assets\BaseAsset'; $this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
} else { } else {
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset'; $this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
} }
parent::init(); parent::init();
} }
......
/** /**
IMPORT AMOS-LAYOUT VARIABLES IMPORT AMOS-LAYOUT VARIABLES
*/ */
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/variables.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/utility.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
/** /**
IMPORT STYLE-CUSTOM IMPORT STYLE-CUSTOM
*/ */
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\notificationmanager\base * @package elitedivision\amos\notificationmanager\base
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\notificationmanager\base; namespace elitedivision\amos\notificationmanager\base;
use arter\amos\core\user\User; use elitedivision\amos\core\user\User;
/** /**
* Interface Builder * Interface Builder
* @package arter\amos\notificationmanager\base * @package elitedivision\amos\notificationmanager\base
*/ */
interface Builder interface Builder
{ {
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\notificationmanager\base * @package elitedivision\amos\notificationmanager\base
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\notificationmanager\base; namespace elitedivision\amos\notificationmanager\base;
use arter\amos\notificationmanager\base\builder\ContactAcceptedMailBuilder; use elitedivision\amos\notificationmanager\base\builder\ContactAcceptedMailBuilder;
use arter\amos\notificationmanager\base\builder\ContentImmediateMailBuilder; use elitedivision\amos\notificationmanager\base\builder\ContentImmediateMailBuilder;
use arter\amos\notificationmanager\base\builder\ContentMailBuilder; use elitedivision\amos\notificationmanager\base\builder\ContentMailBuilder;
use arter\amos\notificationmanager\base\builder\CustomMailBuilder; use elitedivision\amos\notificationmanager\base\builder\CustomMailBuilder;
use arter\amos\notificationmanager\base\builder\NewsletterBuilder; use elitedivision\amos\notificationmanager\base\builder\NewsletterBuilder;
use arter\amos\notificationmanager\base\builder\SleepingUserMailBuilder; use elitedivision\amos\notificationmanager\base\builder\SleepingUserMailBuilder;
use arter\amos\notificationmanager\base\builder\SuccessfulContentMailBuilder; use elitedivision\amos\notificationmanager\base\builder\SuccessfulContentMailBuilder;
use arter\amos\notificationmanager\base\builder\SuccessfulUserMailBuilder; use elitedivision\amos\notificationmanager\base\builder\SuccessfulUserMailBuilder;
use arter\amos\notificationmanager\base\builder\SuggestedLinkMailBuilder; use elitedivision\amos\notificationmanager\base\builder\SuggestedLinkMailBuilder;
use arter\amos\notificationmanager\base\builder\ValidatedMailBuilder; use elitedivision\amos\notificationmanager\base\builder\ValidatedMailBuilder;
use arter\amos\notificationmanager\base\builder\ValidatorsMailBuilder; use elitedivision\amos\notificationmanager\base\builder\ValidatorsMailBuilder;
use arter\amos\notificationmanager\models\ChangeStatusEmail; use elitedivision\amos\notificationmanager\models\ChangeStatusEmail;
use yii\base\BaseObject; use yii\base\BaseObject;
/** /**
* Class BuilderFactory * Class BuilderFactory
* @package arter\amos\notificationmanager\base * @package elitedivision\amos\notificationmanager\base
*/ */
class BuilderFactory extends BaseObject class BuilderFactory extends BaseObject
{ {
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\notify * @package elitedivision\amos\notify
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\notificationmanager\base; namespace elitedivision\amos\notificationmanager\base;
use arter\amos\core\record\Record; use elitedivision\amos\core\record\Record;
use arter\amos\core\user\AmosUser; use elitedivision\amos\core\user\AmosUser;
use arter\amos\notificationmanager\AmosNotify; use elitedivision\amos\notificationmanager\AmosNotify;
use arter\amos\notificationmanager\models\Notification; use elitedivision\amos\notificationmanager\models\Notification;
use arter\amos\notificationmanager\models\NotificationChannels; use elitedivision\amos\notificationmanager\models\NotificationChannels;
use arter\amos\notificationmanager\models\NotificationsRead; use elitedivision\amos\notificationmanager\models\NotificationsRead;
use Yii; use Yii;
use yii\db\ActiveQuery; use yii\db\ActiveQuery;
...@@ -32,7 +32,7 @@ use yii\log\Logger; ...@@ -32,7 +32,7 @@ use yii\log\Logger;
/** /**
* Class NotifierRepository * Class NotifierRepository