Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix committed Dec 20, 2023
1 parent 7d72143 commit c9fef92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Alchemy/Phrasea/Command/Record/BuildSubdefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output)
/** @var media_subdef $subdef */
$subdefsDeleted = [];
foreach ($record->get_subdefs() as $subdef) {
foreach ($record->get_subdefs_from_db() as $subdef) {
$name = $subdef->get_name();
if($name == "document") {
continue;
Expand Down Expand Up @@ -597,7 +597,7 @@ protected function getSQL()
$sql .= "GROUP BY r.`record_id`";

if(!$this->scheduled && !$this->all) {
$sql .= "\nHAVING `exists` != `waited`";
$sql .= "\nHAVING (`exists` IS NULL OR `exists` != `waited`)";
}

$sql .= "\nORDER BY r.`record_id` " . ($this->reverse ? "DESC" : "ASC");
Expand Down
13 changes: 13 additions & 0 deletions lib/classes/record/adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,19 @@ public function get_subdefs()
return $this->subdefs;
}

/**
* @return media_subdef[]
*/
public function get_subdefs_from_db()
{
$subdefs = [];
foreach ($this->getMediaSubdefRepository()->findByRecordIdsAndNames([$this->getRecordId()]) as $subdef) {
$subdefs[$subdef->get_name()] = $subdef;
}

return $subdefs;
}

/**
* @return string[]
*/
Expand Down

0 comments on commit c9fef92

Please sign in to comment.