View | Details | Raw Unified | Return to bug 41730
Collapse All | Expand All

(-)a/Koha/Account/Line.pm (-2 / +11 lines)
Lines 667-684 sub apply { Link Here
667
                    && !( $self->credit_type_code eq 'LOST_FOUND' && $self->itemnumber == $debit->itemnumber ) )
667
                    && !( $self->credit_type_code eq 'LOST_FOUND' && $self->itemnumber == $debit->itemnumber ) )
668
                {
668
                {
669
669
670
                    my $item = $debit->item;
670
                    if ( C4::Context->preference('UpdateItemLostStatusWhenPaid')
671
                    if ( C4::Context->preference('UpdateItemLostStatusWhenPaid')
671
                        && !( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) )
672
                        && !( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) )
672
                    {
673
                    {
673
                        $debit->item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenPaid') )->store();
674
                        $item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenPaid') );
675
                    }
676
677
                    if ( C4::Context->preference('UpdateItemWithdrawnStatusWhenPaid')
678
                        && !( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) )
679
                    {
680
                        $item->withdrawn( C4::Context->preference('UpdateItemWithdrawnStatusWhenPaid') );
674
                    }
681
                    }
675
682
676
                    if ( C4::Context->preference('UpdateItemLostStatusWhenWriteOff')
683
                    if ( C4::Context->preference('UpdateItemLostStatusWhenWriteOff')
677
                        && ( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) )
684
                        && ( $self->credit_type_code eq 'WRITEOFF' || $self->credit_type_code eq 'VOID' ) )
678
                    {
685
                    {
679
                        $debit->item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenWriteOff') )->store();
686
                        $item->itemlost( C4::Context->preference('UpdateItemLostStatusWhenWriteOff') );
680
                    }
687
                    }
681
688
689
                    $item->store();
690
682
                    if ( C4::Context->preference('MarkLostItemsAsReturned') =~ m|onpayment| ) {
691
                    if ( C4::Context->preference('MarkLostItemsAsReturned') =~ m|onpayment| ) {
683
                        C4::Circulation::ReturnLostItem(
692
                        C4::Circulation::ReturnLostItem(
684
                            $self->borrowernumber,
693
                            $self->borrowernumber,
(-)a/installer/data/mysql/atomicupdate/bug_41730.pl (+21 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "41730",
6
    description => "Add UpdateItemWithdrawnStatusWhenPaid",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Do you stuffs here
12
        $dbh->do(
13
            q{
14
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
15
            ('UpdateItemWithdrawnStatusWhenPaid', '0', NULL, 'Allows the status of items to be automatically changed to withdrawn for when paid for', 'Integer'),
16
        }
17
        );
18
19
        say $out "Added new system preference 'UpdateItemWithdrawnStatusWhenPaid'";
20
    },
21
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 849-854 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
849
('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'),
849
('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'),
850
('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'),
850
('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'),
851
('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'),
851
('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'),
852
('UpdateItemWithdrawnStatusWhenPaid', '0', NULL, 'Allows the status of items to be automatically changed to withdrawn for when paid for', 'Integer'),
852
('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'),
853
('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'),
853
('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'),
854
('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'),
854
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
855
('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 634-639 Circulation: Link Here
634
              choices: authval
634
              choices: authval
635
              source: LOST
635
              source: LOST
636
            - "when the outstanding balance is paid."
636
            - "when the outstanding balance is paid."
637
        -
638
            - "Update item withdrawn status to"
639
            - pref: UpdateItemWithdrawnStatusWhenPaid
640
              choices: authval
641
              source: WITHDRAWN
642
            - "when the outstanding balance is paid."
637
        -
643
        -
638
            - "Update item status to"
644
            - "Update item status to"
639
            - pref: UpdateItemLostStatusWhenWriteoff
645
            - pref: UpdateItemLostStatusWhenWriteoff
640
- 

Return to bug 41730