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 1901-1906 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
1901
    );
1903
    );
1902
};
1904
};
1903
1905
1906
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
1907
    plan tests => 2;
1908
1909
    my $library = $builder->build( { source => 'Branch' } );
1910
    my $patron1 = $builder->build_object(
1911
        {
1912
            class => 'Koha::Patrons',
1913
            value  => {
1914
                branchcode => $library->{branchcode},
1915
                firstname => "Happy",
1916
                surname => "Gilmore",
1917
            }
1918
        }
1919
    );
1920
    my $patron2 = $builder->build_object(
1921
        {
1922
            class => 'Koha::Patrons',
1923
            value  => {
1924
                branchcode => $library->{branchcode},
1925
                firstname => "Billy",
1926
                surname => "Madison",
1927
            }
1928
        }
1929
    );
1930
1931
    C4::Context->_new_userenv('xxx');
1932
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
1933
1934
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1935
    my $biblionumber = $biblioitem->{biblionumber};
1936
    my $item = $builder->build(
1937
        {   source => 'Item',
1938
            value  => {
1939
                homebranch    => $library->{branchcode},
1940
                holdingbranch => $library->{branchcode},
1941
                notforloan    => 0,
1942
                itemlost      => 0,
1943
                withdrawn     => 0,
1944
                biblionumber  => $biblionumber,
1945
            }
1946
        }
1947
    );
1948
1949
    my ( $error, $question, $alerts );
1950
    my $issue = AddIssue( $patron1->unblessed, $item->{barcode} );
1951
1952
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1953
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1954
    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' );
1955
1956
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1);
1957
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1958
    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' );
1959
1960
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1961
};
1962
1963
1904
subtest 'AddReturn | is_overdue' => sub {
1964
subtest 'AddReturn | is_overdue' => sub {
1905
    plan tests => 5;
1965
    plan tests => 5;
1906
1966
1907
- 

Return to bug 17171