Commit 5e16814b authored by Daniele Draganti's avatar Daniele Draganti
Browse files

First commit

parent 1a26e88c
Pipeline #228 failed with stages
in 0 seconds
First commit
# Een Partnership Proposal
Questo documento specifica in dettaglio lo script di importazione een
## Configure Tag
insert in backend/config/main
```php
if (isset($modules['een'])) {
$modules['tag']['modelsEnabled'][] = 'elitedivision\amos\een\models\EenPartnershipProposal';
}
```
and enable the technlogic tags on the plugin configuration tags
## Configure Comments
Insert in backend/config/modules-amos
```php
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'modelsEnabled' => [
'elitedivision\amos\een\models\EenExprOfInterest'
]
]
```
## Import EEN (Console command)
Lo script di importazione è in grado di gestire la risposta del WS soap, mappando tutti le proprietà ritornate per ogni proposta (profile) gestendono:
- Campi distintivi,
- Allegati,
- Keyword (tags);
Lo script una volta avviato scrive su un log (@console/runtime/een/call) questi dati:
- **Allegati** per ogni proposta (vengono poi spostati sull'amos-attachments)
- **Request XML** utile per poter replicare la chiamata con SaopUI
- **Response XML** utile per poter capire se i dati ritornati sono corretti
- **Tag Non trovati** visto che i tag delle EEN non sono interrogabili e non hanno un id univoco, ma un mero codice posizionale, vengono tracciati tutti i tag non trovati e salvati su una colonna *tags_not_found* sulla proposta
- **Output parlante** vengono indicate infomazioni parlanti, quali:
- Spiegazione della Request
- Info su allegati
- Info sui tags
- Info sulla proposta
> Si consiglia di eliminare il contenuto della cartella **@console/runtime/een/call** ogni X chiamate (oppure effettuare un rotate)
Inoltre
> Si consiglia di salvare l'output dello script all'interno di un file di log.
###Base route
Command | Note |
--- | --- |
yii amos-een/import/start | Importa le proposte di collaborazione |
###Options
Le options sono i parametri che il WDSL può gestire.
Option | Note | Esempio
--- | --- | --- |
--Username | Username | Già impostato nell'env |
--Password | Password | Già impostato nell'env |
--ContractId | Id contratto | Stringa: Mai utilizzato |
--CountriesForDissemination | Diffusa negli stati | Array: Mai utilizzato |
--DeadlineDateAfter | Scadenza dopo la data | Stringa: AAAAMMDD |
--DeadlineDateBefore | Scadenza prima la data | Stringa: AAAAMMDD |
--IncludeImages | Includere allegati | Boolean: 1/true |
--OrganisationCountryName | ? | |
--OrganisationIdentifier | ? | |
--OrganisationName | ? | |
--ProfileTypes | Tipologia di EEN |Array: Tr, To, Br, Bo, Rdr |
--PublishedDateAfter |Pubblicata dopo la data | Stringa: AAAAMMDD |
--PublishedDateBefore |Pubblicata prima la data | Stringa: AAAAMMDD |
--SubmitDateAfter |Inviata dopo la data | Stringa: AAAAMMDD |
--SubmitDateBefore |Inviata prima la data | Stringa: AAAAMMDD |
--UpdateDateAfter |Aggiornata dopo la data | Stringa: AAAAMMDD |
--UpdateDateBefore |Inviata prima la data | Stringa: AAAAMMDD |
###Esempi di chiamate
*Proposte di collaborazione EEN di tipo Tr con data di scadenza dopo il 2017-07-07(Compreso)*
php yii amos-een/import/start --DeadlineDateAfter="2017-07-07" --ProfileTypes="Tr"
*Proposte di collaborazione EEN di tipo Br aggiornate dopo il 2017-11-01 (Compreso) , con allegati*
php yii amos-een/import/start --UpdateDateAfter="2017-11-01" --ProfileTypes="Tr" --IncludeImages=1
*Proposte di collaborazione EEN di tipo Tr,To,Br,Bo,Rdr aggiornate dopo il 2017-11-01 (Compreso)*
php yii amos-een/import/start --UpdateDateAfter="2017-11-01" --ProfileTypes="Tr,To,Br,Bo,Rdr"
###Web Service
è possibile recuperare le proposte di collaborazione EEN tramite WS.
Per poter accedere al servizio è necessario:
- essere utente a sistema
- avere associato il permesso *EEN_ENABLE_READ_WS*
Il sistema di autenticazione è *BASIC AUTHENTICATION* perciò **username** e **password** saranno sempre presenti nella chiamata
ulteriore parametro necessario è **date** nel fomato *Y-m-d*
URL esempio
#DOMINIO#/een/api/get-een?date=2018-07-01
Saranno restituite tutte le proposte EEN la cui ***data di ultimo aggiornamento** cadrà nell'intervallo tra la **data ricevuta** tramite parametro *date* e **7 giorni** che lo precedono
{
"name": "elitedivision/amos-proposte-collaborazione-een",
"description": "Sistema AMOS per le proposte di collaborazione europee",
"keywords": ["amos", "yii2", "een"],
"homepage": "http://git.elitedivision.it/elitedivision/amos-proposte-collaborazione-een",
"type": "component",
"license": "BSD-3-Clause",
"support": {
"issues": "http://git.elitedivision.it/elitedivision/amos-proposte-collaborazione-een/issues",
"forum": "http://www.example.com/forum/",
"wiki": "http://git.elitedivision.it/elitedivision/amos-proposte-collaborazione-een/wikis/home",
"source": "http://git.elitedivision.it/elitedivision/amos-proposte-collaborazione-een/tree/master"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"elitedivision/amos-core":"^1.9.60",
"elitedivision/amos-dashboard":"^1.5",
"elitedivision/amos-notify": "^1.4.16"
},
"config": {
"process-timeout": 1800,
"secure-http": false
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"autoload": {
"psr-4": {
"elitedivision\\amos\\een\\": "src"
}
},
"require-dev": {
"yiisoft/yii2-faker": "*"
}
}
\ No newline at end of file
<?php
namespace elitedivision\amos\een;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface;
use yii\console\Application;
use yii\helpers\FileHelper;
use elitedivision\amos\core\interfaces\SearchModuleInterface;
/**
* Class AmosEen
* @package elitedivision\amos\een
*/
class AmosEen extends AmosModule implements ModuleInterface, SearchModuleInterface
{
const MAX_LAST_PARTNERSHIP_ON_DASHBOARD = 3;
/**
* @inheritdoc
*/
public $controllerNamespace = 'elitedivision\amos\een\controllers';
public $name = 'een';
public $wsdl = null; //'http://een.ec.europa.eu/tools/services/podv6/QueryService.svc?wsdl';
public $findAllAccessPoint = null; //'GetProfilesSOAP';
public $findAllAccessPointRequest = null;
public $mailToSendInterest = null;
/**
*
* @var array
*/
public $tagsEenEnabled = ['makets', 'tecnologies', 'naces'];
/**
*
* @var array
*/
public $book_ids = ['markets' => 1,
'tecnologies' => 16,
'naces' => 4];
/**
* Root id for the platform TAG
* @var integer
*/
public $root_id = 3;
/**
*
* @var type
*/
public $enableCreateEen = true;
/**
*
* @var boolean
*/
public $enableConversionTag = false;
/**
* @var array
*/
public $viewPathEmailContentSubtitle = [
'elitedivision\amos\een\models\EenPartnershipProposal' => '@vendor/elitedivision/amos-proposte-collaborazione-een/src/views/email/notify_email_content'
];
/**
* @var array
*/
public $viewPathEmailSummary = [
'elitedivision\amos\een\models\EenPartnershipProposal' => '@vendor/elitedivision/amos-proposte-collaborazione-een/src/views/email/notify_summary'
];
public $viewPathEmailSummaryNetwork = [];
/**
* @return string
*/
public static function getModuleName()
{
return 'een';
}
/**
* @inheritdoc
*/
public function init()
{
parent::init();
\Yii::setAlias('@elitedivision/amos/'.static::getModuleName().'/commands/controllers',
__DIR__.'/commands/controllers');
// custom initialization code goes here
\Yii::configure($this, require(__DIR__.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'));
if (\Yii::$app instanceof Application) {
$this->controllerNamespace = 'elitedivision\amos\een\commands\controllers';
if (!defined('LOG_DIR')) {
define('LOG_DIR',
\Yii::getAlias("@runtime").DIRECTORY_SEPARATOR."een".DIRECTORY_SEPARATOR."calls".DIRECTORY_SEPARATOR);
}
FileHelper::createDirectory(LOG_DIR, 0777);
}
}
/**
* @inheritdoc
*/
public function getWidgetGraphics()
{
return null;
}
/**
* @inheritdoc
*/
public function getWidgetIcons()
{
return [
\elitedivision\amos\een\widgets\icons\WidgetIconEenDashboard::className(),
\elitedivision\amos\een\widgets\icons\WidgetIconEen::className(),
\elitedivision\amos\een\widgets\icons\WidgetIconEenAll::className(),
\elitedivision\amos\een\widgets\icons\WidgetIconEenArchived::className()
];
}
/**
* @inheritdoc
*/
protected function getDefaultModels()
{
return [
'EenPartnershipProposal' => __NAMESPACE__.'\\'.'models\EenPartnershipProposal',
'EenExprOfInterest' => __NAMESPACE__.'\\'.'models\EenExprOfInterest',
'EenNetworkNode' => __NAMESPACE__.'\\'.'models\EenNetworkNode',
'EenStaff' => __NAMESPACE__.'\\'.'models\EenStaff',
'EenTagEen' => __NAMESPACE__.'\\'.'models\EenTagEen',
'EenTagS3TagEenMm' => __NAMESPACE__.'\\'.'models\EenTagS3TagEenMm',
'InfoReqModel' => __NAMESPACE__.'\\'.'models\InfoReqModel',
'ProposalForm' => __NAMESPACE__.'\\'.'models\ProposalForm',
'EenExprOfInterestHistory' => __NAMESPACE__.'\\'.'models\EenExprOfInterestHistory',
'EenExprOfInterestSearch' => __NAMESPACE__.'\\'.'models\search\EenExprOfInterestSearch',
'EenPartnershipProposalSearch' => __NAMESPACE__.'\\'.'models\search\EenPartnershipProposalSearch',
'EenTagEenSearch' => __NAMESPACE__.'\\'.'models\search\EenTagEenSearch',
'EenTagS3TagEenMmSearch' => __NAMESPACE__.'\\'.'models\search\EenTagS3TagEenMmSearch',
];
}
/**
* @inheritdoc
*/
public static function getModelSearchClassName()
{
return AmosEen::instance()->model('NewsSearch');
}
/**
* @inheritdoc
*/
public static function getModuleIconName()
{
return 'proposte-een';
}
}
\ No newline at end of file
# 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).
## [Unreleased]
POII-2287/#003055 fix prendi in carico da my activities
### Added
<?php
namespace elitedivision\amos\een\assets;
use yii\web\AssetBundle;
/**
* Class ProposteCollaborazioneEenAsset
* @package elitedivision\amos\een\assets
*/
class ProposteCollaborazioneEenAsset extends AssetBundle
{
public $sourcePath = '@vendor/elitedivision/amos-proposte-collaborazione-een/src/assets/web';
public $js = [
];
public $css = [
'less/proposte-een.less',
];
public $depends = [
];
public function init()
{
$moduleL = \Yii::$app->getModule('layout');
if(!empty($moduleL))
{ $this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset'; }
else
{ $this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset'; }
parent::init();
}
}
\ No newline at end of file
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
/**
IMPORT STYLE-CUSTOM
*/
@import (optional) "../../backend/web/less/style_custom.less";
/**
EEN EXPR OF INTEREST
*/
.een-expr-of-interest-index-own {
.grid-view .table_switch.table-responsive .table.table-striped thead tr {
@media (min-width: 992px) {
th:nth-child(2) { // table column: title
width: 400px;
}
th:nth-child(3) { // table column: status
min-width: 100px;
}
th:nth-child(5) { // table column: date
min-width: 150px;
}
}
}
}
.een-expr-of-interest-index-received {
.grid-view .table_switch.table-responsive .table.table-striped thead tr {
@media (min-width: 992px) {
th:nth-child(2) { // table column: title
width: 400px;
}
th:nth-child(3) { // table column: name
min-width: 100px;
}
th:nth-child(4) { // table column: status
min-width: 100px;
}
th:nth-child(6) { // table column: date
min-width: 150px;
}
}
}
}
\ No newline at end of file
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
/**
IMPORT STYLE-CUSTOM
*/
@import (optional) "../../backend/web/less/style_custom.less";
/**
EEN EXPR OF INTEREST
*/
.een-expr-of-interest-index-own {
.grid-view .table_switch.table-responsive .table.table-striped thead tr {
@media (min-width: 992px) {
th:nth-child(2) { // table column: title
width: 400px;
}
th:nth-child(3) { // table column: status
min-width: 100px;
}
th:nth-child(5) { // table column: date
min-width: 150px;
}
}
}
}
.een-expr-of-interest-index-received {
.grid-view .table_switch.table-responsive .table.table-striped thead tr {
@media (min-width: 992px) {
th:nth-child(2) { // table column: title
width: 400px;
}
th:nth-child(3) { // table column: name
min-width: 100px;
}
th:nth-child(4) { // table column: status
min-width: 100px;
}
th:nth-child(6) { // table column: date
min-width: 150px;
}
}
}
}
\ No newline at end of file
<?php
/**
* 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 amos-proposte-collaborazione-een
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\een\commands\controllers;
use elitedivision\amos\attachments\components\FileImport;
use elitedivision\amos\attachments\models\File;
use elitedivision\amos\cwh\models\CwhPubblicazioni;
use elitedivision\amos\een\commands\models\CollaborationProposalEen;
use elitedivision\amos\een\models\EenPartnershipProposal;
use elitedivision\amos\een\utility\EenMailUtility;
use elitedivision\amos\tag\models\EntitysTagsMm;
use yii\console\Controller;
use yii\console\Exception;
use yii\helpers\ArrayHelper;
use yii\helpers\Console;
use yii\helpers\Json;
use elitedivision\amos\cwh\models\CwhConfigContents;
/**
* Class ImportController
* @package elitedivision\amos\een\commands\controllers
*/
class ImportController extends Controller
{
public $tempPath;
public $ContractId;
public $CountriesForDissemination;
public $DeadlineDateAfter;
public $DeadlineDateBefore;
public $IncludeImages;
public $OrganisationCountryName;
public $OrganisationIdentifier;
public $OrganisationName;
public $ProfileTypes;
public $PublishedDateAfter;
public $PublishedDateBefore;
public $SubmitDateAfter;
public $SubmitDateBefore;
public $UpdateDateAfter;
public $UpdateDateBefore;
public $passedOptions = [
'ContractId',
'CountriesForDissemination',
'DeadlineDateAfter',
'DeadlineDateBefore',
'IncludeImages',
'OrganisationCountryName',
'OrganisationIdentifier',
'OrganisationName',
'ProfileTypes',
'PublishedDateAfter',
'PublishedDateBefore',
'SubmitDateAfter',
'SubmitDateBefore',
'UpdateDateAfter',
'UpdateDateBefore',
];
public $passedOptionsExplained = [
'ContractId' => 'with Contract Id {value}',
'CountriesForDissemination' => 'for the following countries {value}',
'DeadlineDateAfter' => 'which expires after {value}',
'DeadlineDateBefore' => 'which expires before {value}',
'IncludeImages' => 'with attachments',
'OrganisationCountryName' => 'published by an organization that resides in {value}',
'OrganisationIdentifier' => 'published by (identifier) {value}',
'OrganisationName' => 'published by (name) {value}',
'ProfileTypes' => 'of these types {value}',
'PublishedDateAfter' => 'published after {value}',
'PublishedDateBefore' => 'published before {value}',
'SubmitDateAfter' => 'submitted after {value}',
'SubmitDateBefore' => 'submitted before {value}',
'UpdateDateAfter' => 'updated after {value}',
'UpdateDateBefore' => 'updated before {value}',
];
public function options($actionID)
{
return ArrayHelper::merge(parent::options($actionID), $this->passedOptions);
}
/**
* Import EEN Profile request proposal from http://een.ec.europa.eu
*
*
* ```
* php yii een/import/start --UpdateDateAfter="2020-11-01" --UpdateDateBefore="2020-11-05" --ProfileTypes="Tr,To,Br,Rdr" --IncludeImages=1
* ```
*
* @throws Exception if the name argument is invalid or nothin passed
*/
public function actionStart()
{
ini_set('memory_limit', '4096M');
ini_set('soap.wsdl_cache_enabled', '0');
ini_set('soap.wsdl_cache_ttl', '0');
//ini_set("memory_limit","2G");
if (!count($this->getPassedOptionValues())) {
throw new Exception('No arguments passed');
}
$moduleEen = \Yii::$app->getModule(\elitedivision\amos\een\AmosEen::getModuleName());
$conversion = $moduleEen->enableConversionTag;
$this->ProfileTypes = $this->normalizeArray($this->ProfileTypes);
$this->CountriesForDissemination = $this->normalizeArray($this->CountriesForDissemination);
$this->DeadlineDateAfter = $this->normalizeDate($this->DeadlineDateAfter);
$this->DeadlineDateBefore = $this->normalizeDate($this->DeadlineDateBefore);
$this->PublishedDateAfter = $this->normalizeDate($this->PublishedDateAfter);
$this->PublishedDateBefore = $this->normalizeDate($this->PublishedDateBefore);
$this->SubmitDateAfter = $this->normalizeDate($this->SubmitDateAfter);
$this->SubmitDateBefore = $this->normalizeDate($this->SubmitDateBefore);
$this->UpdateDateAfter = $this->normalizeDate($this->UpdateDateAfter);
$this->UpdateDateBefore = $this->normalizeDate($this->UpdateDateBefore);
$this->IncludeImages = $this->normalizeBoolean($this->IncludeImages);
$this->OrganisationCountryName = $this->normalizeString($this->OrganisationCountryName);
$this->OrganisationIdentifier = $this->normalizeString($this->OrganisationIdentifier);
$this->OrganisationName = $this->normalizeString($this->OrganisationName);
$this->explainRequest();
$Proposte = CollaborationProposalEen::findAll($this->getPassedOptionValues());
$notify=0;
$proposteCount = count($Proposte);
if ($proposteCount) {
$list_tags_not_found = false;
foreach ((array) $Proposte->profile as $k => $profile) {
$proposta = EenPartnershipProposal::findOne(['reference_external' => $profile->reference->external]);
$PodProfile = new CollaborationProposalEen([
'podXml' => $profile
]);
if (!$proposta) {
Console::stdout("NUOVA PROPOSTA {$profile->reference->external} \n\r");
$proposta = new EenPartnershipProposal();
} else {
Console::stdout(@$profile->reference