|
diff --git a/core/components/com_publications/models/blocks/authors.php b/core/components/com_publications/models/blocks/authors.php
index 83c36b9ceec..880f1990589 100644
--- a/core/components/com_publications/models/blocks/authors.php
+++ b/core/components/com_publications/models/blocks/authors.php
@@ -342,9 +342,10 @@ public function addItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0)
$config = Component::params('com_publications');
$emailConfig = $config->get('email');
- $email = Request::getString('email', '', 'post');
+ $email = trim(Request::getString('email', '', 'post'));
$firstName = trim(Request::getString('firstName', '', 'post'));
$lastName = trim(Request::getString('lastName', '', 'post'));
+ $dept = trim(Request::getString('department', '', 'post'));
$org = trim(Request::getString('organization', '', 'post'));
$orcid = trim(Request::getString('orcid', '', 'post'));
$credit = trim(Request::getString('credit', '', 'post'));
@@ -465,6 +466,7 @@ public function addItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0)
$pAuthor->name = $name;
$pAuthor->firstName = $firstName;
$pAuthor->lastName = $lastName;
+ $pAuthor->department = $dept;
$pAuthor->organization = $org;
$pAuthor->orcid = $orcid;
diff --git a/core/components/com_publications/tables/author.php b/core/components/com_publications/tables/author.php
index a88c4d4415e..c6c39e36b06 100644
--- a/core/components/com_publications/tables/author.php
+++ b/core/components/com_publications/tables/author.php
@@ -312,7 +312,7 @@ public function getAuthors($vid = null, $get_uids = 0, $active = 1, $return_uid_
$res->surname = $user->get('surname');
$res->p_email = $user->get('email');
- if (!empty($user->get('orcid')))
+ if (empty($res->orcid) && !empty($user->get('orcid')))
{
$res->orcid = $user->get('orcid');
}
@@ -688,16 +688,85 @@ public function getAuthorByOwnerId($vid = null, $owner_id = 0)
if (!empty($result->user_id))
{
$user = \Components\Members\Models\Member::oneOrNew($result->user_id);
- $result->p_name = $user->get('name');
$result->username = $user->get('username');
+ $result->p_name = $user->get('name');
+ $result->givenName = $user->get('givenName');
+ $result->surname = $user->get('surname');
+ $result->p_email = $user->get('email');
$result->p_organization = $user->get('organization');
$result->picture = $user->picture(0, false);
+
+ if (empty($result->orcid) && !empty($user->get('orcid')))
+ {
+ $result->orcid = $user->get('orcid');
+ }
+
+ if (empty($result->organization) && !empty($user->get('organization')))
+ {
+ $result->organization = $user->get('organization');
+ }
+
+ if (empty($result->orgid) && !empty($user->get('orgid')))
+ {
+ $result->orgid = $user->get('orgid');
+ }
+ }
+ else
+ {
+ $result->p_name = $result->username = $result->p_organization = $result->picture = $result->givenName = $result->surname = $result->p_email = null;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Get record by author ID
+ *
+ * @param integer $id Author ID
+ * @return mixed False if error, Object on success
+ */
+ public function getAuthorById($id = 0)
+ {
+ if (!$id)
+ {
+ return false;
+ }
+ $query = "SELECT A.*, po.invited_email, po.invited_name";
+ $query .= " FROM #__project_owners as po ";
+ $query .= " LEFT JOIN $this->_tbl as A ON po.id=A.project_owner_id";
+ $query .= " AND A.status=1 ";
+ $query .= " WHERE A.id=" . $this->_db->quote($id);
+ $query .= " AND (A.role IS NULL OR A.role != 'submitter') ";
+ $query .= " LIMIT 1 ";
+
+ $this->_db->setQuery($query);
+ $result = $this->_db->loadObject();
+
+ if (!empty($result->user_id))
+ {
+ $user = \Components\Members\Models\Member::oneOrNew($result->user_id);
+ $result->username = $user->get('username');
+ $result->p_name = $user->get('name');
$result->givenName = $user->get('givenName');
$result->surname = $user->get('surname');
- $result->orcid = $user->get('orcid');
$result->p_email = $user->get('email');
- $result->organization = $user->get('organization');
- $result->orgid = $user->get('orgid');
+ $result->p_organization = $user->get('organization');
+ $result->picture = $user->picture(0, false);
+
+ if (empty($result->orcid) && !empty($user->get('orcid')))
+ {
+ $result->orcid = $user->get('orcid');
+ }
+
+ if (empty($result->organization) && !empty($user->get('organization')))
+ {
+ $result->organization = $user->get('organization');
+ }
+
+ if (empty($result->orgid) && !empty($user->get('orgid')))
+ {
+ $result->orgid = $user->get('orgid');
+ }
}
else
{
diff --git a/core/plugins/projects/publications/language/en-GB/en-GB.plg_projects_publications.ini b/core/plugins/projects/publications/language/en-GB/en-GB.plg_projects_publications.ini
index e76d40f51e6..9257b1d4c13 100644
--- a/core/plugins/projects/publications/language/en-GB/en-GB.plg_projects_publications.ini
+++ b/core/plugins/projects/publications/language/en-GB/en-GB.plg_projects_publications.ini
@@ -769,6 +769,7 @@ PLG_PROJECTS_PUBLICATIONS_AUTHOR_REMOVED="Author has been removed."
PLG_PROJECTS_PUBLICATIONS_AUTHORS_SELECT_AUTHORS="Select authors from your project team:"
PLG_PROJECTS_PUBLICATIONS_AUTHORS_NONE_SELECTED="No authors selected. Click on names on the left to add."
PLG_PROJECTS_PUBLICATIONS_PUBLICATION_AUTHORS="Publication Authors"
+PLG_PROJECTS_PUBLICATIONS_PUBLICATION_AUTHORS_AS_CONTACT="Edit the author to set the department, organization and email if the author is going to be selected as the contact in the review stage"
PLG_PROJECTS_PUBLICATIONS_AUTHORS_MISSING="member not active"
PLG_PROJECTS_PUBLICATIONS_PUB_INFO_AUTHORS_MISSING="One or several listed authors appear to have been removed from your project team. While it is OK to proceed with publication when its authors aren't your active team members, these authors will not be able to edit or may not have access to the publication."
PLG_PROJECTS_PUBLICATIONS_AUTHORS_EDIT="Edit"
diff --git a/core/plugins/projects/publications/publications.php b/core/plugins/projects/publications/publications.php
index 15041648c93..2cadbd012f5 100644
--- a/core/plugins/projects/publications/publications.php
+++ b/core/plugins/projects/publications/publications.php
@@ -2091,7 +2091,7 @@ public function publishDraft()
continue;
}
- // Prompt error message if an invited author is chosen as contact but the email address is empty
+ // Prompt error message if an invited author is chosen as contact but the department, organization, or email address is empty
$owner = $author->getAuthorByOwnerId($pub->version->id, $author->project_owner_id);
if ((empty($owner->user_id) && empty($owner->invited_email)) || empty($owner->department) || empty($owner->organization))
@@ -2122,7 +2122,7 @@ public function publishDraft()
}
elseif (!(empty($owner->user_id) && empty($owner->invited_email)) && !empty($owner->department) && empty($owner->organization))
{
- Notify::error(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_ERROR_CONTACT_ORGANIZATION_MISSING'), 'projects');
+ Notify::error(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_ERROR_CONTACT_INSTITUTION_MISSING'), 'projects');
}
App::redirect(Route::url($pub->link('editversion') . '&action=' . $this->_task));
diff --git a/core/plugins/projects/publications/views/draft/tmpl/authors.php b/core/plugins/projects/publications/views/draft/tmpl/authors.php
index 113e565510d..b8cf2d16aa7 100644
--- a/core/plugins/projects/publications/views/draft/tmpl/authors.php
+++ b/core/plugins/projects/publications/views/draft/tmpl/authors.php
@@ -83,6 +83,10 @@
+
+ pub->authors()) > 0) { ?>
+ *
+
pub->authors()) > 1) { ?>
*
diff --git a/core/plugins/projects/publications/views/freeze/tmpl/authors.php b/core/plugins/projects/publications/views/freeze/tmpl/authors.php
index 76ee31e4b61..952427f6ea1 100644
--- a/core/plugins/projects/publications/views/freeze/tmpl/authors.php
+++ b/core/plugins/projects/publications/views/freeze/tmpl/authors.php
@@ -27,7 +27,9 @@
$i= 1;
foreach ($this->pub->_authors as $author)
{
+ $dept = $author->department;
$org = $author->organization ? $author->organization : $author->p_organization;
+ $email = $author->p_email ? $author->p_email : $author->invited_email;
$name = $author->name ? $author->name : $author->p_name;
$name = trim($name) ? $name : $author->invited_name;
$name = trim($name) ? $name : $author->invited_email;
@@ -39,7 +41,13 @@
?>
-
+
+ repository_contact == 1 && !empty($dept) && !empty($org) && !empty($email)) { ?>
+
+
+
+
+
*:
+
+
+
|