Merge branch 'master' into PHRAS-2979-41-fix-right-access

This commit is contained in:
Nicolas Maillat
2020-03-18 10:27:58 +01:00
committed by GitHub
24 changed files with 337 additions and 93 deletions

View File

@@ -160,9 +160,9 @@ $cli->command(new QueryParseCommand());
$cli->command(new QuerySampleCommand());
$cli->command(new FindConceptsCommand());
$cli->command($cli['alchemy_worker.commands.run_dispatcher_command']);
$cli->command($cli['alchemy_worker.commands.run_worker_command']);
$cli->command($cli['alchemy_worker.commands.show_configuration']);
//$cli->command($cli['alchemy_worker.commands.run_dispatcher_command']);
//$cli->command($cli['alchemy_worker.commands.run_worker_command']);
//$cli->command($cli['alchemy_worker.commands.show_configuration']);
$cli->loadPlugins();

View File

@@ -14,6 +14,8 @@ namespace Alchemy\Phrasea\Border;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Checker\CheckerInterface;
use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Metadata\Tag\TfArchivedate;
use Alchemy\Phrasea\Metadata\Tag\TfQuarantine;
@@ -333,7 +335,7 @@ class Manager
$this->app['phraseanet.metadata-setter']->replaceMetadata($newMetadata, $element);
if(!$nosubdef) {
$element->rebuild_subdefs();
$this->app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($element, true));
}
return $element;

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application\Helper\FilesystemAware;
use Alchemy\Phrasea\Application\Helper\NotifierAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Event\ExportFailureEvent;
use Alchemy\Phrasea\Core\Event\ExportMailEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
@@ -193,42 +194,26 @@ class ExportController extends Controller
$token = $this->getTokenManipulator()->createEmailExportToken(serialize($list));
if (count($destMails) > 0) {
//zip documents
\set_export::build_zip(
$this->app,
$token,
$list,
$this->app['tmp.download.path'].'/'. $token->getValue() . '.zip'
);
$emitterId = $this->getAuthenticatedUser()->getId();
$remaingEmails = $destMails;
$tokenValue = $token->getValue();
$url = $this->app->url('prepare_download', ['token' => $token->getValue(), 'anonymous' => false, 'type' => \Session_Logger::EVENT_EXPORTMAIL]);
$user = $this->getAuthenticatedUser();
$emitter = new Emitter($user->getDisplayName(), $user->getEmail());
$params = [
'url' => $url,
'textmail' => $request->request->get('textmail'),
'reading_confirm' => !!$request->request->get('reading_confirm', false),
'ssttid' => $ssttid = $request->request->get('ssttid', ''),
'lst' => $lst = $request->request->get('lst', ''),
];
foreach ($destMails as $key => $mail) {
try {
$receiver = new Receiver(null, trim($mail));
} catch (InvalidArgumentException $e) {
continue;
}
$mail = MailRecordsExport::create($this->app, $receiver, $emitter, $request->request->get('textmail'));
$mail->setButtonUrl($url);
$mail->setExpiration($token->getExpiration());
$this->deliver($mail, !!$request->request->get('reading_confirm', false));
unset($remaingEmails[$key]);
}
//some mails failed
if (count($remaingEmails) > 0) {
foreach ($remaingEmails as $mail) {
$this->dispatch(PhraseaEvents::EXPORT_MAIL_FAILURE, new ExportFailureEvent($this->getAuthenticatedUser(), $ssttid, $lst, \eventsmanager_notify_downloadmailfail::MAIL_FAIL, $mail));
}
}
$this->dispatch(PhraseaEvents::EXPORT_MAIL_CREATE, new ExportMailEvent(
$emitterId,
$tokenValue,
$destMails,
$params
));
}
return $this->app->json([

View File

@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Application\Helper\EntityManagerAware;
use Alchemy\Phrasea\Application\Helper\SearchEngineAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Core\Event\Record\DeleteEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Model\Entities\BasketElement;
@@ -234,7 +236,7 @@ class RecordController extends Controller
if($trashCollectionsBySbasId[$sbasId] !== null) {
if($record->getCollection()->get_coll_id() == $trashCollectionsBySbasId[$sbasId]->get_coll_id()) {
// record is already in trash so delete it
$record->delete();
$this->getEventDispatcher()->dispatch(RecordEvents::DELETE, new DeleteEvent($record));
} else {
// move to trash collection
$record->move_to_collection($trashCollectionsBySbasId[$sbasId], $this->getApplicationBox());
@@ -247,7 +249,7 @@ class RecordController extends Controller
}
} else {
// no trash collection, delete
$record->delete();
$this->getEventDispatcher()->dispatch(RecordEvents::DELETE, new DeleteEvent($record));
}
} catch (\Exception $e) {
}

View File

@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Application\Helper\EntityManagerAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Controller\Exception as ControllerException;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Model\Entities\StoryWZ;
@@ -68,7 +70,9 @@ class StoryController extends Controller
break;
}
$story->set_metadatas($metadatas)->rebuild_subdefs();
$recordAdapter = $story->set_metadatas($metadatas);
// tell phraseanet to rebuild subdef
$this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($recordAdapter));
$storyWZ = new StoryWZ();
$storyWZ->setUser($this->getAuthenticatedUser());

