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

General Bug Fixes and Improvements

parent c3d01ac9
...@@ -11,13 +11,13 @@ Installation ...@@ -11,13 +11,13 @@ Installation
Either run Either run
```bash ```bash
composer require elitedivision/amos-report composer require arter/amos-report
``` ```
or add this row or add this row
``` ```
"elitedivision/amos-report": "dev-master" "arter/amos-report": "dev-master"
``` ```
to the require section of your `composer.json` file. to the require section of your `composer.json` file.
...@@ -28,11 +28,11 @@ to the require section of your `composer.json` file. ...@@ -28,11 +28,11 @@ to the require section of your `composer.json` file.
'modules' => [ 'modules' => [
'comments' => [ 'comments' => [
'class' => 'elitedivision\amos\report\AmosReport', 'class' => 'arter\amos\report\AmosReport',
'modelsEnabled' => [ 'modelsEnabled' => [
/** /**
* Add here the classnames of the models for whose you want to enable reports * Add here the classnames of the models for whose you want to enable reports
* (i.e. 'elitedivision\amos\news\models\News') * (i.e. 'arter\amos\news\models\News')
*/ */
] ]
], ],
...@@ -44,7 +44,7 @@ to the require section of your `composer.json` file. ...@@ -44,7 +44,7 @@ to the require section of your `composer.json` file.
a. Add workflow to composer a. Add workflow to composer
``` ```
"elitedivision/amos-workflow": "dev-master" "arter/amos-workflow": "dev-master"
``` ```
b. check in config/main for 'workflow' in modules array, if present b. check in config/main for 'workflow' in modules array, if present
...@@ -63,7 +63,7 @@ to the require section of your `composer.json` file. ...@@ -63,7 +63,7 @@ to the require section of your `composer.json` file.
c. add workflow entry (config/main in modules array): c. add workflow entry (config/main in modules array):
```php ```php
'workflow' => [ 'workflow' => [
'class' => 'elitedivision\amos\workflow\AmosWorkflow', 'class' => 'arter\amos\workflow\AmosWorkflow',
], ],
``` ```
...@@ -85,7 +85,7 @@ to the require section of your `composer.json` file. ...@@ -85,7 +85,7 @@ to the require section of your `composer.json` file.
a. amos-report migrations a. amos-report migrations
```bash ```bash
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-report/src/migrations php yii migrate/up --migrationPath=@vendor/arter/amos-report/src/migrations
``` ```
or add this row to your migrations config in console: or add this row to your migrations config in console:
...@@ -95,7 +95,7 @@ to the require section of your `composer.json` file. ...@@ -95,7 +95,7 @@ to the require section of your `composer.json` file.
. .
. .
. .
'@vendor/elitedivision/amos-report/src/migrations', '@vendor/arter/amos-report/src/migrations',
. .
. .
. .
...@@ -104,7 +104,7 @@ to the require section of your `composer.json` file. ...@@ -104,7 +104,7 @@ to the require section of your `composer.json` file.
b. if workflow module is installed (see step 3), also add amos-workflow migrations: b. if workflow module is installed (see step 3), also add amos-workflow migrations:
```bash ```bash
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-workflow/src/migrations php yii migrate/up --migrationPath=@vendor/arter/amos-workflow/src/migrations
``` ```
or add this row to your migrations config in console: or add this row to your migrations config in console:
...@@ -113,7 +113,7 @@ to the require section of your `composer.json` file. ...@@ -113,7 +113,7 @@ to the require section of your `composer.json` file.
. .
. .
. .
'@vendor/elitedivision/amos-workflow/src/migrations', '@vendor/arter/amos-workflow/src/migrations',
. .
. .
. .
...@@ -124,10 +124,10 @@ Widgets ...@@ -124,10 +124,10 @@ Widgets
----------- -----------
Amos Report provides two Widgets: Amos Report provides two Widgets:
* **ReportWidget** *elitedivision\amos\report\widgets\ReportWidget* * **ReportWidget** *arter\amos\report\widgets\ReportWidget*
Draw a flag icon related to a model. On flag click, the system opens form to insert a new report on a modal popup. Draw a flag icon related to a model. On flag click, the system opens form to insert a new report on a modal popup.
* **TabReportsWidget** *elitedivision\amos\report\widgets\TabReportsWidget* * **TabReportsWidget** *arter\amos\report\widgets\TabReportsWidget*
Draw the Report tab in a model view/form, containing the list of reports a specif content. Draw the Report tab in a model view/form, containing the list of reports a specif content.
If a model has been enabled for reports, the tab is automatically injected in update phase (form) by AmosCore widget 'Tabs'. If a model has been enabled for reports, the tab is automatically injected in update phase (form) by AmosCore widget 'Tabs'.
......
{ {
"name": "elitedivision/amos-report", "name": "arter/amos-report",
"description": "Sistema AMOS per le segnalazioni", "description": "Sistema AMOS per le segnalazioni",
"keywords": ["amos", "yii2", "report"], "keywords": ["amos", "yii2", "report"],
"homepage": "http://www.elitedivision.it/", "homepage": "http://www.arter.it/",
"type": "component", "type": "component",
"license": "BSD-3-Clause", "proscription": "BSD-3-Clause",
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"2amigos/yii2-ckeditor-widget": "~1.0", "2amigos/yii2-ckeditor-widget": "~1.0",
"cornernote/yii2-workflow-manager": "*", "cornernote/yii2-workflow-manager": "*",
"elitedivision/amos-admin": "~2.0", "arter/amos-admin": "~2.0",
"elitedivision/amos-core": "^1.9.50", "arter/amos-core": "^1.9.50",
"elitedivision/amos-notify": "~1.4", "arter/amos-notify": "~1.4",
"raoul2000/yii2-workflow": "*", "raoul2000/yii2-workflow": "*",
"raoul2000/yii2-workflow-view": "*", "raoul2000/yii2-workflow-view": "*",
"yiidoc/yii2-redactor": "*" "yiidoc/yii2-redactor": "*"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"elitedivision\\amos\\report\\": "src" "arter\\amos\\report\\": "src"
} }
}, },
"require-dev": { "require-dev": {
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report * @package arter\amos\report
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\report; namespace arter\amos\report;
use elitedivision\amos\core\module\AmosModule; use arter\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface; use arter\amos\core\module\ModuleInterface;
use elitedivision\amos\notificationmanager\models\Notification; use arter\amos\notificationmanager\models\Notification;
use elitedivision\amos\notificationmanager\models\NotificationsRead; use arter\amos\notificationmanager\models\NotificationsRead;
use elitedivision\amos\notificationmanager\models\NotificationChannels; use arter\amos\notificationmanager\models\NotificationChannels;
use elitedivision\amos\report\models\Report; use arter\amos\report\models\Report;
use Yii; use Yii;
use yii\db\ActiveQuery; use yii\db\ActiveQuery;
/** /**
* Class AmosReport * Class AmosReport
* @package elitedivision\amos\report * @package arter\amos\report
*/ */
class AmosReport extends AmosModule implements ModuleInterface class AmosReport extends AmosModule implements ModuleInterface
{ {
...@@ -38,7 +34,7 @@ class AmosReport extends AmosModule implements ModuleInterface ...@@ -38,7 +34,7 @@ class AmosReport extends AmosModule implements ModuleInterface
*/ */
public $layout = 'main'; public $layout = 'main';
public $name = 'Report'; public $name = 'Report';
public $controllerNamespace = 'elitedivision\amos\report\controllers'; public $controllerNamespace = 'arter\amos\report\controllers';
/** /**
* @var array * @var array
...@@ -50,13 +46,13 @@ class AmosReport extends AmosModule implements ModuleInterface ...@@ -50,13 +46,13 @@ class AmosReport extends AmosModule implements ModuleInterface
* This is the html used to render the subject of the e-mail. * This is the html used to render the subject of the e-mail.
* @var string * @var string
*/ */
public $htmlMailSubject = '@vendor/elitedivision/amos-report/src/views/report/email/report_notification_subject'; public $htmlMailSubject = '@vendor/arter/amos-report/src/views/report/email/report_notification_subject';
/** /**
* This is the html used to render the message of the e-mail. * This is the html used to render the message of the e-mail.
* @var string * @var string
*/ */
public $htmlMailContent = '@vendor/elitedivision/amos-report/src/views/report/email/report_notification'; public $htmlMailContent = '@vendor/arter/amos-report/src/views/report/email/report_notification';
public static function getModuleName() public static function getModuleName()
{ {
...@@ -67,7 +63,7 @@ class AmosReport extends AmosModule implements ModuleInterface ...@@ -67,7 +63,7 @@ class AmosReport extends AmosModule implements ModuleInterface
{ {
parent::init(); parent::init();
\Yii::setAlias('@elitedivision/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers'); \Yii::setAlias('@arter/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers');
// 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.self::$CONFIG_FOLDER.DIRECTORY_SEPARATOR.'config.php')); Yii::configure($this, require(__DIR__.DIRECTORY_SEPARATOR.self::$CONFIG_FOLDER.DIRECTORY_SEPARATOR.'config.php'));
} }
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package amos-report * @package amos-report
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
return []; return [];
\ No newline at end of file
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\news\controllers * @package arter\amos\news\controllers
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\report\controllers; namespace arter\amos\report\controllers;
use elitedivision\amos\dashboard\controllers\base\DashboardController; use arter\amos\dashboard\controllers\base\DashboardController;
use yii\helpers\Url; use yii\helpers\Url;
class DefaultController extends DashboardController class DefaultController extends DashboardController
...@@ -61,7 +57,7 @@ class DefaultController extends DashboardController ...@@ -61,7 +57,7 @@ class DefaultController extends DashboardController
} }
$module = \Yii::$app->getModule('layout'); $module = \Yii::$app->getModule('layout');
if(empty($module)){ if(empty($module)){
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout); $this->layout = '@vendor/arter/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
return true; return true;
} }
$this->layout = (!empty($layout)) ? $layout : $this->layout; $this->layout = (!empty($layout)) ? $layout : $this->layout;
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report\controllers * @package arter\amos\report\controllers
* @category Controller * @category Controller
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\report\controllers; namespace arter\amos\report\controllers;
use elitedivision\amos\core\controllers\CrudController; use arter\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\Html; use arter\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons; use arter\amos\core\icons\AmosIcons;
use elitedivision\amos\core\user\User; use arter\amos\core\user\User;
use elitedivision\amos\core\utilities\Email; use arter\amos\core\utilities\Email;
use elitedivision\amos\notificationmanager\models\NotificationsRead; use arter\amos\notificationmanager\models\NotificationsRead;
use elitedivision\amos\report\AmosReport; use arter\amos\report\AmosReport;
use elitedivision\amos\report\models\Report; use arter\amos\report\models\Report;
use elitedivision\amos\report\models\search\ReportSearch; use arter\amos\report\models\search\ReportSearch;
use Yii; use Yii;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
...@@ -32,7 +28,7 @@ use yii\helpers\Url; ...@@ -32,7 +28,7 @@ use yii\helpers\Url;
/** /**
* Class ReportController * Class ReportController
* @package elitedivision\amos\report\controllers * @package arter\amos\report\controllers
*/ */
class ReportController extends CrudController class ReportController extends CrudController
{ {
...@@ -148,7 +144,7 @@ class ReportController extends CrudController ...@@ -148,7 +144,7 @@ class ReportController extends CrudController
$read_by = \Yii::$app->user->id; $read_by = \Yii::$app->user->id;
$ok = true; $ok = true;
if (!empty($post['notification_id'])) { if (!empty($post['notification_id'])) {
$notificationRead = new \elitedivision\amos\notificationmanager\models\NotificationsRead(); $notificationRead = new \arter\amos\notificationmanager\models\NotificationsRead();
$notificationRead->user_id = $read_by; $notificationRead->user_id = $read_by;
$notificationRead->notification_id = $post['notification_id']; $notificationRead->notification_id = $post['notification_id'];
$ok = $notificationRead->save(false); $ok = $notificationRead->save(false);
...@@ -176,7 +172,7 @@ class ReportController extends CrudController ...@@ -176,7 +172,7 @@ class ReportController extends CrudController
$model = $this->findModel($id); $model = $this->findModel($id);
$read_by = \Yii::$app->user->id; $read_by = \Yii::$app->user->id;
$ok = true; $ok = true;
$notification = \elitedivision\amos\notificationmanager\models\Notification::findOne([ $notification = \arter\amos\notificationmanager\models\Notification::findOne([
'class_name' => Report::className(), 'class_name' => Report::className(),
'content_id' => $model->id, 'content_id' => $model->id,
]); ]);
...@@ -214,7 +210,7 @@ class ReportController extends CrudController ...@@ -214,7 +210,7 @@ class ReportController extends CrudController
} }
/** /**
* Set a view param used in \elitedivision\amos\core\forms\CreateNewButtonWidget * Set a view param used in \arter\amos\core\forms\CreateNewButtonWidget
*/ */
private function setCreateNewBtnLabel() private function setCreateNewBtnLabel()
{ {
...@@ -322,7 +318,7 @@ class ReportController extends CrudController ...@@ -322,7 +318,7 @@ class ReportController extends CrudController
} }
else { else {
$contentView = "@vendor/elitedivision/amos-report/src/views/report/email/report_notification"; $contentView = "@vendor/arter/amos-report/src/views/report/email/report_notification";
$contentViewSubject = $contentView . "_subject"; $contentViewSubject = $contentView . "_subject";
} }
...@@ -355,7 +351,7 @@ class ReportController extends CrudController ...@@ -355,7 +351,7 @@ class ReportController extends CrudController
*/ */
public function sendMail($from, $tos, $subject, $text, $files = [], $bcc = []) public function sendMail($from, $tos, $subject, $text, $files = [], $bcc = [])
{ {
/** @var \elitedivision\amos\emailmanager\AmosEmail $mailModule */ /** @var \arter\amos\emailmanager\AmosEmail $mailModule */
$mailModule = Yii::$app->getModule("email"); $mailModule = Yii::$app->getModule("email");
if (isset($mailModule)) { if (isset($mailModule)) {
if (is_null($from)) { if (is_null($from)) {
...@@ -382,7 +378,7 @@ class ReportController extends CrudController ...@@ -382,7 +378,7 @@ class ReportController extends CrudController
} }
$module = \Yii::$app->getModule('layout'); $module = \Yii::$app->getModule('layout');
if (empty($module)) { if (empty($module)) {
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout); $this->layout = '@vendor/arter/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
return true; return true;
} }
$this->layout = (!empty($layout)) ? $layout : $this->layout; $this->layout = (!empty($layout)) ? $layout : $this->layout;
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report\i18n\en-GB * @package arter\amos\report\i18n\en-GB
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
return [ return [
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report\i18n\en-US * @package arter\amos\report\i18n\en-US
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
return [ return [
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report\i18n\it-IT * @package arter\amos\report\i18n\it-IT
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
return [ return [
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * Arter
* *
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package elitedivision\amos\report\migrations * @package arter\amos\report\migrations
* @category Migration * @category Migration
* @author Lombardia Informatica S.p.A.
*/ */
use elitedivision\amos\core\migration\AmosMigrationTableCreation; use arter\amos\core\migration\AmosMigrationTableCreation;
/** /**
* Handles the creation of table `report`. * Handles the creation of table `report`.
......