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",
"keywords": [
"amos",
"notifiche",
"yii2"
],
"homepage": "http://www.arter.it/",
"homepage": "http://www.elitedivision.it/",
"type": "component",
"license": "BSD-3-Clause",
"support": {
......@@ -18,10 +18,10 @@
},
"require": {
"php": ">=7.0",
"arter/amos-admin": "^2.2.0",
"arter/amos-core": "^1.19.0",
"arter/amos-email-manager": "^1.1.19",
"arter/amos-workflow": "^1.0"
"elitedivision/amos-admin": "^2.2.0",
"elitedivision/amos-core": "^1.19.0",
"elitedivision/amos-email-manager": "^1.1.19",
"elitedivision/amos-workflow": "^1.0"
},
"config": {
"process-timeout": 1800,
......@@ -29,10 +29,10 @@
},
"autoload": {
"psr-4": {
"arter\\amos\\notificationmanager\\": "src"
"elitedivision\\amos\\notificationmanager\\": "src"
}
},
"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
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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.
......@@ -50,14 +50,14 @@ namespace arter\amos\notificationmanager;
* CHANNEL_ALL -- Tutti i Canali
*/
use arter\amos\core\module\AmosModule;
use arter\amos\core\record\Record;
use arter\amos\notificationmanager\base\NotifierRepository;
use arter\amos\notificationmanager\base\NotifyWidget;
use arter\amos\notificationmanager\listeners\NotifyWorkflowListener;
use arter\amos\notificationmanager\models\NotificationChannels;
use arter\amos\notificationmanager\models\NotificationsConfOpt;
use arter\amos\notificationmanager\utility\NotifyUtility;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\record\Record;
use elitedivision\amos\notificationmanager\base\NotifierRepository;
use elitedivision\amos\notificationmanager\base\NotifyWidget;
use elitedivision\amos\notificationmanager\listeners\NotifyWorkflowListener;
use elitedivision\amos\notificationmanager\models\NotificationChannels;
use elitedivision\amos\notificationmanager\models\NotificationsConfOpt;
use elitedivision\amos\notificationmanager\utility\NotifyUtility;
use raoul2000\workflow\base\SimpleWorkflowBehavior;
use Yii;
use yii\base\Event;
......@@ -66,7 +66,7 @@ use yii\log\Logger;
/**
* Class AmosNotify
* @package arter\amos\notificationmanager
* @package elitedivision\amos\notificationmanager
*/
class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, NotifyWidget
{
......@@ -81,11 +81,11 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
];
public $orderEmailSummary = [
'arter\amos\events\models\Event',
'arter\amos\news\models\News',
'arter\amos\partnershipprofiles\models\PartnershipProfile',
'arter\amos\discussioni\models\DiscussioniTopic',
'arter\amos\sondaggi\models\Sondaggi',
'elitedivision\amos\events\models\Event',
'elitedivision\amos\news\models\News',
'elitedivision\amos\partnershipprofiles\models\PartnershipProfile',
'elitedivision\amos\discussioni\models\DiscussioniTopic',
'elitedivision\amos\sondaggi\models\Sondaggi',
];
/** @var bool */
......@@ -99,7 +99,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/**
* @var array
* $personalizedValidatedEmail => [
* "arter\amos\admin\models\UserProfile" => [
* "elitedivision\amos\admin\models\UserProfile" => [
'class' => 'backend\modules\poiadmin\utility\PoiAdminEmailUtility',
'method' => 'sendEmailUserValidated'
]
......@@ -110,8 +110,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/**
* @var null |string
* [
* 'arter\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validator_user_profile',
* 'arter\amos\news\models\News' => '@common/mail/notify_validation/validator_news',
* 'elitedivision\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validator_user_profile',
* 'elitedivision\amos\news\models\News' => '@common/mail/notify_validation/validator_news',
* ]
*
*/
......@@ -120,8 +120,8 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/**
* @var null |string
* [
* 'arter\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validated_user_profile',
* 'arter\amos\news\models\News' => '@common/mail/notify_validation/validated_news',
* 'elitedivision\amos\admin\models\UserProfile' => '@common/mail/notify_validation/validated_user_profile',
* 'elitedivision\amos\news\models\News' => '@common/mail/notify_validation/validated_news',
* ]
*/
public $viewPathEmailNotifyValidated = [];
......@@ -157,8 +157,25 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
/**
* @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
*/
......@@ -194,7 +211,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
if (isset(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
\Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'));
$this->orderEmailSummary = array_unique($this->orderEmailSummary);
......@@ -206,7 +223,7 @@ class AmosNotify extends AmosModule implements \yii\base\BootstrapInterface, Not
public function bootstrap($app)
{
if ($app instanceof \yii\console\Application) {
$this->controllerNamespace = 'arter\amos\notificationmanager\commands';
$this->controllerNamespace = 'elitedivision\amos\notificationmanager\commands';
} else {
if (self::$registerEvent == false) {
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
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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;
/**
* Class NotifyAsset
* @package arter\amos\notificationmanager\assets
* @package elitedivision\amos\notificationmanager\assets
*/
class NotifyAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@vendor/arter/amos-notify/src/assets/web';
public $sourcePath = '@vendor/elitedivision/amos-notify/src/assets/web';
/**
* @inheritdoc
......@@ -55,9 +55,9 @@ class NotifyAsset extends AssetBundle
{
$moduleL = \Yii::$app->getModule('layout');
if (!is_null($moduleL)) {
$this->depends [] = 'arter\amos\layout\assets\BaseAsset';
$this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
} else {
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset';
$this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
}
parent::init();
}
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/arter/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/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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
* @package arter\amos\notificationmanager\base
* @package elitedivision\amos\notificationmanager\base
*/
interface Builder
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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 arter\amos\notificationmanager\base\builder\ContentImmediateMailBuilder;
use arter\amos\notificationmanager\base\builder\ContentMailBuilder;
use arter\amos\notificationmanager\base\builder\CustomMailBuilder;
use arter\amos\notificationmanager\base\builder\NewsletterBuilder;
use arter\amos\notificationmanager\base\builder\SleepingUserMailBuilder;
use arter\amos\notificationmanager\base\builder\SuccessfulContentMailBuilder;
use arter\amos\notificationmanager\base\builder\SuccessfulUserMailBuilder;
use arter\amos\notificationmanager\base\builder\SuggestedLinkMailBuilder;
use arter\amos\notificationmanager\base\builder\ValidatedMailBuilder;
use arter\amos\notificationmanager\base\builder\ValidatorsMailBuilder;
use arter\amos\notificationmanager\models\ChangeStatusEmail;
use elitedivision\amos\notificationmanager\base\builder\ContactAcceptedMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\ContentImmediateMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\ContentMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\CustomMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\NewsletterBuilder;
use elitedivision\amos\notificationmanager\base\builder\SleepingUserMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\SuccessfulContentMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\SuccessfulUserMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\SuggestedLinkMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\ValidatedMailBuilder;
use elitedivision\amos\notificationmanager\base\builder\ValidatorsMailBuilder;
use elitedivision\amos\notificationmanager\models\ChangeStatusEmail;
use yii\base\BaseObject;
/**
* Class BuilderFactory
* @package arter\amos\notificationmanager\base
* @package elitedivision\amos\notificationmanager\base
*/
class BuilderFactory extends BaseObject
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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 arter\amos\core\user\AmosUser;
use arter\amos\notificationmanager\AmosNotify;
use arter\amos\notificationmanager\models\Notification;
use arter\amos\notificationmanager\models\NotificationChannels;
use arter\amos\notificationmanager\models\NotificationsRead;
use elitedivision\amos\core\record\Record;
use elitedivision\amos\core\user\AmosUser;
use elitedivision\amos\notificationmanager\AmosNotify;
use elitedivision\amos\notificationmanager\models\Notification;
use elitedivision\amos\notificationmanager\models\NotificationChannels;
use elitedivision\amos\notificationmanager\models\NotificationsRead;
use Yii;
use yii\db\ActiveQuery;
......@@ -32,7 +32,7 @@ use yii\log\Logger;
/**
* Class NotifierRepository
* @package arter\amos\notificationmanager\base
* @package elitedivision\amos\notificationmanager\base
*/
class NotifierRepository
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
......@@ -10,10 +9,10 @@
*
* @package piattaforma-openinnovation
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\notificationmanager\base;
namespace elitedivision\amos\notificationmanager\base;
interface NotifyWidget
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
......@@ -10,10 +9,10 @@
*
* @package piattaforma-openinnovation
* @category CategoryName
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\notificationmanager\base;
namespace elitedivision\amos\notificationmanager\base;
class NotifyWidgetDoNothing implements NotifyWidget
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\notificationmanager\base\builder;
namespace elitedivision\amos\notificationmanager\base\builder;
use arter\amos\core\user\User;
use arter\amos\core\utilities\Email;
use arter\amos\notificationmanager\AmosNotify;
use arter\amos\emailmanager\AmosEmail;
use arter\amos\notificationmanager\base\Builder;
use arter\amos\notificationmanager\models\NotificationConf;
use elitedivision\amos\core\user\User;
use elitedivision\amos\core\utilities\Email;
use elitedivision\amos\notificationmanager\AmosNotify;
use elitedivision\amos\emailmanager\AmosEmail;
use elitedivision\amos\notificationmanager\base\Builder;
use elitedivision\amos\notificationmanager\models\NotificationConf;
use Yii;
use yii\base\BaseObject;
use yii\helpers\Console;
/**
* Class AMailBuilder
* @package arter\amos\notificationmanager\base\builder
* @package elitedivision\amos\notificationmanager\base\builder
*/
abstract class AMailBuilder extends BaseObject implements Builder
{
......@@ -248,7 +248,7 @@ abstract class AMailBuilder extends BaseObject implements Builder
{
$module = \Yii::$app->getModule('translation');
if ($module && !empty($module->enableUserLanguage) && $module->enableUserLanguage == true) {
/** @var \arter\amos\translation\AmosTranslation $module */
/** @var \elitedivision\amos\translation\AmosTranslation $module */
$lang = $module->getUserLanguage($userId);
$module->setAppLanguage($lang);
}
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.