Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 5 additions & 53 deletions core/components/com_publications/models/blocks/citations.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,7 @@ public function buildContent($pub = null, $viewname = 'edit')
\Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'selector');
\Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');

if (!isset($pub->_citations))
{
// Get citations for this publication
$cc = \Components\Citations\Models\Citation::all();

$a = \Components\Citations\Models\Association::blank()->getTableName();
$c = $cc->getTableName();

$pub->_citations = $cc
->join($a, $a . '.cid', $c . '.id', 'inner')
->whereEquals($c . '.published', 1)
->whereEquals($a . '.tbl', 'publication')
->whereEquals($a . '.oid', $pub->id)
->order($c . '.affiliated', 'asc')
->order($c . '.year', 'desc')
->rows();
}
$pub->getCitations();

$view->pub = $pub;
$view->manifest = $this->_manifest;
Expand Down Expand Up @@ -193,23 +177,7 @@ public function save($manifest = null, $blockId = 0, $pub = null, $actor = 0, $e
return false;
}

if (!isset($pub->_citations))
{
// Get citations for this publication
$cc = \Components\Citations\Models\Citation::all();

$a = \Components\Citations\Models\Association::blank()->getTableName();
$c = $cc->getTableName();

$pub->_citations = $cc
->join($a, $a . '.cid', $c . '.id', 'inner')
->whereEquals($c . '.published', 1)
->whereEquals($a . '.tbl', 'publication')
->whereEquals($a . '.oid', $pub->id)
->order($c . '.affiliated', 'asc')
->order($c . '.year', 'desc')
->rows();
}
$pub->getCitations();

// Incoming
$url = Request::getString('citation-doi', '');
Expand All @@ -225,7 +193,7 @@ public function save($manifest = null, $blockId = 0, $pub = null, $actor = 0, $e

// Plugin params
$plugin_params = array(
$pub->id,
$pub->version->id,
$doi,
$citationFormat,
$actor,
Expand Down Expand Up @@ -349,7 +317,7 @@ public function deleteItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0

// Plugin params
$plugin_params = array(
$pub->id,
$pub->version->id,
$cid,
true
);
Expand Down Expand Up @@ -395,23 +363,7 @@ public function getStatus($pub = null, $manifest = null, $elementId = null)
{
$status = new \Components\Publications\Models\Status();

if (!isset($pub->_citations))
{
// Get citations for this publication
$cc = \Components\Citations\Models\Citation::all();

$a = \Components\Citations\Models\Association::blank()->getTableName();
$c = $cc->getTableName();

$pub->_citations = $cc
->join($a, $a . '.cid', $c . '.id', 'inner')
->whereEquals($c . '.published', 1)
->whereEquals($a . '.tbl', 'publication')
->whereEquals($a . '.oid', $pub->id)
->order($c . '.affiliated', 'asc')
->order($c . '.year', 'desc')
->rows();
}
$pub->getCitations();

// Required?
$required = $manifest->params->required;
Expand Down
2 changes: 1 addition & 1 deletion core/components/com_publications/models/publication.php
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ public function getCitations()
->join($a, $a . '.cid', $c . '.id', 'inner')
->whereEquals($c . '.published', self::STATE_PUBLISHED)
->whereEquals($a . '.tbl', 'publication')
->whereEquals($a . '.oid', $this->get('id'))
->whereEquals($a . '.oid', $this->version->id)
->order($c . '.affiliated', 'asc')
->order($c . '.year', 'desc')
->rows();
Expand Down