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

(-)a/C4/Circulation.pm (+4 lines)
Lines 886-896 sub CanBookBeIssued { Link Here
886
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
886
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
887
            $issuingimpossible{branch_to_return} = $message;
887
            $issuingimpossible{branch_to_return} = $message;
888
        } else {
888
        } else {
889
            if ( C4::Context->preference('AutoReturnCheckedOutItems') ) {
890
                $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron };
891
            } else {
889
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
892
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
890
            $needsconfirmation{issued_firstname} = $patron->firstname;
893
            $needsconfirmation{issued_firstname} = $patron->firstname;
891
            $needsconfirmation{issued_surname} = $patron->surname;
894
            $needsconfirmation{issued_surname} = $patron->surname;
892
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
895
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
893
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
896
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
897
            }
894
        }
898
        }
895
    }
899
    }
896
900
(-)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 72-77 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
72
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
72
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
73
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
73
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
74
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
74
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
75
('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'),
75
('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'),
76
('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'),
76
('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
77
('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
77
('AutoSelfCheckPass','','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
78
('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 168-173 Circulation: Link Here
168
168
169
    Checkout Policy:
169
    Checkout Policy:
170
        -
170
        -
171
            - pref: AutoReturnCheckedOutItems
172
              choices:
173
                  yes: Don't
174
                  no: Do
175
            - require librarians to manually confirm a checkout where the item is already checked out to another patron.
176
        -
171
            - pref: AllowTooManyOverride
177
            - pref: AllowTooManyOverride
172
              choices:
178
              choices:
173
                  yes: Allow
179
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 74-79 Link Here
74
    <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 | $KohaDates %] ([% alert.HIGHHOLDS.duration  | html %] days).</div>
74
    <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 | $KohaDates %] ([% alert.HIGHHOLDS.duration  | html %] days).</div>
75
[% END %]
75
[% END %]
76
76
77
[% IF alert.RETURNED_FROM_ANOTHER %]
78
    <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>
79
[% END %]
80
77
[% IF ( nopermission ) %]
81
[% IF ( nopermission ) %]
78
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
82
    <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
79
[% END %]
83
[% END %]
(-)a/t/db_dependent/Circulation.t (-2 / +61 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 125;
21
use Test::More tests => 126;
22
use Test::MockModule;
22
use Test::MockModule;
23
23
24
use Data::Dumper;
24
use Data::Dumper;
Lines 105-110 my $borrower = { Link Here
105
    branchcode => $library2->{branchcode}
105
    branchcode => $library2->{branchcode}
106
};
106
};
107
107
108
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
109
108
# No userenv, PickupLibrary
110
# No userenv, PickupLibrary
109
t::lib::Mocks::mock_preference('IndependentBranches', '0');
111
t::lib::Mocks::mock_preference('IndependentBranches', '0');
110
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
112
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
Lines 1904-1909 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
1904
    );
1906
    );
1905
};
1907
};
1906
1908
1909
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
1910
    plan tests => 2;
1911
1912
    my $library = $builder->build( { source => 'Branch' } );
1913
    my $patron1 = $builder->build_object(
1914
        {
1915
            class => 'Koha::Patrons',
1916
            value  => {
1917
                branchcode => $library->{branchcode},
1918
                firstname => "Happy",
1919
                surname => "Gilmore",
1920
            }
1921
        }
1922
    );
1923
    my $patron2 = $builder->build_object(
1924
        {
1925
            class => 'Koha::Patrons',
1926
            value  => {
1927
                branchcode => $library->{branchcode},
1928
                firstname => "Billy",
1929
                surname => "Madison",
1930
            }
1931
        }
1932
    );
1933
1934
    C4::Context->_new_userenv('xxx');
1935
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
1936
1937
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1938
    my $biblionumber = $biblioitem->{biblionumber};
1939
    my $item = $builder->build(
1940
        {   source => 'Item',
1941
            value  => {
1942
                homebranch    => $library->{branchcode},
1943
                holdingbranch => $library->{branchcode},
1944
                notforloan    => 0,
1945
                itemlost      => 0,
1946
                withdrawn     => 0,
1947
                biblionumber  => $biblionumber,
1948
            }
1949
        }
1950
    );
1951
1952
    my ( $error, $question, $alerts );
1953
    my $issue = AddIssue( $patron1->unblessed, $item->{barcode} );
1954
1955
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1956
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1957
    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' );
1958
1959
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1);
1960
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1961
    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' );
1962
1963
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1964
};
1965
1966
1907
subtest 'AddReturn | is_overdue' => sub {
1967
subtest 'AddReturn | is_overdue' => sub {
1908
    plan tests => 5;
1968
    plan tests => 5;
1909
1969
1910
- 

Return to bug 17171