diff --git a/Classes/Command/HealthCheckCommand.php b/Classes/Command/HealthCheckCommand.php
index 90bdbb8..a1515ba 100644
--- a/Classes/Command/HealthCheckCommand.php
+++ b/Classes/Command/HealthCheckCommand.php
@@ -155,6 +155,8 @@ protected function removeDoubleWorks(): void
$this->io->section('Removing double works');
$publishedItems = $this->publishedItemRepository->findAll();
$this->io->progressStart(count($publishedItems));
+
+ $works = [];
foreach ($publishedItems as $publishedItem) {
$this->io->progressAdvance();
foreach ($publishedItem->getContainedWorks() as $work) {
@@ -172,7 +174,11 @@ protected function removeDoubleWorks(): void
}
foreach ($publishedItem->getPublishedSubitems() as $publishedSubitem) {
foreach ($publishedSubitem->getContainedWorks() as $work) {
- if (isset($works[$work->getGndId()]) && $works[$work->getGndId()]->getUid() != $work->getUid()) {
+ if (
+ isset($works[$work->getGndId()]) &&
+ $works[$work->getGndId()]->getUid() != $work->getUid() &&
+ $work->getGndId() != 'lokal'
+ ) {
$publishedSubitem->removeContainedWork($work);
$publishedSubitem->addContainedWork($works[$work->getGndId()]);
$this->io->text('detected double ' . $work->getGndId() . ', ' . $work->getFullTitle() . '.');
@@ -258,6 +264,8 @@ protected function removeUnusedWorks(): void
{
$this->io->section('Removing unused works');
$publishedItems = $this->publishedItemRepository->findAll();
+
+ // check works linked in published items and subitems
foreach ($publishedItems as $publishedItem) {
foreach ($publishedItem->getContainedWorks() as $work) {
$works[$work->getUid()] = $work;
@@ -268,6 +276,21 @@ protected function removeUnusedWorks(): void
}
}
}
+
+ // check works linked as super works
+ while (true) {
+ $initialWorkCount = count($works);
+ foreach ($works as $work) {
+ if($work->getSuperWork() != null) {
+ $works[$work->getSuperWork()->getUid()] = $work->getSuperWork();
+ }
+ }
+ $newWorkCount = count($works);
+ if ($initialWorkCount == $newWorkCount) {
+ break;
+ }
+ }
+
$worksFromDb = $this->workRepository->findAll();
$this->io->progressStart(count($works));
foreach ($worksFromDb as $work) {
diff --git a/Classes/Command/IndexCommand.php b/Classes/Command/IndexCommand.php
index 42449a7..7ad57ae 100644
--- a/Classes/Command/IndexCommand.php
+++ b/Classes/Command/IndexCommand.php
@@ -4,6 +4,7 @@
use Elastic\Elasticsearch\Client;
use Illuminate\Support\Collection;
+use Illuminate\Support\Str;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -85,6 +86,7 @@ class IndexCommand extends Command
[ 'type', '', 'string' ],
[ 'mvdb_id', '', 'string' ],
[ 'piano_combination', '', 'string' ],
+ [ 'public_comment', 'comment', 'string' ],
[ 'final', '', '' ] ];
protected static $actionData = [
[ 'quantity', '', 'int' ],
@@ -787,16 +789,30 @@ protected function fetchObjects(): void
if ($name == 'published_item') {
$qb->where(
- $eb->notLike('mvdb_id', $qb->createNamedParameter('AA%'))
+ $eb->notLike('mvdb_id', $qb->createNamedParameter('AA%')),
+ $eb->eq('final', 2)
);
}
$data = $qb->execute()->fetchAll();
+ if ($name == 'person') {
+ $data = Collection::wrap($data)->
+ map(function ($person) { return self::removeSortingSymbols($person); });
+ }
$this->dataObjects[$name] = $data;
}
}
+ protected static function removeSortingSymbols(array $person): array
+ {
+ $name = Str::of($person['name'])->
+ replace('', '')->
+ replace('', '');
+ $person['name'] = $name;
+ return $person;
+ }
+
/**
* Executes an indexing sequence
*
@@ -861,7 +877,9 @@ protected function index(array $config, array $bufferedObject = null): array
foreach($mmObjects as $object) {
$subKey = $object[$subKeyField];
$superKey = $object[$superKeyField];
- $indexedObjects[$superKey][] = isset($subDataObjects[$subKey][0]) ? $subDataObjects[$subKey][0] : null;
+ if (isset($subDataObjects[$subKey][0])) {
+ $indexedObjects[$superKey][] = $subDataObjects[$subKey][0];
+ }
}
} else {
$subDataObjects = $bufferedObject ?? $this->dataObjects[$config['subObject']];
diff --git a/Classes/Domain/Model/PublishedItem.php b/Classes/Domain/Model/PublishedItem.php
index d1eb754..5165d13 100755
--- a/Classes/Domain/Model/PublishedItem.php
+++ b/Classes/Domain/Model/PublishedItem.php
@@ -179,6 +179,13 @@ class PublishedItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $comment = '';
+ /**
+ * publicComment
+ *
+ * @var string
+ */
+ protected $publicComment = '';
+
/**
* publisher
*
@@ -1009,6 +1016,16 @@ protected static function getSubitemPlateId(PublishedSubitem $subitem): string
return $subitem->getPlateId();
}
+ /**
+ * Returns the public comment
+ *
+ * @return string $publicComment
+ */
+ public function getPublicComment(): string
+ {
+ return $this->publicComment;
+ }
+
/**
* Returns the comment
*
@@ -1019,6 +1036,17 @@ public function getComment(): string
return $this->comment;
}
+ /**
+ * Sets the public comment
+ *
+ * @param string $publicComment
+ * @return void
+ */
+ public function setPublicComment(string $publicComment): void
+ {
+ $this->publicComment = $publicComment;
+ }
+
/**
* Sets the comment
*
diff --git a/Configuration/TCA/tx_mpdbcore_domain_model_publisheditem.php b/Configuration/TCA/tx_mpdbcore_domain_model_publisheditem.php
index deb287d..814302b 100755
--- a/Configuration/TCA/tx_mpdbcore_domain_model_publisheditem.php
+++ b/Configuration/TCA/tx_mpdbcore_domain_model_publisheditem.php
@@ -17,14 +17,14 @@
'starttime' => 'starttime',
'endtime' => 'endtime',
],
- 'searchFields' => 'title,type,instrumentation,responsible_person,language,id,comment',
+ 'searchFields' => 'title,type,instrumentation,responsible_person,language,id,comment,public_comment',
'iconfile' => 'EXT:mpdb_core/Resources/Public/Icons/tx_mpdbcore_domain_model_publishermakroitem.gif'
],
'interface' => [
- 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, type, instrumentation, data_acquisition_certain, related_persons_known, work_examined, data_set_manually_checked, contained_works_identified, responsible_person, date_of_publishing, final, language, id, comment, contained_works, editors, instruments, genre, first_composer, published_subitems, publisher',
+ 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, type, instrumentation, data_acquisition_certain, related_persons_known, work_examined, data_set_manually_checked, contained_works_identified, responsible_person, date_of_publishing, final, language, id, comment, public_comment, contained_works, editors, instruments, genre, first_composer, published_subitems, publisher',
],
'types' => [
- '1' => ['showitem' => 'title, type, instrumentation, data_acquisition_certain, related_persons_known, work_examined, data_set_manually_checked, contained_works_identified, responsible_person, date_of_publishing, final, language, id, comment, contained_works, editors, instruments, genre, first_composer, published_subitems, publisher, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, sys_language_uid, l10n_parent, l10n_diffsource, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime'],
+ '1' => ['showitem' => 'title, type, instrumentation, data_acquisition_certain, related_persons_known, work_examined, data_set_manually_checked, contained_works_identified, responsible_person, date_of_publishing, final, language, id, comment, public_comment, contained_works, editors, instruments, genre, first_composer, published_subitems, publisher, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, sys_language_uid, l10n_parent, l10n_diffsource, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime'],
],
'columns' => [
'sys_language_uid' => [
@@ -284,6 +284,16 @@
'eval' => 'trim'
]
],
+ 'public_comment' => [
+ 'exclude' => true,
+ 'label' => 'LLL:EXT:mpdb_core/Resources/Private/Language/locallang_db.xlf:tx_mpdbcore_domain_model_publisheditem.public_comment',
+ 'config' => [
+ 'type' => 'text',
+ 'cols' => 40,
+ 'rows' => 15,
+ 'eval' => 'trim'
+ ]
+ ],
'contained_works' => [
'exclude' => true,
'label' => 'enthaltene Werke',
diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf
index 8cb8009..583bb0d 100644
--- a/Resources/Private/Language/locallang_db.xlf
+++ b/Resources/Private/Language/locallang_db.xlf
@@ -60,6 +60,9 @@
+
+
+
diff --git a/composer.json b/composer.json
index da2a87f..77e77f1 100755
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,8 @@
"elasticsearch/elasticsearch": "^8",
"slub/dm-ont": "@dev",
"fluidtypo3/vhs": "^6",
- "illuminate/collections": "^8"
+ "illuminate/collections": "^8",
+ "illuminate/support": "^8"
},
"config": {
"allow-plugins": {
diff --git a/ext_tables.sql b/ext_tables.sql
index 0794a06..ee3f73b 100755
--- a/ext_tables.sql
+++ b/ext_tables.sql
@@ -26,7 +26,7 @@ CREATE TABLE tx_mpdbcore_domain_model_publishedsubitem (
db_identifier int(11) DEFAULT '0' NOT NULL,
contained_works int(11) unsigned DEFAULT '0' NOT NULL,
publisher_actions int(11) unsigned DEFAULT '0' NOT NULL,
- mvdb_id varchar(255) DEFAULT '' NOT NULL
+ mvdb_id varchar(255) DEFAULT '' NOT NULL
);
@@ -51,6 +51,7 @@ CREATE TABLE tx_mpdbcore_domain_model_publisheditem (
mvdb_id varchar(255) DEFAULT '' NOT NULL,
plate_ids varchar(255) DEFAULT '' NOT NULL,
comment text,
+ public_comment text,
contained_works int(11) unsigned DEFAULT '0' NOT NULL,
editors int(11) unsigned DEFAULT '0' NOT NULL,
instruments int(11) unsigned DEFAULT '0' NOT NULL,