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} = $currborinfo->{'firstname'};
984
                $alerts{RETURNED_FROM_ANOTHER} = { patron => $currborinfo };
985
            $needsconfirmation{issued_surname} = $currborinfo->{'surname'};
985
            }
986
            $needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'};
986
            else {
987
            $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'};
987
                $needsconfirmation{ISSUED_TO_ANOTHER} = 1;
988
                $needsconfirmation{issued_firstname} = $currborinfo->{'firstname'};
989
                $needsconfirmation{issued_surname} = $currborinfo->{'surname'};
990
                $needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'};
991
                $needsconfirmation{issued_borrowernumber} = $currborinfo->{'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 / +56 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 95;
20
use Test::More tests => 96;
21
21
22
use DateTime;
22
use DateTime;
23
23
Lines 72-77 my $borrower = { Link Here
72
    branchcode => $library2->{branchcode}
72
    branchcode => $library2->{branchcode}
73
};
73
};
74
74
75
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
76
75
# No userenv, PickupLibrary
77
# No userenv, PickupLibrary
76
t::lib::Mocks::mock_preference('IndependentBranches', '0');
78
t::lib::Mocks::mock_preference('IndependentBranches', '0');
77
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
79
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary');
Lines 1631-1636 subtest 'AddReturn + CumulativeRestrictionPeriods' => sub { Link Here
1631
    is( $debarments->[0]->{expiration}, $expected_expiration );
1633
    is( $debarments->[0]->{expiration}, $expected_expiration );
1632
};
1634
};
1633
1635
1636
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {
1637
    plan tests => 2;
1638
1639
    my $library = $builder->build( { source => 'Branch' } );
1640
    my $patron1 = $builder->build(
1641
        {
1642
            source => 'Borrower',
1643
            value  => {
1644
                branchcode => $library->{branchcode},
1645
            }
1646
        }
1647
    );
1648
    my $patron2 = $builder->build(
1649
        {
1650
            source => 'Borrower',
1651
            value  => {
1652
                branchcode => $library->{branchcode},
1653
            }
1654
        }
1655
    );
1656
1657
    C4::Context->_new_userenv('xxx');
1658
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', '');
1659
1660
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1661
    my $biblionumber = $biblioitem->{biblionumber};
1662
    my $item = $builder->build(
1663
        {   source => 'Item',
1664
            value  => {
1665
                homebranch    => $library->{branchcode},
1666
                holdingbranch => $library->{branchcode},
1667
                notforloan    => 0,
1668
                itemlost      => 0,
1669
                withdrawn     => 0,
1670
                biblionumber  => $biblionumber,
1671
            }
1672
        }
1673
    );
1674
1675
    my ( $error, $question, $alerts );
1676
    my $issue = AddIssue( $patron1, $item->{barcode} );
1677
1678
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1679
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1680
    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' );
1681
1682
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1);
1683
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} );
1684
    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' );
1685
1686
    t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0);
1687
};
1688
1634
sub set_userenv {
1689
sub set_userenv {
1635
    my ( $library ) = @_;
1690
    my ( $library ) = @_;
1636
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', '');
1691
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', '');
1637
- 

Return to bug 17171