View File

@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Application\Helper\SubDefinitionSubstituerAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Metadata\PhraseanetMetadataReader;
use Alchemy\Phrasea\Metadata\PhraseanetMetadataSetter;
@@ -156,7 +157,7 @@ class ToolsController extends Controller
}
if (!$substituted || $force) {
$record->rebuild_subdefs();
$this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($record));
}
}

View File

@@ -0,0 +1,53 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2019 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event;
use Symfony\Component\EventDispatcher\Event as SfEvent;
class ExportMailEvent extends SfEvent
{
private $emitterUserId;
private $tokenValue;
/** @var array */
private $destinationMails;
/** @var array */
private $params;
public function __construct($emitterUserId, $tokenValue, array $destMails, array $params)
{
$this->emitterUserId = $emitterUserId;
$this->tokenValue = $tokenValue;
$this->destinationMails = $destMails;
$this->params = $params;
}
public function getTokenValue()
{
return $this->tokenValue;
}
public function getDestinationMails()
{
return $this->destinationMails;
}
public function getEmitterUserId()
{
return $this->emitterUserId;
}
public function getParams()
{
return $this->params;
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Alchemy\Phrasea\Core\Event\Record;
class DeleteEvent extends RecordEvent
{
}

View File

@@ -13,8 +13,10 @@ namespace Alchemy\Phrasea\Core\Event\Record;
final class RecordEvents
{
const CREATED = 'record.created';
const DELETED = 'record.deleted';
const CREATED = 'record.created';
const DELETED = 'record.deleted';
const DELETE = 'record.delete';
// Change
const COLLECTION_CHANGED = 'record.collection_changed';
const METADATA_CHANGED = 'record.metadata_changed';
@@ -29,6 +31,8 @@ final class RecordEvents
const SUB_DEFINITIONS_CREATED = 'record.sub_definitions_created';
const SUB_DEFINITION_CREATION_FAILED = 'record.sub_definition_creation_failed';
const SUBDEFINITION_CREATE = 'record.subdefinition_create';
const MEDIA_SUBSTITUTED = 'record.media_substituted';
const STORY_COVER_CHANGED = 'record.story_cover_changed';

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Record;
use Alchemy\Phrasea\Model\RecordInterface;
class SubdefinitionCreateEvent extends RecordEvent
{
private $isNewRecord;
public function __construct(RecordInterface $record, $isNewRecord = false)
{
parent::__construct($record);
$this->isNewRecord = $isNewRecord;
}
/**
* @return bool
*/
public function isNewRecord()
{
return $this->isNewRecord;
}
}

View File

@@ -12,7 +12,15 @@
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Core\Event\ExportFailureEvent;
use Alchemy\Phrasea\Core\Event\ExportMailEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Model\Entities\Token;
use Alchemy\Phrasea\Model\Repositories\TokenRepository;
use Alchemy\Phrasea\Model\Repositories\UserRepository;
use Alchemy\Phrasea\Notification\Emitter;
use Alchemy\Phrasea\Notification\Mail\MailRecordsExport;
use Alchemy\Phrasea\Notification\Receiver;
class ExportSubscriber extends AbstractNotificationSubscriber
{
@@ -39,10 +47,65 @@ class ExportSubscriber extends AbstractNotificationSubscriber
$this->app['event-manager']->notify($params['usr_id'], 'eventsmanager_notify_downloadmailfail', $datas, $mailed);
}
public function onCreateExportMail(ExportMailEvent $event)
{
$destMails = $event->getDestinationMails();
$params = $event->getParams();
/** @var UserRepository $userRepository */
$userRepository = $this->app['repo.users'];
$user = $userRepository->find($event->getEmitterUserId());
/** @var TokenRepository $tokenRepository */
$tokenRepository = $this->app['repo.tokens'];
/** @var Token $token */
$token = $tokenRepository->findValidToken($event->getTokenValue());
$list = unserialize($token->getData());
//zip documents
\set_export::build_zip(
$this->app,
$token,
$list,
$this->app['tmp.download.path'].'/'. $token->getValue() . '.zip'
);
$remaingEmails = $destMails;
$emitter = new Emitter($user->getDisplayName(), $user->getEmail());
foreach ($destMails as $key => $mail) {
try {
$receiver = new Receiver(null, trim($mail));
} catch (InvalidArgumentException $e) {
continue;
}
$mail = MailRecordsExport::create($this->app, $receiver, $emitter, $params['textmail']);
$mail->setButtonUrl($params['url']);
$mail->setExpiration($token->getExpiration());
$this->deliver($mail, $params['reading_confirm']);
unset($remaingEmails[$key]);
}
//some mails failed
if (count($remaingEmails) > 0) {
foreach ($remaingEmails as $mail) {
$this->app['dispatcher']->dispatch(PhraseaEvents::EXPORT_MAIL_FAILURE, new ExportFailureEvent($user, $params['ssttid'], $params['lst'], \eventsmanager_notify_downloadmailfail::MAIL_FAIL, $mail));
}
}
}
public static function getSubscribedEvents()
{
return [
PhraseaEvents::EXPORT_MAIL_FAILURE => 'onMailExportFailure'
PhraseaEvents::EXPORT_MAIL_FAILURE => 'onMailExportFailure',
PhraseaEvents::EXPORT_MAIL_CREATE => 'onCreateExportMail',
];
}
}

View File

@@ -11,8 +11,10 @@
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Core\Event\Record\CollectionChangedEvent;
use Alchemy\Phrasea\Core\Event\Record\DeleteEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Metadata\Tag\TfEditdate;
@@ -26,10 +28,12 @@ class RecordEditSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents()
{
return array(
PhraseaEvents::RECORD_EDIT => 'onEdit',
PhraseaEvents::RECORD_UPLOAD => 'onEdit',
RecordEvents::ROTATE => 'onRecordChange',
RecordEvents::COLLECTION_CHANGED => 'onCollectionChanged',
PhraseaEvents::RECORD_EDIT => 'onEdit',
PhraseaEvents::RECORD_UPLOAD => 'onEdit',
RecordEvents::ROTATE => 'onRecordChange',
RecordEvents::COLLECTION_CHANGED => 'onCollectionChanged',
RecordEvents::SUBDEFINITION_CREATE => 'onSubdefinitionCreate',
RecordEvents::DELETE => 'onDelete',
);
}
@@ -49,6 +53,18 @@ class RecordEditSubscriber implements EventSubscriberInterface
$recordAdapter->clearStampCache();
}
public function onSubdefinitionCreate(SubdefinitionCreateEvent $event)
{
$recordAdapter = $this->convertToRecordAdapter($event->getRecord());
$recordAdapter->rebuild_subdefs();
}
public function onDelete(DeleteEvent $event)
{
$recordAdapter = $this->convertToRecordAdapter($event->getRecord());
$recordAdapter->delete();
}
public function onEdit(RecordEdit $event)
{
static $into = false;

View File

@@ -48,7 +48,8 @@ final class PhraseaEvents
const BRIDGE_UPLOAD_FAILURE = 'bridge.upload-failure';
const EXPORT_MAIL_FAILURE = 'export.mail-failure';
const EXPORT_CREATE = 'export.create';
const EXPORT_CREATE = 'export.create';
const EXPORT_MAIL_CREATE = 'export.mail-create';
const RECORD_EDIT = 'record.edit';
const RECORD_UPLOAD = 'record.upload';

View File

@@ -32,11 +32,12 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
$app['alchemy_queues.queues'] = $app->share(function (Application $app) {
$defaultConfiguration = [
'worker-queue' => [
'registry' => 'alchemy_worker.queue_registry',
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'vhost' => '/'
'registry' => 'alchemy_worker.queue_registry',
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'vhost' => '/'
]
];
@@ -46,19 +47,22 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
$queueConfigurations = $configuration->get(['workers', 'queue'], $defaultConfiguration);
$queueConfiguration = reset($queueConfigurations);
$queueKey = key($queueConfigurations);
$config = [];
if (! isset($queueConfiguration['name'])) {
if (! is_string($queueKey)) {
throw new \RuntimeException('Invalid queue configuration: configuration has no key or name.');
foreach($queueConfigurations as $name => $queueConfiguration) {
$queueKey = $name;
if (! isset($queueConfiguration['name'])) {
if (! is_string($queueKey)) {
throw new \RuntimeException('Invalid queue configuration: configuration has no key or name.');
}
$queueConfiguration['name'] = $queueKey;
}
$queueConfiguration['name'] = $queueKey;
$config[$queueConfiguration['name']] = $queueConfiguration ;
}
$config = [ $queueConfiguration['name'] => $queueConfiguration ];
return $config;
}
catch (RuntimeException $exception) {

View File

@@ -18,6 +18,7 @@ use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreationEvent;
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionsCreationEvent;
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreationFailedEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Databox\Subdef\MediaSubdefRepository;
use Alchemy\Phrasea\Filesystem\FilesystemService;
use Alchemy\Phrasea\Media\Subdef\Specification\PdfSpecification;
use MediaAlchemyst\Alchemyst;
@@ -170,13 +171,53 @@ class SubdefGenerator
unset($this->tmpFilePath);
}
$this->dispatch(
RecordEvents::SUB_DEFINITIONS_CREATED,
new SubDefinitionsCreatedEvent(
$record,
$mediaCreated
)
);
// if we created subdef one by one
if (count($wanted_subdefs) == 1) {
$mediaSubdefRepository = $this->getMediaSubdefRepository($record->getDataboxId());
$mediaSubdefs = $mediaSubdefRepository->findByRecordIdsAndNames([$record->getRecordId()]);
$medias = [];
foreach ($mediaSubdefs as $subdef) {
try {
$medias[$subdef->get_name()] = $this->mediavorus->guess($subdef->getRealPath());
} catch (MediaVorusFileNotFoundException $e) {
}
}
$this->dispatch(
RecordEvents::SUB_DEFINITIONS_CREATED,
new SubDefinitionsCreatedEvent(
$record,
$medias
)
);
} else {
$this->dispatch(
RecordEvents::SUB_DEFINITIONS_CREATED,
new SubDefinitionsCreatedEvent(
$record,
$mediaCreated
)
);
}
}
/**
* set a logger to use
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* to get the logger
* @return LoggerInterface
*/
public function getLogger()
{
return $this->logger;
}
private function generateSubdef(\record_adapter $record, \databox_subdef $subdef_class, $pathdest)
@@ -276,4 +317,14 @@ class SubdefGenerator
$i = floor(log($bytes, 1024));
return round($bytes / pow(1024, $i), [0,0,2,2,3][$i]).['B','kB','MB','GB'][$i];
}
/**
* @param $databoxId
*
* @return MediaSubdefRepository|Object
*/
private function getMediaSubdefRepository($databoxId)
{
return $this->app['provider.repo.media_subdef']->getRepositoryForDatabox($databoxId);
}
}

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Media;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Event\Record\MediaSubstitutedEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Filesystem\FilesystemService;
use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException;
@@ -79,7 +80,7 @@ class SubdefSubstituer
$record->write_metas();
if ($shouldSubdefsBeRebuilt) {
$record->rebuild_subdefs();
$this->dispatcher->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($record));
}
$this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new MediaSubstitutedEvent($record));

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\Model\Manipulator;
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
use Alchemy\Phrasea\Webhook\WebhookPublisher;
use Alchemy\Phrasea\Webhook\WebhookPublisherInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityRepository;
@@ -29,11 +29,11 @@ class WebhookEventManipulator implements ManipulatorInterface
private $repository;
/**
* @var WebhookPublisher
* @var WebhookPublisherInterface
*/
private $publisher;
public function __construct(ObjectManager $om, EntityRepository $repo, WebhookPublisher $publisher)
public function __construct(ObjectManager $om, EntityRepository $repo, WebhookPublisherInterface $publisher)
{
$this->om = $om;
$this->repository = $repo;

View File

@@ -12,6 +12,8 @@
namespace Alchemy\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager as borderManager;
@@ -1001,7 +1003,7 @@ class ArchiveJob extends AbstractJob
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$collection->get_connection();
$status = \databox_status::operation_or($stat0, $stat1);
@@ -1032,7 +1034,8 @@ class ArchiveJob extends AbstractJob
}
$story->setStatus(\databox_status::operation_or($stat0, $stat1));
$story->rebuild_subdefs();
$app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($story));
unset($media);

View File

@@ -19,7 +19,7 @@ use Alchemy\Queue\MessageQueueRegistry;
* Class WebhookPublisher publishes webhook event notifications in message queues
* @package Alchemy\Phrasea\Webhook
*/
class WebhookPublisher
class WebhookPublisher implements WebhookPublisherInterface
{
/**
* @var MessageQueueRegistry

View File

@@ -0,0 +1,10 @@
<?php
namespace Alchemy\Phrasea\Webhook;
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
interface WebhookPublisherInterface
{
public function publishWebhookEvent(WebhookEvent $event);
}

View File

@@ -19,6 +19,7 @@ use Alchemy\Phrasea\Core\Event\Record\OriginalNameChangedEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\StatusChangedEvent;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent;
use Alchemy\Phrasea\Core\PhraseaTokens;
use Alchemy\Phrasea\Databox\Subdef\MediaSubdefRepository;
use Alchemy\Phrasea\Filesystem\FilesystemService;
@@ -284,7 +285,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$this->getDataboxConnection()->executeUpdate($sql, ['type' => $type, 'record_id' => $this->getRecordId()]);
if ($old_type !== $type) {
$this->rebuild_subdefs();
$this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($this));
}
$this->type = $type;
@@ -341,7 +342,8 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
array(':mime' => $mime, ':record_id' => $this->getRecordId())
)) {
$this->rebuild_subdefs();
$this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($this));
$this->delete_data_from_cache();
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version='1.0' encoding='utf-8'?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-03-17T12:44:55Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
@@ -7,8 +7,8 @@
</header>
<body>
<trans-unit id="da39a3ee5e6b4b0d3255bfef95601890afd80709" resname="">
<source></source>
<target state="new"></target>
<source/>
<target state="new"/>
<jms:reference-file line="60">Form/Login/PhraseaAuthenticationForm.php</jms:reference-file>
<jms:reference-file line="47">Form/Configuration/EmailFormType.php</jms:reference-file>
</trans-unit>
@@ -13432,14 +13432,14 @@ It is possible to place several search areas</target>
<target state="translated">August</target>
<jms:reference-file line="170">prod/WorkZone/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="63c83f397c51202a27320349456ec75b844a75e6" resname="workzone:datepicker:closeText">
<trans-unit id="63c83f397c51202a27320349456ec75b844a75e6" resname="workzone:datepicker:closeText" approved="no">
<source>workzone:datepicker:closeText</source>
<target state="new">workzone:datepicker:closeText</target>
<target state="needs-translation">Close</target>
<jms:reference-file line="165">prod/WorkZone/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="32037015798672f75f469624c847da64e5953a27" resname="workzone:datepicker:currentText">
<trans-unit id="32037015798672f75f469624c847da64e5953a27" resname="workzone:datepicker:currentText" approved="no">
<source>workzone:datepicker:currentText</source>
<target state="new">workzone:datepicker:currentText</target>
<target state="needs-translation">Current</target>
<jms:reference-file line="168">prod/WorkZone/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="7e55bc758f272d38198385584d6f50c2dd0eae13" resname="workzone:datepicker:december" approved="yes">
@@ -13543,9 +13543,9 @@ It is possible to place several search areas</target>
<jms:reference-file line="105">prod/WorkZone/Basket.html.twig</jms:reference-file>
<jms:reference-file line="15">prod/Tooltip/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="32285b1e113decb0a3fdf090b0698c5508a2bd09" resname="workzone:feedback:expiration-open">
<trans-unit id="32285b1e113decb0a3fdf090b0698c5508a2bd09" resname="workzone:feedback:expiration-open" approved="no">
<source>workzone:feedback:expiration-open</source>
<target state="new">workzone:feedback:expiration-open</target>
<target state="needs-translation">Feedback open until</target>
<jms:reference-file line="107">prod/WorkZone/Basket.html.twig</jms:reference-file>
<jms:reference-file line="17">prod/Tooltip/Basket.html.twig</jms:reference-file>
</trans-unit>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version='1.0' encoding='utf-8'?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-03-17T12:45:08Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
@@ -7,8 +7,8 @@
</header>
<body>
<trans-unit id="da39a3ee5e6b4b0d3255bfef95601890afd80709" resname="">
<source></source>
<target state="new"></target>
<source/>
<target state="new"/>
<jms:reference-file line="60">Form/Login/PhraseaAuthenticationForm.php</jms:reference-file>
<jms:reference-file line="47">Form/Configuration/EmailFormType.php</jms:reference-file>
</trans-unit>
@@ -13540,15 +13540,15 @@ Si vous recevez cet e-mail sans l'avoir sollicité, merci de l'ignorer ou de le
<target state="translated">Mercredi</target>
<jms:reference-file line="171">prod/WorkZone/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="cbfb58c29147c5881e828d18a477f922211873a0" resname="workzone:feedback:expiration-closed">
<trans-unit id="cbfb58c29147c5881e828d18a477f922211873a0" resname="workzone:feedback:expiration-closed" approved="no">
<source>workzone:feedback:expiration-closed</source>
<target state="new">workzone:feedback:expiration-closed</target>
<target state="needs-translation">Validation close depuis</target>
<jms:reference-file line="105">prod/WorkZone/Basket.html.twig</jms:reference-file>
<jms:reference-file line="15">prod/Tooltip/Basket.html.twig</jms:reference-file>
</trans-unit>
<trans-unit id="32285b1e113decb0a3fdf090b0698c5508a2bd09" resname="workzone:feedback:expiration-open">
<trans-unit id="32285b1e113decb0a3fdf090b0698c5508a2bd09" resname="workzone:feedback:expiration-open" approved="no">
<source>workzone:feedback:expiration-open</source>
<target state="new">workzone:feedback:expiration-open</target>
<target state="needs-translation">validation ouverte jusqu'au</target>
<jms:reference-file line="107">prod/WorkZone/Basket.html.twig</jms:reference-file>
<jms:reference-file line="17">prod/Tooltip/Basket.html.twig</jms:reference-file>
</trans-unit>

View File

@@ -169,7 +169,8 @@ class ExportTest extends \PhraseanetAuthenticatedWebTestCase
*/
public function testExportMail()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRecordsExport');
// deliver method removed in the listener
// $this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRecordsExport');
$this->getClient()->request('POST', '/prod/export/mail/', [
'lst' => $this->getRecord1()->getId(),