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

(-)a/C4/Circulation.pm (-5 / +10 lines)
Lines 980-990 sub CanBookBeIssued { Link Here
980
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
980
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
981
            $issuingimpossible{branch_to_return} = $message;
981
            $issuingimpossible{branch_to_return} = $message;
982
        } else {
982
        } else {
983
            $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
983
            if ( C4::Context->preference('AutoReturnCheckedOutItems') ) {
984
            $needsconfirmation{issued_firstname} = $patron->firstname;
984
                $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron };
985
            $needsconfirmation{issued_surname} = $patron->surname;
985
            }
986
            $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
986
            else {
987
            $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
987
                $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
988
                $needsconfirmation{issued_firstname} = $patron->firstname;
989
                $needsconfirmation{issued_surname} = $patron->surname;
990
                $needsconfirmation{issued_cardnumber} = $patron->cardnumber;
991
                $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
992
            }
988
        }
993
        }
989
    }
994
    }
990
995
(-)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/includes/csv_headers/reports/cash_register_stats.tt (-1 / +1 lines)
Line 1 Link Here
1
mfirstname[% sep %]card number[% sep %]firstname[% sep %]branchname[% sep %]date[% sep %]accounttype[% sep %]amount[% sep %]title[% sep %]barcode[% sep %]itype
1
mfirstname[% sep %]card number[% sep %]firstname[% sep %]branchname[% sep %]date[% sep %]accounttype[% sep %]amount[% sep %]title[% sep %]barcode[% sep %]"itype"
(-)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 / +57 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 98;
20
use Test::More tests => 99;
21
21
22
use DateTime;
22
use DateTime;
23
23
Lines 74-79 my $borrower = { Link Here
74
    branchcode => $library2->{branchcode}
74
    branchcode => $library2->{branchcode}
75
};
75
};
76
76
77
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
78
77
# No userenv, PickupLibrary
79
# No userenv, PickupLibrary
78
t::lib::Mocks::mock_preference('IndependentBranches', '0');
80
t::lib::Mocks::mock_preference('IndependentBranches', '0');
79
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
81
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
Lines 1639-1644 subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { Link Here
1639
    is( $debarments->[0]->{expiration}, $expected_expiration );
1641
    is( $debarments->[0]->{expiration}, $expected_expiration );
1640
};
1642
};
1641
1643
1644
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
1645
    plan tests => 2;
1646
1647
    my $library = $builder->build( { source => 'Branch' } );
1648
    my $patron1 = $builder->build(
1649
        {
1650
            source => 'Borrower',
1651
            value  => {
1652
                branchcode => $library->{branchcode},
1653
            }
1654
        }
1655
    );
1656
    my $patron2 = $builder->build(
1657
        {
1658
            source => 'Borrower',
1659
            value  => {
1660
                branchcode => $library->{branchcode},
1661
            }
1662
        }
1663
    );
1664
1665
    C4::Context->_new_userenv('xxx');
1666
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
1667
1668
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1669
    my $biblionumber = $biblioitem->{biblionumber};
1670
    my $item = $builder->build(
1671
        {   source => 'Item',
1672
            value  => {
1673
                homebranch    => $library->{branchcode},
1674
                holdingbranch => $library->{branchcode},
1675
                notforloan    => 0,
1676
                itemlost      => 0,
1677
                withdrawn     => 0,
1678
                biblionumber  => $biblionumber,
1679
            }
1680
        }
1681
    );
1682
1683
    my ( $error, $question, $alerts );
1684
    my $issue = AddIssue( $patron1, $item->{barcode} );
1685
1686
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1687
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1688
    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' );
1689
1690
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1);
1691
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1692
    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' );
1693
1694
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1695
};
1696
1697
1642
subtest 'AddReturn | is_overdue' => sub {
1698
subtest 'AddReturn | is_overdue' => sub {
1643
    plan tests => 5;
1699
    plan tests => 5;
1644
1700
1645
- 

Return to bug 17171