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

(-)a/C4/Circulation.pm (+4 lines)
Lines 858-868 sub CanBookBeIssued { Link Here
858
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
858
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
859
            $issuingimpossible{branch_to_return} = $message;
859
            $issuingimpossible{branch_to_return} = $message;
860
        } else {
860
        } else {
861
            if ( C4::Context->preference('AutoReturnCheckedOutItems') ) {
862
                $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron };
863
            } else {
861
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
864
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
862
            $needsconfirmation{issued_firstname} = $patron->firstname;
865
            $needsconfirmation{issued_firstname} = $patron->firstname;
863
            $needsconfirmation{issued_surname} = $patron->surname;
866
            $needsconfirmation{issued_surname} = $patron->surname;
864
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
867
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
865
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
868
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
869
            }
866
        }
870
        }
867
    }
871
    }
868
872
(-)a/installer/data/mysql/atomicupdate/bug_17171.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES
5
        ('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo');
6
    });
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 17171 - Add a syspref to allow currently issued items to be issued to a new patron without staff confirmation)\n";
10
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 65-70 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
65
('autoMemberNum','1','','If ON, patron number is auto-calculated','YesNo'),
65
('autoMemberNum','1','','If ON, patron number is auto-calculated','YesNo'),
66
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
66
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
67
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
67
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
68
('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'),
68
('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'),
69
('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'),
69
('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
70
('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
70
('AutoSelfCheckPass','','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
71
('AutoSelfCheckPass','','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 160-165 Circulation: Link Here
160
160
161
    Checkout Policy:
161
    Checkout Policy:
162
        -
162
        -
163
            - pref: AutoReturnCheckedOutItems
164
              choices:
165
                  yes: Don't
166
                  no: Do
167
            - require librarians to manually confirm a checkout where the item is already checked out to another patron.
168
        -
163
            - pref: AllowTooManyOverride
169
            - pref: AllowTooManyOverride
164
              choices:
170
              choices:
165
                  yes: Allow
171
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 73-78 Link Here
73
    <div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate %] ([% alert.HIGHHOLDS.duration %] days).</div>
73
    <div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate %] ([% alert.HIGHHOLDS.duration %] days).</div>
74
[% END %]
74
[% END %]
75
75
76
[% IF alert.RETURNED_FROM_ANOTHER %]
77
    <div class="dialog alert">Item was checked out to [% alert.RETURNED_FROM_ANOTHER.patron.firstname %] [% alert.RETURNED_FROM_ANOTHER.patron.surname %] ([% alert.RETURNED_FROM_ANOTHER.patron.cardnumber %]) and was returned automatically.</div>
78
[% END %]
79
76
[% IF ( nopermission ) %]
80
[% IF ( nopermission ) %]
77
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
81
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
78
[% END %]
82
[% END %]
(-)a/t/db_dependent/Circulation.t (-2 / +61 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 113;
20
use Test::More tests => 114;
21
21
22
use DateTime;
22
use DateTime;
23
23
Lines 86-91 my $borrower = { Link Here
86
    branchcode => $library2->{branchcode}
86
    branchcode => $library2->{branchcode}
87
};
87
};
88
88
89
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
90
89
# No userenv, PickupLibrary
91
# No userenv, PickupLibrary
90
t::lib::Mocks::mock_preference('IndependentBranches', '0');
92
t::lib::Mocks::mock_preference('IndependentBranches', '0');
91
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
93
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
Lines 1750-1755 subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { Link Here
1750
    is( $debarments->[0]->{expiration}, $expected_expiration );
1752
    is( $debarments->[0]->{expiration}, $expected_expiration );
1751
};
1753
};
1752
1754
1755
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
1756
    plan tests => 2;
1757
1758
    my $library = $builder->build( { source => 'Branch' } );
1759
    my $patron1 = $builder->build_object(
1760
        {
1761
            class => 'Koha::Patrons',
1762
            value  => {
1763
                branchcode => $library->{branchcode},
1764
                firstname => "Happy",
1765
                surname => "Gilmore",
1766
            }
1767
        }
1768
    );
1769
    my $patron2 = $builder->build_object(
1770
        {
1771
            class => 'Koha::Patrons',
1772
            value  => {
1773
                branchcode => $library->{branchcode},
1774
                firstname => "Billy",
1775
                surname => "Madison",
1776
            }
1777
        }
1778
    );
1779
1780
    C4::Context->_new_userenv('xxx');
1781
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
1782
1783
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1784
    my $biblionumber = $biblioitem->{biblionumber};
1785
    my $item = $builder->build(
1786
        {   source => 'Item',
1787
            value  => {
1788
                homebranch    => $library->{branchcode},
1789
                holdingbranch => $library->{branchcode},
1790
                notforloan    => 0,
1791
                itemlost      => 0,
1792
                withdrawn     => 0,
1793
                biblionumber  => $biblionumber,
1794
            }
1795
        }
1796
    );
1797
1798
    my ( $error, $question, $alerts );
1799
    my $issue = AddIssue( $patron1->unblessed, $item->{barcode} );
1800
1801
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1802
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1803
    is( $question->{ISSUED_TO_ANOTHER}, 1, 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another' );
1804
1805
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1);
1806
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1807
    is( $alerts->{RETURNED_FROM_ANOTHER}->{patron}->borrowernumber, $patron1->borrowernumber, 'RETURNED_FROM_ANOTHER alert flag should be set if AutoReturnCheckedOutItems is enabled and item is checked out to another' );
1808
1809
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1810
};
1811
1812
1753
subtest 'AddReturn | is_overdue' => sub {
1813
subtest 'AddReturn | is_overdue' => sub {
1754
    plan tests => 5;
1814
    plan tests => 5;
1755
1815
1756
- 

Return to bug 17171