Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
added article status check
Browse files Browse the repository at this point in the history
  • Loading branch information
yazbahar committed Jan 18, 2017
1 parent 00e052f commit 044f465
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Ojs/OAIBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ public function getRecordAction(Request $request)
$qb->expr()->eq("a.id",":id")
)
->setParameter("id",$id);
$qb->andWhere(
$qb->expr()->eq("a.status",ArticleStatuses::STATUS_PUBLISHED)
);
$data['record'] = $qb->getQuery()->getOneOrNullResult();
if(!$data['record']){
throw new NotFoundHttpException("Record not found");
Expand Down
4 changes: 3 additions & 1 deletion src/Ojs/OAIBundle/Controller/JournalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ public function listIdentifierAction(Request $request)
$builder = $em->createQueryBuilder();
$builder->select('article')->from('OjsJournalBundle:Article', 'article');
$builder->join('article.journal', 'journal', 'WITH');
$builder->where($builder->expr()->eq('journal.slug', ':slug'))->setParameter('slug', $slug);
$builder->where($builder->expr()->eq('article.status', ArticleStatuses::STATUS_PUBLISHED));
$builder->andWhere($builder->expr()->eq('journal.slug', ':slug'))->setParameter('slug', $slug);

$data = ['records' => $builder->getQuery()->getResult()];

Expand Down Expand Up @@ -187,6 +188,7 @@ public function getRecordAction(Request $request)
$builder = $em->createQueryBuilder();
$builder->select("article")->from("OjsJournalBundle:Article", "article");
$builder->where($builder->expr()->eq("article.id", ":id"))->setParameter("id", $matches[4][0]);
$builder->andWhere($builder->expr()->eq('article.status', ArticleStatuses::STATUS_PUBLISHED));

$data = [];
$data['metadataPrefix'] = $request->get('metadataPrefix', 'oai_dc');
Expand Down

0 comments on commit 044f465

Please sign in to comment.