Bugzilla – Attachment 189098 Details for
Bug 17387
Add an undelete feature for items/biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17387: add logging for biblio/item restore
Bug-17387-add-logging-for-biblioitem-restore.patch (text/plain), 5.93 KB, created by
Jacob O'Mara
on 2025-11-05 15:40:06 UTC
(
hide
)
Description:
Bug 17387: add logging for biblio/item restore
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2025-11-05 15:40:06 UTC
Size:
5.93 KB
patch
obsolete
>From 8399790f0bc938b117b392d05c054baed26f172d Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <Jacob.omara@openfifth.co.uk> >Date: Tue, 4 Nov 2025 18:02:57 +0000 >Subject: [PATCH] Bug 17387: add logging for biblio/item restore > >This adds RESTORE action for biblios and items to the action log >--- > Koha/Old/Biblio.pm | 5 +++++ > Koha/Old/Item.pm | 5 +++++ > koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc | 2 ++ > .../intranet-tmpl/prog/en/includes/biblio-view-menu.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt | 2 +- > 5 files changed, 14 insertions(+), 2 deletions(-) > >diff --git a/Koha/Old/Biblio.pm b/Koha/Old/Biblio.pm >index df6bd29c2ba..754f0b0316d 100644 >--- a/Koha/Old/Biblio.pm >+++ b/Koha/Old/Biblio.pm >@@ -19,6 +19,8 @@ use Modern::Perl; > > use base qw(Koha::Object); > >+use C4::Context; >+use C4::Log qw( logaction ); > use Koha::Database; > use Koha::Biblio; > use Koha::Biblioitem; >@@ -188,6 +190,9 @@ sub restore { > my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > $indexer->index_records( $new_biblio->biblionumber, "specialUpdate", "biblioserver" ); > >+ logaction( "CATALOGUING", "RESTORE", $new_biblio->biblionumber, "biblio", undef, $new_biblio ) >+ if C4::Context->preference("CataloguingLog"); >+ > return $new_biblio; > } > >diff --git a/Koha/Old/Item.pm b/Koha/Old/Item.pm >index 22371b7a09f..12b0a8b2ff8 100644 >--- a/Koha/Old/Item.pm >+++ b/Koha/Old/Item.pm >@@ -19,6 +19,8 @@ use Modern::Perl; > > use base qw(Koha::Object); > >+use C4::Context; >+use C4::Log qw( logaction ); > use Koha::Biblio; > use Koha::Biblios; > use Koha::Exceptions; >@@ -86,6 +88,9 @@ sub restore { > my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > $indexer->index_records( $new_item->biblionumber, "specialUpdate", "biblioserver" ); > >+ logaction( "CATALOGUING", "RESTORE", $new_item->itemnumber, "item", undef, $new_item ) >+ if C4::Context->preference("CataloguingLog"); >+ > return $new_item; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc >index b863662511d..c8dddde5850 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc >@@ -55,6 +55,8 @@ > <span>Delete</span> > [% CASE 'MODIFY' %] > <span>Modify</span> >+ [% CASE 'RESTORE' %] >+ <span>Restore</span> > [% CASE 'ISSUE' %] > <span>Checkout</span> > [% CASE 'RETURN' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc >index dd32ca07a2d..adb5d1c377e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc >@@ -81,7 +81,7 @@ > > [%- IF ( CAN_user_tools_view_system_logs ) -%] > <li [% IF logview %]class="active"[% END %]> >- <a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=CATALOGUING&action=MODIFY&object=[% biblio_object_id | url %]&object_type=biblio">Modification log</a> >+ <a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=CATALOGUING&actions=MODIFY&actions=RESTORE&object=[% biblio_object_id | url %]&object_type=biblio">Modification log</a> > </li> > [%- END -%] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >index 6e434a5c67f..1358e8bcc22 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -147,7 +147,7 @@ > <label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value="" /> All</label> > [% END %] > >- [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'MODCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'RESET PASS' 'Run' 'End' 'PATRON_MERGE' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'ACQUISITION CLAIM' 'ACQUISITION ORDER' 'OVERDUE' 'EXPIRE' 'CREATE_RESTRICTION' 'MODIFY_RESTRICTION' 'DELETE_RESTRICTION' 'MODIFY_CARDNUMBER' 'RESET 2FA' ] %] >+ [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'RESTORE' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'MODCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'RESET PASS' 'Run' 'End' 'PATRON_MERGE' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'ACQUISITION CLAIM' 'ACQUISITION ORDER' 'OVERDUE' 'EXPIRE' 'CREATE_RESTRICTION' 'MODIFY_RESTRICTION' 'DELETE_RESTRICTION' 'MODIFY_CARDNUMBER' 'RESET 2FA' ] %] > [% IF actions.grep(actx).size %] > <label for="action[% actx| replace('\s+', '_') | html %]" class="viewlog" > ><input type="checkbox" id="action[% actx | replace('\s+', '_') | html %]" name="actions" value="[% actx | html %]" checked="checked" /> [% PROCESS translate_log_action action=actx %]</label >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17387
:
188670
|
188671
|
188672
|
188673
|
188674
|
188675
|
188676
|
188677
|
188678
|
188679
|
188680
|
188681
|
188682
|
188683
|
188684
|
188685
|
188686
|
188687
|
188688
|
188689
|
188690
|
188691
|
188692
|
188693
|
188694
|
188695
|
188696
|
188697
|
188698
|
188699
|
188700
|
188701
|
188780
|
188781
|
188782
|
188783
|
188784
|
188785
|
188786
|
188787
|
188788
|
188789
|
188790
|
188791
|
188792
|
188793
|
188794
|
188795
|
189046
|
189047
|
189048
|
189049
|
189050
|
189051
|
189052
|
189053
|
189054
|
189055
|
189056
|
189057
|
189058
|
189059
|
189060
|
189061
|
189062
|
189082
|
189083
|
189084
|
189085
|
189086
|
189087
|
189088
|
189089
|
189090
|
189091
|
189092
|
189093
|
189094
|
189095
|
189096
|
189097
|
189098
|
189099
|
189100
|
189101
|
189102
|
189103
|
189104
|
189105
|
189106
|
189107
|
189108
|
189109
|
189110
|
189111
|
189112
|
189113
|
189114
|
189115
|
189116
|
189117
|
189118
|
189119