From 66abd569e1bd6e4afb0074f7cfc44d07428172e0 Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Tue, 5 Dec 2023 11:49:01 +0100 Subject: [PATCH 1/5] PHRAS-3997 translation field content restriction option (#4432) * Translated using Weblate (German) Currently translated at 99.5% (3013 of 3027 strings) Translation: Phraseanet/Phraseanet master message Translate-URL: https://hosted.weblate.org/projects/phraseanet/phraseanet-master-message/de/ * Translated using Weblate (English) Currently translated at 99.5% (3013 of 3027 strings) Translation: Phraseanet/Phraseanet master message Translate-URL: https://hosted.weblate.org/projects/phraseanet/phraseanet-master-message/en/ * Translated using Weblate (French) Currently translated at 99.5% (3013 of 3027 strings) Translation: Phraseanet/Phraseanet master message Translate-URL: https://hosted.weblate.org/projects/phraseanet/phraseanet-master-message/fr/ --- resources/locales/messages.de.xlf | 16 ++++++++-------- resources/locales/messages.en.xlf | 16 ++++++++-------- resources/locales/messages.fr.xlf | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/resources/locales/messages.de.xlf b/resources/locales/messages.de.xlf index a216e83b10..56f05f677d 100644 --- a/resources/locales/messages.de.xlf +++ b/resources/locales/messages.de.xlf @@ -1,4 +1,4 @@ - +
@@ -7,8 +7,8 @@
- - + + WorkerManager/Worker/DownloadAsyncWorker.php Form/Configuration/EmailFormType.php Form/Login/PhraseaAuthenticationForm.php @@ -196,7 +196,7 @@ Bridge/Dailymotion/element_informations.html.twig - selectionnes]]> + %number% documents<br/>selectionnes ausgewählt]]> Controller/Prod/QueryController.php @@ -2557,7 +2557,7 @@ Form/Configuration/ActionsFormType.php - + Display & action settings Anzeige und Handlung-Einstellungen admin/fields/templates.html.twig @@ -11393,7 +11393,7 @@ input-disable - input-disable + Feldinhalte auf vorgeschlagene Werte und Thesaurus beschränken (Beta-Funktion) admin/fields/templates.html.twig @@ -12463,7 +12463,7 @@ Controller/Root/AccountController.php - >]]> + phraseanet::account: << your account can be deleted via admin interface >> Ihr Benutzerkonto kann nur durch die Administration Anwendung gelöscht werden. web/account/account.html.twig @@ -15623,7 +15623,7 @@ Vorsicht: die aktuelle Werte werden durch die neue Werte überschrieben web/thesaurus/thesaurus.html.twig - + thesaurus:: Supprimer cette branche ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation) web/thesaurus/thesaurus.html.twig diff --git a/resources/locales/messages.en.xlf b/resources/locales/messages.en.xlf index f1c3738cfa..182093c83d 100644 --- a/resources/locales/messages.en.xlf +++ b/resources/locales/messages.en.xlf @@ -1,4 +1,4 @@ - +
@@ -7,8 +7,8 @@
- - + + WorkerManager/Worker/DownloadAsyncWorker.php Form/Configuration/EmailFormType.php Form/Login/PhraseaAuthenticationForm.php @@ -196,7 +196,7 @@ Bridge/Dailymotion/element_informations.html.twig - selectionnes]]> + %number% documents<br/>selectionnes selected]]> Controller/Prod/QueryController.php @@ -2559,7 +2559,7 @@ Form/Configuration/ActionsFormType.php - + Display & action settings Display and action settings admin/fields/templates.html.twig @@ -11395,7 +11395,7 @@ input-disable - input-disable + Restrict field content to suggested values and thesaurus (beta feature) admin/fields/templates.html.twig @@ -12465,7 +12465,7 @@ Controller/Root/AccountController.php - >]]> + phraseanet::account: << your account can be deleted via admin interface >> Your rights do not allow to perform this action. Your account can only be deleted via the Administration interface. web/account/account.html.twig @@ -15628,7 +15628,7 @@ It is possible to place several search areas web/thesaurus/thesaurus.html.twig - + thesaurus:: Supprimer cette branche ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation) web/thesaurus/thesaurus.html.twig diff --git a/resources/locales/messages.fr.xlf b/resources/locales/messages.fr.xlf index 2926fd682d..de5c8e3782 100644 --- a/resources/locales/messages.fr.xlf +++ b/resources/locales/messages.fr.xlf @@ -1,4 +1,4 @@ - +
@@ -7,8 +7,8 @@
- - + + WorkerManager/Worker/DownloadAsyncWorker.php Form/Configuration/EmailFormType.php Form/Login/PhraseaAuthenticationForm.php @@ -196,7 +196,7 @@ Bridge/Dailymotion/element_informations.html.twig - selectionnes]]> + %number% documents<br/>selectionnes sélectionnés]]> Controller/Prod/QueryController.php @@ -2557,7 +2557,7 @@ Form/Configuration/ActionsFormType.php - + Display & action settings Paramétrage d'affichage et d'action admin/fields/templates.html.twig @@ -11394,7 +11394,7 @@ Si vous recevez cet e-mail sans l'avoir sollicité, merci de l'ignorer ou de le input-disable - input-disable + Restreindre le contenu du champ aux valeurs suggérées et au thésaurus (fonctionnalité bêta) admin/fields/templates.html.twig @@ -12464,7 +12464,7 @@ Si vous recevez cet e-mail sans l'avoir sollicité, merci de l'ignorer ou de le Controller/Root/AccountController.php - >]]> + phraseanet::account: << your account can be deleted via admin interface >> Vos droits ne vous permettent pas de réaliser cette action, votre compte ne peut être supprimé que via l'interface d'Administration. web/account/account.html.twig @@ -15632,7 +15632,7 @@ Attention: les valeurs actuellement en place seront écrasées par ces nouvelles web/thesaurus/thesaurus.html.twig - + thesaurus:: Supprimer cette branche ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation) web/thesaurus/thesaurus.html.twig From cbb131d17de686524d21594556c7320f2b950411 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Thu, 7 Dec 2023 19:36:47 +0100 Subject: [PATCH 2/5] Update 418RC8PHRAS3768.php (#4435) disable patch crashing caused missing table "basketelements" --- lib/classes/patch/418RC8PHRAS3768.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/classes/patch/418RC8PHRAS3768.php b/lib/classes/patch/418RC8PHRAS3768.php index 03e2a52def..f2647289b2 100644 --- a/lib/classes/patch/418RC8PHRAS3768.php +++ b/lib/classes/patch/418RC8PHRAS3768.php @@ -63,10 +63,11 @@ private function patch_databox(databox $databox, Application $app) private function patch_appbox(base $appbox, Application $app) { - $cnx = $appbox->get_connection(); - $sql = "ALTER TABLE `BasketElements` ADD `vote_expired` DATETIME NULL, ADD INDEX `vote_expired` (`vote_expired`)"; +// disabled cause crash on some install (missing table) due to pre-post migration (?) + // $cnx = $appbox->get_connection(); +// $sql = "ALTER TABLE `BasketElements` ADD `vote_expired` DATETIME NULL, ADD INDEX `vote_expired` (`vote_expired`)"; // try { - $cnx->exec($sql); +// $cnx->exec($sql); // } // catch (\Exception $e) { // the field already exist ? From f01c9a672c56d6a8e08b83b09d01db6a9bafbd7e Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Fri, 8 Dec 2023 01:49:19 +0300 Subject: [PATCH 3/5] stop to try to write metadata on story (#4433) --- .../Subscriber/RecordSubscriber.php | 86 ++++++++++--------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/lib/Alchemy/Phrasea/WorkerManager/Subscriber/RecordSubscriber.php b/lib/Alchemy/Phrasea/WorkerManager/Subscriber/RecordSubscriber.php index 781cb550a4..6e1b78a8f6 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Subscriber/RecordSubscriber.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Subscriber/RecordSubscriber.php @@ -162,50 +162,54 @@ public function onRecordsWriteMeta(RecordsWriteMetaEvent $event) $databox = $this->getApplicationBox()->get_databox($databoxId); $record = $databox->get_record($recordId); - $type = $record->getType(); - $subdefGroupe = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType()); + // do not try to write meta on non story record + if (!$record->isStory()) { + $type = $record->getType(); - if ($subdefGroupe !== null) { - $toWritemetaOriginalDocument = $subdefGroupe->toWritemetaOriginalDocument(); - } else { - $toWritemetaOriginalDocument = true; - } + $subdefGroupe = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType()); - foreach ($mediaSubdefs as $subdef) { - // check subdefmetadatarequired from the subview setup in admin - // check if we want to write meta in this mime type - if (in_array(trim($subdef->get_mime()), $acceptedMimeTypes) && - ( - ($subdef->get_name() == 'document' && $toWritemetaOriginalDocument) || - $this->isSubdefMetadataUpdateRequired($databox, $type, $subdef->get_name()) - ) - ) { - $payload = [ - 'message_type' => MessagePublisher::WRITE_METADATAS_TYPE, - 'payload' => [ - 'recordId' => $recordId, - 'databoxId' => $databoxId, - 'subdefName' => $subdef->get_name() - ] - ]; - if ($subdef->is_physically_present()) { - $this->messagePublisher->publishMessage($payload, MessagePublisher::WRITE_METADATAS_TYPE); - } - else { - $logMessage = sprintf('Subdef "%s" is not physically present! to be passed in the retry q of "%s" ! payload >>> %s', - $subdef->get_name(), - MessagePublisher::WRITE_METADATAS_TYPE, - json_encode($payload) - ); - $this->messagePublisher->pushLog($logMessage); - - $this->messagePublisher->publishRetryMessage( - $payload, - MessagePublisher::WRITE_METADATAS_TYPE, - 2, - 'Subdef is not physically present!' - ); + if ($subdefGroupe !== null) { + $toWritemetaOriginalDocument = $subdefGroupe->toWritemetaOriginalDocument(); + } else { + $toWritemetaOriginalDocument = true; + } + + foreach ($mediaSubdefs as $subdef) { + // check subdefmetadatarequired from the subview setup in admin + // check if we want to write meta in this mime type + if (in_array(trim($subdef->get_mime()), $acceptedMimeTypes) && + ( + ($subdef->get_name() == 'document' && $toWritemetaOriginalDocument) || + $this->isSubdefMetadataUpdateRequired($databox, $type, $subdef->get_name()) + ) + ) { + $payload = [ + 'message_type' => MessagePublisher::WRITE_METADATAS_TYPE, + 'payload' => [ + 'recordId' => $recordId, + 'databoxId' => $databoxId, + 'subdefName' => $subdef->get_name() + ] + ]; + if ($subdef->is_physically_present()) { + $this->messagePublisher->publishMessage($payload, MessagePublisher::WRITE_METADATAS_TYPE); + } + else { + $logMessage = sprintf('Subdef "%s" is not physically present! to be passed in the retry q of "%s" ! payload >>> %s', + $subdef->get_name(), + MessagePublisher::WRITE_METADATAS_TYPE, + json_encode($payload) + ); + $this->messagePublisher->pushLog($logMessage); + + $this->messagePublisher->publishRetryMessage( + $payload, + MessagePublisher::WRITE_METADATAS_TYPE, + 2, + 'Subdef is not physically present!' + ); + } } } } From 8be71ba75446a5d50c5f7f76e0c5b907af4919bb Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:10:34 +0300 Subject: [PATCH 4/5] patch for stamp (#4434) --- lib/classes/patch/418RC8PHRAS3777.php | 8 ++++++++ lib/conf.d/configuration.yml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/lib/classes/patch/418RC8PHRAS3777.php b/lib/classes/patch/418RC8PHRAS3777.php index f5d649b596..0335f63eb6 100644 --- a/lib/classes/patch/418RC8PHRAS3777.php +++ b/lib/classes/patch/418RC8PHRAS3777.php @@ -125,5 +125,13 @@ private function patch_appbox(base $appbox, Application $app) $conf->set(['workers', 'queues', 'downloadAsync'], $value); } + // patch for stamp PHRAS-3520 + if (!$conf->has(['registry', 'actions', 'export-stamp-choice'])) { + $conf->set(['registry', 'actions', 'export-stamp-choice'], false); + } + if (!$conf->has(['registry', 'actions', 'stamp-subdefs'])) { + $conf->set(['registry', 'actions', 'stamp-subdefs'], false); + } + } } diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index 4052c5906f..7d4f72dc12 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -177,6 +177,9 @@ border-manager: registry: api-clients: api-subdef_service: false + actions: + export-stamp-choice: false + stamp-subdefs: false user_account: deleting_policies: email_confirmation: true From 4cefad3f93a90d533e20390e7f651b7b230791ee Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:27:59 +0300 Subject: [PATCH 5/5] basket element add column and index (#4436) --- .../Phrasea/Model/Entities/BasketElement.php | 37 ++++++++- lib/classes/patch/418RC8PHRAS3768.php | 76 ------------------- 2 files changed, 36 insertions(+), 77 deletions(-) delete mode 100644 lib/classes/patch/418RC8PHRAS3768.php diff --git a/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php b/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php index e6c09da3e7..b8ee8bfe53 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php +++ b/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php @@ -20,7 +20,14 @@ use record_adapter; /** - * @ORM\Table(name="BasketElements", uniqueConstraints={@ORM\UniqueConstraint(name="unique_recordcle", columns={"basket_id","sbas_id","record_id"})}) + * @ORM\Table(name="BasketElements", + * uniqueConstraints={ + * @ORM\UniqueConstraint(name="unique_recordcle", columns={"basket_id","sbas_id","record_id"}) + * }, + * indexes={ + * @ORM\Index(name="vote_expired", columns={"vote_expired"}) + * } + * ) * @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\BasketElementRepository") */ class BasketElement @@ -70,6 +77,11 @@ class BasketElement */ private $basket; + /** + * @ORM\Column(type="datetime", nullable=true) + */ + private $vote_expired; + /** * Constructor */ @@ -168,6 +180,29 @@ public function getOrd() return $this->ord; } + /** + * Get vote_expired + * + * @return DateTime + */ + public function getVoteExpired() + { + return $this->vote_expired; + } + + /** + * Set vote_expired + * + * @param DateTime $voteExpired + * @return self + */ + public function setVoteExpired(DateTime $voteExpired) + { + $this->vote_expired = $voteExpired; + + return $this; + } + /** * Set created * diff --git a/lib/classes/patch/418RC8PHRAS3768.php b/lib/classes/patch/418RC8PHRAS3768.php deleted file mode 100644 index f2647289b2..0000000000 --- a/lib/classes/patch/418RC8PHRAS3768.php +++ /dev/null @@ -1,76 +0,0 @@ -release; - } - - /** - * {@inheritdoc} - */ - public function getDoctrineMigrations() - { - return []; - } - - /** - * {@inheritdoc} - */ - public function require_all_upgrades() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function concern() - { - return $this->concern; - } - - /** - * {@inheritdoc} - */ - public function apply(base $base, Application $app) - { - if ($base->get_base_type() === base::DATA_BOX) { - $this->patch_databox($base, $app); - } - elseif ($base->get_base_type() === base::APPLICATION_BOX) { - $this->patch_appbox($base, $app); - } - - return true; - } - - private function patch_databox(databox $databox, Application $app) - { - } - - private function patch_appbox(base $appbox, Application $app) - { -// disabled cause crash on some install (missing table) due to pre-post migration (?) - // $cnx = $appbox->get_connection(); -// $sql = "ALTER TABLE `BasketElements` ADD `vote_expired` DATETIME NULL, ADD INDEX `vote_expired` (`vote_expired`)"; -// try { -// $cnx->exec($sql); -// } -// catch (\Exception $e) { - // the field already exist ? -// } - } -}