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

(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 1602-1608 sub AddReturn { Link Here
1602
1602
1603
    if ( $item->{'wthdrawn'} ) { # book has been cancelled
1603
    if ( $item->{'wthdrawn'} ) { # book has been cancelled
1604
        $messages->{'wthdrawn'} = 1;
1604
        $messages->{'wthdrawn'} = 1;
1605
        $doreturn = 0;
1605
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
1606
    }
1606
    }
1607
1607
1608
    # case of a return of document (deal with issues and holdingbranch)
1608
    # case of a return of document (deal with issues and holdingbranch)
Lines 1685-1691 sub AddReturn { Link Here
1685
1685
1686
    # find reserves.....
1686
    # find reserves.....
1687
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1687
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1688
    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
1688
    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ) unless ( $item->{'wthdrawn'} );
1689
    if ($resfound) {
1689
    if ($resfound) {
1690
          $resrec->{'ResFound'} = $resfound;
1690
          $resrec->{'ResFound'} = $resfound;
1691
        $messages->{'ResFound'} = $resrec;
1691
        $messages->{'ResFound'} = $resrec;
(-)a/circ/returns.pl (-10 / +2 lines)
Lines 291-305 if ($barcode) { Link Here
291
        $input{duedate}   = 0;
291
        $input{duedate}   = 0;
292
        $returneditems{0} = $barcode;
292
        $returneditems{0} = $barcode;
293
        $riduedate{0}     = 0;
293
        $riduedate{0}     = 0;
294
        if ( $messages->{'wthdrawn'} ) {
295
            $input{withdrawn}      = 1;
296
            $input{borrowernumber} = 'Item Cancelled';  # FIXME: should be in display layer ?
297
            $riborrowernumber{0}   = 'Item Cancelled';
298
        }
299
        else {
300
            $input{borrowernumber} = ' ';  # This seems clearly bogus.
301
            $riborrowernumber{0}   = ' ';
302
        }
303
        push( @inputloop, \%input );
294
        push( @inputloop, \%input );
304
    }
295
    }
305
}
296
}
Lines 444-450 foreach my $code ( keys %$messages ) { Link Here
444
    }
435
    }
445
    elsif ( $code eq 'wthdrawn' ) {
436
    elsif ( $code eq 'wthdrawn' ) {
446
        $err{withdrawn} = 1;
437
        $err{withdrawn} = 1;
447
        $exit_required_p = 1;
438
        $exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems");
448
    }
439
    }
449
    elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
440
    elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
450
        if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
441
        if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
Lines 613-618 $template->param( Link Here
613
    dropboxdate    => output_pref($dropboxdate),
604
    dropboxdate    => output_pref($dropboxdate),
614
    overduecharges => $overduecharges,
605
    overduecharges => $overduecharges,
615
    soundon        => C4::Context->preference("SoundOn"),
606
    soundon        => C4::Context->preference("SoundOn"),
607
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
616
);
608
);
617
609
618
### Comment out rotating collections for now to allow it a little more time to bake
610
### Comment out rotating collections for now to allow it a little more time to bake
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 375-377 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
378
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5536-5541 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5536
    SetVersion($DBversion);
5536
    SetVersion($DBversion);
5537
}
5537
}
5538
5538
5539
$DBversion ="3.09.00.XXX";
5540
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5541
    $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');");
5542
    print "Upgrade to $DBversion done (Add system preference BlockReturnOfWithdrawnItems)\n";
5543
    SetVersion($DBversion);
5544
}
5545
5539
=head1 FUNCTIONS
5546
=head1 FUNCTIONS
5540
5547
5541
=head2 TableExists($table)
5548
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+7 lines)
Lines 254-259 Circulation: Link Here
254
                  alert: "display a message"
254
                  alert: "display a message"
255
                  nothing : "do nothing"
255
                  nothing : "do nothing"
256
            - .
256
            - .
257
    Checkin Policy:
258
        -
259
            - pref: BlockReturnOfWithdrawnItems
260
              choices:
261
                  yes: Block
262
                  no: "Don't block"
263
            - returning of items that have been withdrawn.
257
    Holds Policy:
264
    Holds Policy:
258
        -
265
        -
259
            - pref: AllowHoldPolicyOverride
266
            - pref: AllowHoldPolicyOverride
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-2 / +6 lines)
Lines 335-341 $(document).ready(function () { Link Here
335
                        <p class="problem">Item was lost, now found.</p>
335
                        <p class="problem">Item was lost, now found.</p>
336
                    [% END %]
336
                    [% END %]
337
                    [% IF ( errmsgloo.withdrawn ) %]
337
                    [% IF ( errmsgloo.withdrawn ) %]
338
                        <p class="problem">Item is withdrawn.</p>
338
                        [% IF BlockReturnOfWithdrawnItems %]
339
                           <h3>Cannot Check In</h3>
340
                           <p class="problem">Item is withdrawn. <strong>NOT CHECKED IN</strong></p>
341
                        [% ELSE %]
342
                           <p class="problem">Item is withdrawn.</p>
343
                        [% END %]
339
                    [% END %]
344
                    [% END %]
340
                    [% IF ( errmsgloo.debarred ) %]
345
                    [% IF ( errmsgloo.debarred ) %]
341
                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %] </p>
346
                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %] </p>
342
- 

Return to bug 3387