Bugzilla – Attachment 192137 Details for
Bug 41730
Automate change Withdrawn status when item is paid for
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41730: Add ability to update item withdrawn status when lost item paid
Bug-41730-Add-ability-to-update-item-withdrawn-sta.patch (text/plain), 7.10 KB, created by
Nick Clemens (kidclamp)
on 2026-01-28 21:16:54 UTC
(
hide
)
Description:
Bug 41730: Add ability to update item withdrawn status when lost item paid
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2026-01-28 21:16:54 UTC
Size:
7.10 KB
patch
obsolete
>From 5a02de93e911ab631468e431553f93a2cf20e7fe Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 28 Jan 2026 21:06:11 +0000 >Subject: [PATCH] Bug 41730: Add ability to update item withdrawn status when > lost item paid > >This patch implements a new system preference, "UpdateItemWithdrawnStatusWhenPaid" that allows you to specify the withdrawn status to change an item to when the outstanding balance of a lost item is paid. This preference is tied to the WITHDRAWN authorised values set. > >Test Plan: > - Set one the system preference to any of the available values > - Set an item as lost > - Make a manual invoice for your desired user and assign it to the barcode of the above item > - Save and Pay > - Select Pay > - Pay > - Note that the withdrawn status of the item has changed to the status you set with the system preference > - Check that when the system preference is left blank and no option is chosen, the withdrawn status does not update. >--- > Koha/Account/Line.pm | 13 ++++++++++-- > .../data/mysql/atomicupdate/bug_41730.pl | 21 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 6 ++++++ > 4 files changed, 39 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_41730.pl > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index f44761fcf48..0efdbb7e253 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -667,18 +667,27 @@ sub apply { > && !( $self->credit_type_code eq 'LOST_FOUND' && $self->itemnumber == $debit->itemnumber ) ) > { > >+ my $item = $debit->item; > if ( C4::Context->preference('UpdateItemLostStatusWhenPaid') > && !( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) ) > { >- $debit->item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenPaid') )->store(); >+ $item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenPaid') ); >+ } >+ >+ if ( C4::Context->preference('UpdateItemWithdrawnStatusWhenPaid') >+ && !( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) ) >+ { >+ $item->withdrawn( C4::Context->preference('UpdateItemWithdrawnStatusWhenPaid') ); > } > > if ( C4::Context->preference('UpdateItemLostStatusWhenWriteOff') > && ( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) ) > { >- $debit->item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenWriteOff') )->store(); >+ $item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenWriteOff') ); > } > >+ $item->store(); >+ > if ( C4::Context->preference('MarkLostItemsAsReturned') =~ m|onpayment| ) { > C4::Circulation::ReturnLostItem( > $self->borrowernumber, >diff --git a/installer/data/mysql/atomicupdate/bug_41730.pl b/installer/data/mysql/atomicupdate/bug_41730.pl >new file mode 100755 >index 00000000000..d0bc5c9d239 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_41730.pl >@@ -0,0 +1,21 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "41730", >+ description => "Add UpdateItemWithdrawnStatusWhenPaid", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('UpdateItemWithdrawnStatusWhenPaid', '0', NULL, 'Allows the status of items to be automatically changed to withdrawn for when paid for', 'Integer'), >+ } >+ ); >+ >+ say $out "Added new system preference 'UpdateItemWithdrawnStatusWhenPaid'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 2476391b835..ae31d7171c4 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -849,6 +849,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'), > ('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'), > ('UpdateItemWhenLostFromHoldList','',NULL,'This is a list of values to update an item when it is marked as lost from the holds to pull screen','Free'), >+('UpdateItemWithdrawnStatusWhenPaid', '0', NULL, 'Allows the status of items to be automatically changed to withdrawn for when paid for', 'Integer'), > ('UpdateNotForLoanStatusOnCheckin', '', NULL, 'This is a list of item types and value pairs.\nExamples:\n_ALL_:\n -1: 0\n\nCR:\n 1: 0\n\nWhen an item is checked in, if its item type matches CR then when the value on the left (1) matches the items not for loan value it will be updated to the value on the right.\n\nThe special term _ALL_ is used on the left side of the colon (:) to affect all item types. This does not override all other rules\n\nEach item type needs to be defined on a separate line on the left side of the colon (:).\nEach pair of not for loan values, for that item type, should be listed on separate lines below the item type, each indented by a leading space.', 'Free'), > ('UpdateNotForLoanStatusOnCheckout', '', NULL, 'This is a list of value pairs. When an item is checked out, if its not for loan value matches the value on the left, then the items not for loan value will be updated to the value on the right. \nE.g. \'-1: 0\' will cause an item that was set to \'Ordered\' to now be available for loan. Each pair of values should be on a separate line.', 'Free'), > ('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 00e764062dc..8a2c92822fc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -634,6 +634,12 @@ Circulation: > choices: authval > source: LOST > - "when the outstanding balance is paid." >+ - >+ - "Update item withdrawn status to" >+ - pref: UpdateItemWithdrawnStatusWhenPaid >+ choices: authval >+ source: WITHDRAWN >+ - "when the outstanding balance is paid." > - > - "Update item status to" > - pref: UpdateItemLostStatusWhenWriteoff >-- >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 41730
: 192137 |
192138