Bug 35597: logaction when modifying or deleteing suggestions
To test: 1. Apply patch, restart services, updatedatabase 2. Search for the system preference 'SuggestionsLog', it should be off. Turn it on. 3. Create a purhase suggestion 4. Go to Tools > Log viewer. In modules check 'Suggestions' 5. You should see your newly created suggestion. 6. Modify the suggestion and check the logs again, the modification should be logged. 7. Delete the suggestion, the deletion should be logged. 8. Do a purchase suggestion via the OPAC. 9. Check the logs to see the newly created suggestion, the interface should be OPAC. 10. Turn of SuggestionsLog 11. No changes of any kind should be logged. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Ray Delahunty <lib-systems@arts.ac.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
540ec4f6dc
commit
7e658ecbc0
|
|
@ -27,6 +27,7 @@ use C4::Letters;
|
|||
use C4::Biblio qw( GetMarcFromKohaField );
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
use Koha::Suggestions;
|
||||
use C4::Log qw(logaction);
|
||||
|
||||
use base qw(Exporter);
|
||||
|
||||
|
|
@ -290,6 +291,9 @@ sub ModSuggestion {
|
|||
) or warn "can't enqueue letter $letter";
|
||||
}
|
||||
}
|
||||
if (C4::Context->preference("SuggestionsLog")) {
|
||||
logaction('SUGGESTION', 'MODIFY', $suggestion->{suggestionid}, $suggestion_object );
|
||||
}
|
||||
return 1; # No useful if the exception is raised earlier
|
||||
}
|
||||
|
||||
|
|
@ -343,6 +347,9 @@ sub DelSuggestion {
|
|||
};
|
||||
$sth = $dbh->prepare($queryDelete);
|
||||
my $suggestiondeleted = $sth->execute($suggestionid);
|
||||
if (C4::Context->preference("SuggestionsLog")) {
|
||||
logaction('SUGGESTION', 'DELETE', $suggestionid, '' );
|
||||
}
|
||||
return $suggestiondeleted;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use Koha::DateUtils qw( dt_from_string );
|
|||
use Koha::Patrons;
|
||||
use Koha::AuthorisedValues;
|
||||
use Koha::Exceptions::Suggestion;
|
||||
use C4::Log qw(logaction);
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
|
|
@ -111,7 +112,9 @@ sub store {
|
|||
) or warn "can't enqueue letter $letter";
|
||||
}
|
||||
}
|
||||
|
||||
if (C4::Context->preference("NewsLog")) {
|
||||
logaction('SUGGESTION', 'CREATE', $result->suggestionid, '' );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "35597",
|
||||
description => "Add SuggestionsLog system preference ",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
# sysprefs
|
||||
$dbh->do(
|
||||
q{
|
||||
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
|
||||
VALUES ('SuggestionsLog', '0', 'If enabled, log purchase suggestion changes', '' , 'YesNo')
|
||||
}
|
||||
);
|
||||
say $out "Added new system preference 'SuggestionsLog'";
|
||||
},
|
||||
};
|
||||
|
|
@ -755,6 +755,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
|
|||
('SubscriptionLog','1',NULL,'If ON, enables subscriptions log','YesNo'),
|
||||
('suggestion','1','','If ON, enables patron suggestions feature in OPAC','YesNo'),
|
||||
('suggestionPatronCategoryExceptions', '', '', 'List the patron categories not affected by suggestion system preference if on', 'Free'),
|
||||
('SuggestionsLog','0',NULL,'If ON, log pirchase suggestion changes','YesNo'),
|
||||
('SuspendHoldsIntranet','1','Allow holds to be suspended from the intranet.',NULL,'YesNo'),
|
||||
('SuspendHoldsOpac','1','Allow holds to be suspended from the OPAC.',NULL,'YesNo'),
|
||||
('SuspensionsCalendar','noSuspensionsWhenClosed','ignoreCalendar|noSuspensionsWhenClosed','Specify whether to use the Calendar in calculating suspension expiration','Choice'),
|
||||
|
|
|
|||
|
|
@ -114,6 +114,12 @@ Logging:
|
|||
1: Log
|
||||
0: "Don't log"
|
||||
- any actions on recalls (create, cancel, expire, fulfill).
|
||||
-
|
||||
- pref: SuggestionsLog
|
||||
choices:
|
||||
1: Log
|
||||
0: "Don't log"
|
||||
- any changes to purchase suggestions (create, modify, delete ).
|
||||
|
||||
Debugging:
|
||||
-
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
[% CASE 'NOTICES' %]<span>Notices</span>[% UNLESS Koha.Preference('NoticesLog') %] <i class="fa-solid fa-triangle-exclamation" title="Log not enabled"></i>[% END %]
|
||||
[% CASE 'NEWS' %]<span>News</span>[% UNLESS Koha.Preference('NewsLog') %] <i class="fa-solid fa-triangle-exclamation" title="Log not enabled"></i>[% END %]
|
||||
[% CASE 'RECALLS' %]<span>Recalls</span>[% UNLESS Koha.Preference('RecallsLog') %] <i class="fa-solid fa-triangle-exclamation" title="Log not enabled"></i>[% END %]
|
||||
[% CASE 'SUGGESTION' %]<span>Suggestions</span>[% UNLESS Koha.Preference('SuggestionsLog') %] <i class="fa-solid fa-triangle-exclamation" title="Log not enabled"></i>[% END %]
|
||||
|
||||
[% CASE %][% module | html %]
|
||||
[% END %]
|
||||
|
|
@ -221,7 +222,7 @@
|
|||
[% ELSE %]
|
||||
<label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
|
||||
[% END %]
|
||||
[% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'CLAIMS' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE', 'NOTICES', 'NEWS', 'RECALLS' ] %]
|
||||
[% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'CLAIMS' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE', 'NOTICES', 'NEWS', 'RECALLS', 'SUGGESTION' ] %]
|
||||
[% IF modules.grep(modx).size %]
|
||||
<label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]" checked="checked"> [% PROCESS translate_log_module module=modx %]</label>
|
||||
[% ELSE %]
|
||||
|
|
@ -387,6 +388,8 @@
|
|||
[% ELSE %]
|
||||
Basket [% loopro.object | html %]
|
||||
[% END %]
|
||||
[% ELSIF ( loopro.module == "SUGGESTION" ) %]
|
||||
<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loopro.object | uri %]&op=show">[% loopro.object | html %]</a>
|
||||
[% ELSE %]
|
||||
[% loopro.object | html %]
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue