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

(-)a/C4/Circulation.pm (+4 lines)
Lines 879-889 sub CanBookBeIssued { Link Here
879
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
879
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
880
            $issuingimpossible{branch_to_return} = $message;
880
            $issuingimpossible{branch_to_return} = $message;
881
        } else {
881
        } else {
882
            if ( C4::Context->preference('AutoReturnCheckedOutItems') ) {
883
                $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron };
884
            } else {
882
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
885
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
883
            $needsconfirmation{issued_firstname} = $patron->firstname;
886
            $needsconfirmation{issued_firstname} = $patron->firstname;
884
            $needsconfirmation{issued_surname} = $patron->surname;
887
            $needsconfirmation{issued_surname} = $patron->surname;
885
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
888
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
886
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
889
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
890
            }
887
        }
891
        }
888
    }
892
    }
889
893
(-)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 68-73 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
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'),
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
('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
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
('AutoSelfCheckPass','','','Password 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
('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'),
71
('Babeltheque','0','','Turn ON Babeltheque content  - See babeltheque.com to subscribe to this service','YesNo'),
72
('Babeltheque','0','','Turn ON Babeltheque content  - See babeltheque.com to subscribe to this service','YesNo'),
72
('Babeltheque_url_js','','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js)','Free'),
73
('Babeltheque_url_js','','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js)','Free'),
73
('Babeltheque_url_update','','','Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)','Free'),
74
('Babeltheque_url_update','','','Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 153-158 Circulation: Link Here
153
153
154
    Checkout Policy:
154
    Checkout Policy:
155
        -
155
        -
156
            - pref: AutoReturnCheckedOutItems
157
              choices:
158
                  yes: Don't
159
                  no: Do
160
            - require librarians to manually confirm a checkout where the item is already checked out to another patron.
161
        -
156
            - pref: AllowTooManyOverride
162
            - pref: AllowTooManyOverride
157
              choices:
163
              choices:
158
                  yes: Allow
164
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 177-182 $(document).ready(function() { Link Here
177
    <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>
177
    <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>
178
[% END %]
178
[% END %]
179
179
180
[% IF alert.RETURNED_FROM_ANOTHER %]
181
    <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>
182
[% END %]
183
180
[% IF ( nopermission ) %]
184
[% IF ( nopermission ) %]
181
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
185
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
182
[% END %]
186
[% 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