Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity Log not updating for metadata changes #10019

Closed
salmanm2003 opened this issue Jun 5, 2024 · 8 comments
Closed

Activity Log not updating for metadata changes #10019

salmanm2003 opened this issue Jun 5, 2024 · 8 comments
Assignees
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Milestone

Comments

@salmanm2003
Copy link
Contributor

salmanm2003 commented Jun 5, 2024

Hi @asmecher,
Updating contributor metadata in OJS is only logged in the Activity Log if it pertains to the primary author. Changes to co-authors' details are not reflected in the Activity Log, even though they are updated in the UI. This omission results in hidden actions during audits and creates issues during the production process.

To Reproduce
1- go to publication > Contributors
2- edit/add a new contributor
3- check the Activity Log and there wont be any new logs
4- edit the primary author data and the log is going to be there

What application are you using?
OJS version 3-3-0_17

Additional information
https://forum.pkp.sfu.ca/t/activity-log-not-updating-for-metadata-changes/88324

Solution
I could fix it by editing this file:

if ($this->getData('primaryContact')) {

by adding:
https://github.com/ubiquitypress/pkp-lib/blob/ff6d4ccbef4bfb3e3d9c490af2289453fe434feb/controllers/grid/users/author/form/PKPAuthorForm.inc.php#L247-L265

If this properly fixes the issue, please let me know so I can send a PR.

PRs:
stable-3_3_0:

stable-3_4_0:

main:

@asmecher
Copy link
Member

asmecher commented Jun 5, 2024

@bozana, could you look at this one? Thanks!

@bozana
Copy link
Collaborator

bozana commented Jun 7, 2024

Hi @salmanm2003,
The editing of the primary contact by chance adds the entry in the activity log -- just because the attribute 'primaryContactId' is actually a publication attribute/parameter (and there is an entry in the activity log on editing a publication). For some reason we have not considered adding/editing/deleting authors for the activity log, and this can be changed, I think.
Long story short :-) :
Your changes are correct, and will also consider adding an author. But deleting an author is not considered. Would it be possible for you to also add this code:

// Log an event when publication data is updated
$submissionId = (int) $request->getUserVar('submissionId');
$submission = Services::get('submission')->get($submissionId);
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
SubmissionLog::logEvent(Application::get()->getRequest(), $submission, SUBMISSION_LOG_METADATA_UPDATE, 'submission.event.general.metadataUpdated');

here: https://github.com/pkp/pkp-lib/blob/stable-3_3_0/controllers/grid/users/author/AuthorGridHandler.inc.php#L394
when you make the PR? Else, I can add it...

Thanks a lot!

@bozana bozana added the Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. label Jun 7, 2024
@bozana bozana added this to the 3.3.0-18 milestone Jun 7, 2024
@salmanm2003
Copy link
Contributor Author

@bozana Thanks for the clarification. I can add it to deleting authors as well.

Additionally, there is one more thing that we can do that might help more. When adding, editing, or deleting contributor data, we can call publication->edit($params) where $params = []. This will notify us that the publication has been updated.

I understand this is more of a workaround than a bug fix, but it will address the logging issue and allow the plugins to recognize that the publication has been updated?

@bozana
Copy link
Collaborator

bozana commented Jun 14, 2024

Hi @salmanm2003, yes, that sound good! This will also change last_modified date for that publication.
Thanks a lot!

@salmanm2003
Copy link
Contributor Author

salmanm2003 commented Jun 19, 2024

Hi @bozana,
here is the PR: #10087

bozana added a commit that referenced this issue Jun 19, 2024
…ating_contributors_log

#10019 Activity Log not updating when modifying contributor
bozana added a commit to bozana/ojs that referenced this issue Jun 19, 2024
bozana added a commit to bozana/omp that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ops that referenced this issue Jun 19, 2024
bozana added a commit to bozana/pkp-lib that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ojs that referenced this issue Jun 19, 2024
bozana added a commit to bozana/omp that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ops that referenced this issue Jun 19, 2024
bozana added a commit to bozana/pkp-lib that referenced this issue Jun 19, 2024
bozana added a commit to pkp/omp that referenced this issue Jun 19, 2024
bozana added a commit to pkp/ops that referenced this issue Jun 19, 2024
bozana added a commit to pkp/ojs that referenced this issue Jun 19, 2024
bozana added a commit to bozana/pkp-lib that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ojs that referenced this issue Jun 19, 2024
bozana added a commit to bozana/omp that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ops that referenced this issue Jun 19, 2024
bozana added a commit to bozana/ojs that referenced this issue Jun 20, 2024
bozana added a commit to bozana/omp that referenced this issue Jun 20, 2024
bozana added a commit to bozana/ops that referenced this issue Jun 20, 2024
bozana added a commit to bozana/pkp-lib that referenced this issue Jun 21, 2024
bozana added a commit to bozana/ojs that referenced this issue Jun 21, 2024
bozana added a commit to bozana/omp that referenced this issue Jun 21, 2024
bozana added a commit to bozana/ops that referenced this issue Jun 21, 2024
bozana added a commit that referenced this issue Jun 21, 2024
#10019 Fix publication update when modifying contributor
bozana added a commit to pkp/ojs that referenced this issue Jun 21, 2024
pkp/pkp-lib#10019 submodule update ##bozana/10019-3_4_0##
bozana added a commit to pkp/omp that referenced this issue Jun 21, 2024
pkp/pkp-lib#10019 submodule update ##bozana/10019-3_4_0##
bozana added a commit to pkp/ops that referenced this issue Jun 21, 2024
pkp/pkp-lib#10019 submodule update ##bozana/10019-3_4_0##
bozana added a commit that referenced this issue Jun 21, 2024
#10019 Fix publication update when modifying contributor
@bozana
Copy link
Collaborator

bozana commented Jun 21, 2024

Hi @salmanm2003, I provided the submodule updates (they enable running the tests, and, especially for the stable branches, provide the right/coherent data for those installations using git), and ported the changes to stable-3_4_0 and main. Everything is merged now.
Thanks a lot for the contribution!

@bozana bozana closed this as completed Jun 21, 2024
@fradeve
Copy link

fradeve commented Jun 26, 2024

@bozana do you have any feeling of when 3.3.0-18 will be released? If I understand correctly, the work on this issue will be included in 3.3.0-18?
Thanks

@bozana
Copy link
Collaborator

bozana commented Jun 27, 2024

Hi @fradeve, we are planning the next release(s) for middle of July.
Yes, this should be included in the next release 3.3.0-18 (and 3.4.0.6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Projects
None yet
Development

No branches or pull requests

4 participants