diff --git a/composer.json b/composer.json index f874661edc..c64dc80a54 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "type": "vcs", "url": "https://github.com/alchemy-fr/tcpdf-clone" }, + { "type": "git", "url": "https://github.com/romainneutron/ProcessManager.git" { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollectionController.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollectionController.php index a76b431272..ee96ef8b53 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollectionController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollectionController.php @@ -45,6 +45,26 @@ class MoveCollectionController extends Controller $template = $this->render('prod/actions/collection_default.html.twig', $parameters); } +<<<<<<< HEAD +======= + if (count($records->databoxes()) > 1) { + $success = false; + $message = $this->app->trans('prod::Les enregistrements ne provienent pas tous de la meme base et ne peuvent donc etre traites ensemble'); + } elseif (count($records) == 0) { + $success = false; + $message = $this->app->trans('prod::Vous n\'avez le droit d\'effectuer l\'operation sur aucun document'); + } else { + // is able to move: + $success = true; + $parameters = [ + 'records' => $records, + 'message' => '', + 'collections' => $collections, + ]; + $template = $this->render('prod/actions/collection_default.html.twig', $parameters); + } + +>>>>>>> origin/master $datas = [ 'success' => $success, 'message' => $message, diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/ThesaurusXmlHttpController.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/ThesaurusXmlHttpController.php index 2e970e51d8..badebc5a89 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/ThesaurusXmlHttpController.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/ThesaurusXmlHttpController.php @@ -1312,6 +1312,7 @@ class ThesaurusXmlHttpController extends Controller if (empty($lids)) { // no cterm was found continue; +<<<<<<< HEAD } $tsbas[$ksbas]['lid'] = "'" . implode("','", $lids) . "'"; @@ -1408,6 +1409,104 @@ class ThesaurusXmlHttpController extends Controller $databox->saveCterms($sbas['domct']); } } +======= + } + $tsbas[$ksbas]['lid'] = "'" . implode("','", $lids) . "'"; + + // count records + $sql = 'SELECT DISTINCT record_id AS r' + . ' FROM thit WHERE value IN (:lids)' + . ' ORDER BY record_id'; + $stmt = $connbas->prepare($sql); + $stmt->execute(['lids' => $lids]); + $tsbas[$ksbas]['trids'] = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0); + $stmt->closeCursor(); + + $ret['nRecsToUpdate'] += count($tsbas[$ksbas]['trids']); + } + + if ($ret['nRecsToUpdate'] <= self::SEARCH_REPLACE_MAXREC) { + foreach ($tsbas as $sbas) { + + try { + $databox = $this->findDataboxById($sbas['sbas_id']); + } catch (\Exception $e) { + continue; + } + + // fix caption of records + foreach ($sbas['trids'] as $rid) { + try { + $record = $databox->get_record($rid); + + $metadatask = []; // datas to keep + $metadatasd = []; // datas to delete + + /* @var $field caption_field */ + foreach ($record->get_caption()->get_fields(null, true) as $field) { + $meta_struct_id = $field->get_meta_struct_id(); + /* @var $v caption_Field_Value */ + $fname = $field->get_name(); + if (!array_key_exists($fname, $sbas['tvals'])) { + foreach ($field->get_values() as $v) { + $metadatask[] = [ + 'meta_struct_id' => $meta_struct_id, + 'meta_id' => $v->getId(), + 'value' => $v->getValue() + ]; + } + } else { + foreach ($field->get_values() as $v) { + $keep = true; + $vtxt = $this->getUnicode()->remove_indexer_chars($v->getValue()); + /** @var DOMElement $sy */ + foreach ($sbas['tvals'][$fname] as $sy) { + if ($sy->getAttribute('w') == $vtxt) { + $keep = false; + } + } + + if ($keep) { + $metadatask[] = [ + 'meta_struct_id' => $meta_struct_id, + 'meta_id' => $v->getId(), + 'value' => $v->getValue() + ]; + } else { + $metadatasd[] = [ + 'meta_struct_id' => $meta_struct_id, + 'meta_id' => $v->getId(), + 'value' => $request->get('t') ? $request->get('t') : '' + ]; + } + } + } + } + + if (count($metadatasd) > 0) { + if (!$request->get('debug')) { + $record->set_metadatas($metadatasd, true); + $ret['nRecsUpdated']++; + } + } + } catch (\Exception $e) { + continue; + } + } + + foreach ($sbas['tvals'] as $tval) { + foreach ($tval as $sy) { + // remove candidate from cterms + $te = $sy->parentNode; + $te->parentNode->removeChild($te); + $ret['ctermsDeleted'][] = $sbas['sbas_id'] . '.' . $te->getAttribute('id'); + } + } + if (!$request->get('debug')) { + $databox->saveCterms($sbas['domct']); + } + } +>>>>>>> origin/master $ret['msg'] = $this->app->trans('prod::thesaurusTab:dlg:%number% record(s) updated', ['%number%' => $ret['nRecsUpdated']]); } else { // too many records to update diff --git a/lib/Alchemy/Phrasea/Webhook/EventProcessorFactory.php b/lib/Alchemy/Phrasea/Webhook/EventProcessorFactory.php index a48cbdfd74..90edefc10c 100644 --- a/lib/Alchemy/Phrasea/Webhook/EventProcessorFactory.php +++ b/lib/Alchemy/Phrasea/Webhook/EventProcessorFactory.php @@ -9,6 +9,7 @@ use Alchemy\Phrasea\Webhook\Processor\CallableProcessorFactory; use Alchemy\Phrasea\Webhook\Processor\FeedEntryProcessorFactory; use Alchemy\Phrasea\Webhook\Processor\OrderNotificationProcessorFactory; use Alchemy\Phrasea\Webhook\Processor\ProcessorFactory; +use Alchemy\Phrasea\Webhook\Processor\ProcessorInterface; use Alchemy\Phrasea\Webhook\Processor\UserDeletedProcessorFactory; use Alchemy\Phrasea\Webhook\Processor\UserRegistrationProcessorFactory; diff --git a/lib/classes/databox/subdef.php b/lib/classes/databox/subdef.php index 1cac20b970..acc92c165c 100644 --- a/lib/classes/databox/subdef.php +++ b/lib/classes/databox/subdef.php @@ -121,6 +121,7 @@ class databox_subdef /** * Build Image Subdef object depending the SimpleXMLElement +<<<<<<< HEAD * * @param SimpleXMLElement $sd * @return Image @@ -236,6 +237,123 @@ class databox_subdef * Build Flexpaper Subdef object depending the SimpleXMLElement * * @param SimpleXMLElement $sd +======= + * + * @param SimpleXMLElement $sd + * @return Image + */ + protected function buildImageSubdef(SimpleXMLElement $sd) + { + $image = new Image($this->translator); + + if ($sd->icodec) { + $image->setOptionValue(Image::OPTION_ICODEC, (string) $sd->icodec); + } + if ($sd->size) { + $image->setOptionValue(Image::OPTION_SIZE, (int) $sd->size); + } + if ($sd->quality) { + $image->setOptionValue(Image::OPTION_QUALITY, (int) $sd->quality); + } + if ($sd->strip) { + $image->setOptionValue(Image::OPTION_STRIP, p4field::isyes($sd->strip)); + } + if ($sd->dpi) { + $image->setOptionValue(Image::OPTION_RESOLUTION, (int) $sd->dpi); + } + if ($sd->flatten) { + $image->setOptionValue(Image::OPTION_FLATTEN, p4field::isyes($sd->flatten)); + } + + return $image; + } + + /** + * Build Audio Subdef object depending the SimpleXMLElement + * + * @param SimpleXMLElement $sd + * @return Audio + */ + protected function buildAudioSubdef(SimpleXMLElement $sd) + { + $audio = new Audio($this->translator); + + if ($sd->acodec) { + $audio->setOptionValue(Audio::OPTION_ACODEC, (string) $sd->acodec); + } + if ($sd->audiobitrate) { + $audio->setOptionValue(Audio::OPTION_AUDIOBITRATE, (int) $sd->audiobitrate); + } + if ($sd->audiosamplerate) { + $audio->setOptionValue(Audio::OPTION_AUDIOSAMPLERATE, (int) $sd->audiosamplerate); + } + + return $audio; + } + + /** + * Build Video Subdef object depending the SimpleXMLElement + * + * @param SimpleXMLElement $sd + * @return Video + */ + protected function buildVideoSubdef(SimpleXMLElement $sd) + { + $video = new Video($this->translator); + + if ($sd->size) { + $video->setOptionValue(Video::OPTION_SIZE, (int) $sd->size); + } + if ($sd->acodec) { + $video->setOptionValue(Video::OPTION_ACODEC, (string) $sd->acodec); + } + if ($sd->vcodec) { + $video->setOptionValue(Video::OPTION_VCODEC, (string) $sd->vcodec); + } + if ($sd->fps) { + $video->setOptionValue(Video::OPTION_FRAMERATE, (int) $sd->fps); + } + if ($sd->bitrate) { + $video->setOptionValue(Video::OPTION_BITRATE, (int) $sd->bitrate); + } + if ($sd->audiobitrate) { + $video->setOptionValue(Video::OPTION_AUDIOBITRATE, (int) $sd->audiobitrate); + } + if ($sd->audiosamplerate) { + $video->setOptionValue(Video::OPTION_AUDIOSAMPLERATE, (int) $sd->audiosamplerate); + } + if ($sd->GOPsize) { + $video->setOptionValue(Video::OPTION_GOPSIZE, (int) $sd->GOPsize); + } + + return $video; + } + + /** + * Build GIF Subdef object depending the SimpleXMLElement + * + * @param SimpleXMLElement $sd + * @return Gif + */ + protected function buildGifSubdef(SimpleXMLElement $sd) + { + $gif = new Gif($this->translator); + + if ($sd->size) { + $gif->setOptionValue(Gif::OPTION_SIZE, (int) $sd->size); + } + if ($sd->delay) { + $gif->setOptionValue(Gif::OPTION_DELAY, (int) $sd->delay); + } + + return $gif; + } + + /** + * Build Flexpaper Subdef object depending the SimpleXMLElement + * + * @param SimpleXMLElement $sd +>>>>>>> origin/master * @return FlexPaper */ protected function buildFlexPaperSubdef(SimpleXMLElement $sd)