Skip to content

Commit

Permalink
Merge pull request pkp#1863 from bozana/1692
Browse files Browse the repository at this point in the history
 pkp/pkp-lib#1692 fix (generalize) parameter names for pub id plugin functions
  • Loading branch information
bozana authored Mar 5, 2018
2 parents 102e6e1 + 05adf45 commit b2ba081
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
19 changes: 9 additions & 10 deletions classes/article/ArticleGalleyDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function getInsertId() {
/**
* @copydoc PKPPubIdPluginDAO::pubIdExists()
*/
function pubIdExists($pubIdType, $pubId, $galleyId, $journalId) {
function pubIdExists($pubIdType, $pubId, $excludePubObjectId, $contextId) {
$result = $this->retrieve(
'SELECT COUNT(*)
FROM submission_galley_settings sgs
Expand All @@ -385,8 +385,8 @@ function pubIdExists($pubIdType, $pubId, $galleyId, $journalId) {
array(
'pub-id::'.$pubIdType,
$pubId,
(int) $galleyId,
(int) $journalId
(int) $excludePubObjectId,
(int) $contextId
)
);
$returner = $result->fields[0] ? true : false;
Expand All @@ -397,12 +397,12 @@ function pubIdExists($pubIdType, $pubId, $galleyId, $journalId) {
/**
* @copydoc PKPPubIdPluginDAO::changePubId()
*/
function changePubId($galleyId, $pubIdType, $pubId) {
function changePubId($pubObjectId, $pubIdType, $pubId) {
$idFields = array(
'galley_id', 'locale', 'setting_name'
);
$updateArray = array(
'galley_id' => $galleyId,
'galley_id' => (int) $pubObjectId,
'locale' => '',
'setting_name' => 'pub-id::'.$pubIdType,
'setting_type' => 'string',
Expand All @@ -414,13 +414,13 @@ function changePubId($galleyId, $pubIdType, $pubId) {
/**
* @copydoc PKPPubIdPluginDAO::deletePubId()
*/
function deletePubId($galleyId, $pubIdType) {
function deletePubId($pubObjectId, $pubIdType) {
$settingName = 'pub-id::'.$pubIdType;
$this->update(
'DELETE FROM submission_galley_settings WHERE setting_name = ? AND galley_id = ?',
array(
$settingName,
(int)$galleyId
(int)$pubObjectId
)
);
$this->flushCache();
Expand All @@ -429,11 +429,10 @@ function deletePubId($galleyId, $pubIdType) {
/**
* @copydoc PKPPubIdPluginDAO::deleteAllPubIds()
*/
function deleteAllPubIds($journalId, $pubIdType) {
$journalId = (int) $journalId;
function deleteAllPubIds($contextId, $pubIdType) {
$settingName = 'pub-id::'.$pubIdType;

$galleys = $this->getByContextId($journalId);
$galleys = $this->getByContextId($contextId);
while ($galley = $galleys->next()) {
$this->update(
'DELETE FROM submission_galley_settings WHERE setting_name = ? AND galley_id = ?',
Expand Down
19 changes: 9 additions & 10 deletions classes/issue/IssueDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ function moveCustomIssueOrder($journalId, $issueId, $newPos) {
/**
* @copydoc PKPPubIdPluginDAO::pubIdExists()
*/
function pubIdExists($pubIdType, $pubId, $issueId, $journalId) {
function pubIdExists($pubIdType, $pubId, $excludePubObjectId, $contextId) {
$result = $this->retrieve(
'SELECT COUNT(*)
FROM issue_settings ist
Expand All @@ -801,8 +801,8 @@ function pubIdExists($pubIdType, $pubId, $issueId, $journalId) {
array(
'pub-id::'.$pubIdType,
$pubId,
(int) $issueId,
(int) $journalId
(int) $excludePubObjectId,
(int) $contextId
)
);
$returner = $result->fields[0] ? true : false;
Expand All @@ -813,12 +813,12 @@ function pubIdExists($pubIdType, $pubId, $issueId, $journalId) {
/**
* @copydoc PKPPubIdPluginDAO::changePubId()
*/
function changePubId($issueId, $pubIdType, $pubId) {
function changePubId($pubObjectId, $pubIdType, $pubId) {
$idFields = array(
'issue_id', 'locale', 'setting_name'
);
$updateArray = array(
'issue_id' => (int) $issueId,
'issue_id' => (int) $pubObjectId,
'locale' => '',
'setting_name' => 'pub-id::'.$pubIdType,
'setting_type' => 'string',
Expand All @@ -831,13 +831,13 @@ function changePubId($issueId, $pubIdType, $pubId) {
/**
* @copydoc PKPPubIdPluginDAO::deletePubId()
*/
function deletePubId($issueId, $pubIdType) {
function deletePubId($pubObjectId, $pubIdType) {
$settingName = 'pub-id::'.$pubIdType;
$this->update(
'DELETE FROM issue_settings WHERE setting_name = ? AND issue_id = ?',
array(
$settingName,
(int)$issueId
(int)$pubObjectId
)
);
$this->flushCache();
Expand All @@ -846,12 +846,11 @@ function deletePubId($issueId, $pubIdType) {
/**
* @copydoc PKPPubIdPluginDAO::deleteAllPubIds()
*/
function deleteAllPubIds($journalId, $pubIdType) {
$journalId = (int) $journalId;
function deleteAllPubIds($contextId, $pubIdType) {
$settingName = 'pub-id::'.$pubIdType;

// issues
$issues = $this->getIssues($journalId);
$issues = $this->getIssues($contextId);
while ($issue = $issues->next()) {
$this->update(
'DELETE FROM issue_settings WHERE setting_name = ? AND issue_id = ?',
Expand Down

0 comments on commit b2ba081

Please sign in to comment.