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

(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 1612-1618 sub AddReturn { Link Here
1612
1612
1613
    if ( $item->{'wthdrawn'} ) { # book has been cancelled
1613
    if ( $item->{'wthdrawn'} ) { # book has been cancelled
1614
        $messages->{'wthdrawn'} = 1;
1614
        $messages->{'wthdrawn'} = 1;
1615
        $doreturn = 0;
1615
        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
1616
    }
1616
    }
1617
1617
1618
    # case of a return of document (deal with issues and holdingbranch)
1618
    # case of a return of document (deal with issues and holdingbranch)
Lines 1698-1704 sub AddReturn { Link Here
1698
1698
1699
    # find reserves.....
1699
    # find reserves.....
1700
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1700
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1701
    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
1701
    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ) unless ( $item->{'wthdrawn'} );
1702
    if ($resfound) {
1702
    if ($resfound) {
1703
          $resrec->{'ResFound'} = $resfound;
1703
          $resrec->{'ResFound'} = $resfound;
1704
        $messages->{'ResFound'} = $resrec;
1704
        $messages->{'ResFound'} = $resrec;
(-)a/circ/returns.pl (-10 / +2 lines)
Lines 285-299 if ($barcode) { Link Here
285
        $input{duedate}   = 0;
285
        $input{duedate}   = 0;
286
        $returneditems{0} = $barcode;
286
        $returneditems{0} = $barcode;
287
        $riduedate{0}     = 0;
287
        $riduedate{0}     = 0;
288
        if ( $messages->{'wthdrawn'} ) {
289
            $input{withdrawn}      = 1;
290
            $input{borrowernumber} = 'Item Cancelled';  # FIXME: should be in display layer ?
291
            $riborrowernumber{0}   = 'Item Cancelled';
292
        }
293
        else {
294
            $input{borrowernumber} = ' ';  # This seems clearly bogus.
295
            $riborrowernumber{0}   = ' ';
296
        }
297
        push( @inputloop, \%input );
288
        push( @inputloop, \%input );
298
    }
289
    }
299
}
290
}
Lines 438-444 foreach my $code ( keys %$messages ) { Link Here
438
    }
429
    }
439
    elsif ( $code eq 'wthdrawn' ) {
430
    elsif ( $code eq 'wthdrawn' ) {
440
        $err{withdrawn} = 1;
431
        $err{withdrawn} = 1;
441
        $exit_required_p = 1;
432
        $exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems");
442
    }
433
    }
443
    elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
434
    elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
444
        if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
435
        if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
Lines 610-615 $template->param( Link Here
610
    dropboxdate    => output_pref($dropboxdate),
601
    dropboxdate    => output_pref($dropboxdate),
611
    overduecharges => $overduecharges,
602
    overduecharges => $overduecharges,
612
    soundon        => C4::Context->preference("SoundOn"),
603
    soundon        => C4::Context->preference("SoundOn"),
604
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
613
);
605
);
614
606
615
### Comment out rotating collections for now to allow it a little more time to bake
607
### Comment out rotating collections for now to allow it a little more time to bake
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 374-376 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
374
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');
374
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,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
375
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('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');
376
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, 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 5635-5640 if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5635
    SetVersion($DBversion);
5635
    SetVersion($DBversion);
5636
}
5636
}
5637
5637
5638
$DBversion ="3.09.00.XXX";
5639
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5640
    $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');");
5641
    print "Upgrade to $DBversion done (Add system preference BlockReturnOfWithdrawnItems)\n";
5642
    SetVersion($DBversion);
5643
}
5644
5638
=head1 FUNCTIONS
5645
=head1 FUNCTIONS
5639
5646
5640
=head2 TableExists($table)
5647
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+7 lines)
Lines 255-260 Circulation: Link Here
255
                  alert: "display a message"
255
                  alert: "display a message"
256
                  nothing : "do nothing"
256
                  nothing : "do nothing"
257
            - .
257
            - .
258
    Checkin Policy:
259
        -
260
            - pref: BlockReturnOfWithdrawnItems
261
              choices:
262
                  yes: Block
263
                  no: "Don't block"
264
            - returning of items that have been withdrawn.
258
    Holds Policy:
265
    Holds Policy:
259
        -
266
        -
260
            - pref: AllowHoldPolicyOverride
267
            - 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