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

(-)a/C4/Circulation.pm (-12 / +24 lines)
Lines 1781-1787 sub AddReturn { Link Here
1781
    # case of a return of document (deal with issues and holdingbranch)
1781
    # case of a return of document (deal with issues and holdingbranch)
1782
    my $today = DateTime->now( time_zone => C4::Context->tz() );
1782
    my $today = DateTime->now( time_zone => C4::Context->tz() );
1783
    if ($doreturn) {
1783
    if ($doreturn) {
1784
    my $datedue = $issue->{date_due};
1784
        my $datedue = $issue->{date_due};
1785
        $borrower or warn "AddReturn without current borrower";
1785
        $borrower or warn "AddReturn without current borrower";
1786
		my $circControlBranch;
1786
		my $circControlBranch;
1787
        if ($dropbox) {
1787
        if ($dropbox) {
Lines 1790-1820 sub AddReturn { Link Here
1790
            # FIXME: check issuedate > returndate, factoring in holidays
1790
            # FIXME: check issuedate > returndate, factoring in holidays
1791
            #$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );;
1791
            #$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );;
1792
            $circControlBranch = _GetCircControlBranch($item,$borrower);
1792
            $circControlBranch = _GetCircControlBranch($item,$borrower);
1793
        $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $today ) == -1 ? 1 : 0;
1793
            $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $today ) == -1 ? 1 : 0;
1794
        }
1794
        }
1795
1795
1796
        if ($borrowernumber) {
1796
        if ($borrowernumber) {
1797
            if( C4::Context->preference('CalculateFinesOnReturn') && $issue->{'overdue'}){
1797
            if ( ( C4::Context->preference('CalculateFinesOnReturn') && $issue->{'overdue'} ) || $return_date ) {
1798
            # we only need to calculate and change the fines if we want to do that on return
1798
                # we only need to calculate and change the fines if we want to do that on return
1799
            # Should be on for hourly loans
1799
                # Should be on for hourly loans
1800
                my $control = C4::Context->preference('CircControl');
1800
                my $control = C4::Context->preference('CircControl');
1801
                my $control_branchcode =
1801
                my $control_branchcode =
1802
                    ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
1802
                    ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
1803
                  : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
1803
                  : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
1804
                  :                                     $issue->{branchcode};
1804
                  :                                     $issue->{branchcode};
1805
1805
1806
                my $date_returned =
1807
                  $return_date ? dt_from_string($return_date) : $today;
1808
1806
                my ( $amount, $type, $unitcounttotal ) =
1809
                my ( $amount, $type, $unitcounttotal ) =
1807
                  C4::Overdues::CalcFine( $item, $borrower->{categorycode},
1810
                  C4::Overdues::CalcFine( $item, $borrower->{categorycode},
1808
                    $control_branchcode, $datedue, $today );
1811
                    $control_branchcode, $datedue, $date_returned );
1809
1812
1810
                $type ||= q{};
1813
                $type ||= q{};
1811
1814
1812
                if ( $amount > 0
1815
                if ( C4::Context->preference('finesMode') eq 'production' ) {
1813
                    && C4::Context->preference('finesMode') eq 'production' )
1816
                    if ( $amount > 0 ) {
1814
                {
1817
                        C4::Overdues::UpdateFine( $issue->{itemnumber},
1815
                    C4::Overdues::UpdateFine( $issue->{itemnumber},
1818
                            $issue->{borrowernumber},
1816
                        $issue->{borrowernumber},
1819
                            $amount, $type, output_pref($datedue) );
1817
                        $amount, $type, output_pref($datedue) );
1820
                    }
1821
                    elsif ($return_date) {
1822
1823
                       # Backdated returns may have fines that shouldn't exist,
1824
                       # so in this case, we need to drop those fines to 0
1825
1826
                        C4::Overdues::UpdateFine( $issue->{itemnumber},
1827
                            $issue->{borrowernumber},
1828
                            0, $type, output_pref($datedue) );
1829
                    }
1818
                }
1830
                }
1819
            }
1831
            }
1820
1832
(-)a/circ/returns.pl (-1 / +25 lines)
Lines 180-185 my $calendar = Koha::Calendar->new( branchcode => $userenv_branch ); Link Here
180
#dropbox: get last open day (today - 1)
180
#dropbox: get last open day (today - 1)
181
my $today       = DateTime->now( time_zone => C4::Context->tz());
181
my $today       = DateTime->now( time_zone => C4::Context->tz());
182
my $dropboxdate = $calendar->addDate($today, -1);
182
my $dropboxdate = $calendar->addDate($today, -1);
183
184
my $return_date_override = $query->param('return_date_override');
185
my $return_date_override_remember =
186
  $query->param('return_date_override_remember');
187
if ($return_date_override) {
188
    if ( C4::Context->preference('SpecifyReturnDate') ) {
189
        if ( $return_date_override =~ C4::Dates->regexp('syspref') ) {
190
191
            # Save the original format if we are remembering for this series
192
            $template->param(
193
                return_date_override          => $return_date_override,
194
                return_date_override_remember => 1
195
            ) if ($return_date_override_remember);
196
197
            my $dt = dt_from_string($return_date_override);
198
            $return_date_override =
199
              DateTime::Format::MySQL->format_datetime($dt);
200
        }
201
    }
202
    else {
203
        $return_date_override = q{};
204
    }
205
}
206
183
if ($dotransfer){
207
if ($dotransfer){
184
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
208
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
185
    my $transferitem = $query->param('transferitem');
209
    my $transferitem = $query->param('transferitem');
Lines 216-222 if ($barcode) { Link Here
216
# save the return
240
# save the return
217
#
241
#
218
    ( $returned, $messages, $issueinformation, $borrower ) =
242
    ( $returned, $messages, $issueinformation, $borrower ) =
219
      AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode);     # do the return
243
      AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override );
220
    my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn');
244
    my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn');
221
    $homeorholdingbranchreturn ||= 'homebranch';
245
    $homeorholdingbranchreturn ||= 'homebranch';
222
246
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +33 lines)
Lines 1-9 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE KohaBranchName %]
2
[% USE KohaBranchName %]
3
[% USE Koha %]
3
4
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title |html %]</title>
6
<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title |html %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
8
9
[% INCLUDE 'calendar.inc' %]
10
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
11
7
<script type="text/javascript">
12
<script type="text/javascript">
8
//<![CDATA[
13
//<![CDATA[
9
function Dopop(link) {
14
function Dopop(link) {
Lines 11-16 function Dopop(link) { Link Here
11
    $("#barcode").focus();
16
    $("#barcode").focus();
12
}
17
}
13
$(document).ready(function () {
18
$(document).ready(function () {
19
    $("#return_date_override").datetimepicker({
20
        onClose: function(dateText, inst) { $("#barcode").focus(); },
21
        hour: 23,
22
        minute: 59
23
    });
14
    $("#exemptcheck").change(function () {
24
    $("#exemptcheck").change(function () {
15
        if (this.checked == true) {
25
        if (this.checked == true) {
16
            $("#barcode").addClass("alert");
26
            $("#barcode").addClass("alert");
Lines 25-33 $(document).ready(function () { Link Here
25
        if (this.checked == true) {
35
        if (this.checked == true) {
26
            $("#barcode").addClass("alert");
36
            $("#barcode").addClass("alert");
27
            $("#dropboxmode").show();
37
            $("#dropboxmode").show();
38
39
            $("#return_date_override_fields :input").attr("disabled", true);
40
            $("#return_date_override").datetimepicker("disable");
28
        } else {
41
        } else {
29
            $("#barcode").removeClass("alert");
42
            $("#barcode").removeClass("alert");
30
            $("#dropboxmode").hide();
43
            $("#dropboxmode").hide();
44
45
            $("#return_date_override_fields :input").attr("disabled", false);
46
            $("#return_date_override").datetimepicker("enable");
31
        }
47
        }
32
        $("#barcode").focus();
48
        $("#barcode").focus();
33
    });
49
    });
Lines 383-388 $(document).ready(function () { Link Here
383
			<input name="barcode" id="barcode" size="14" class="focus"/>
399
			<input name="barcode" id="barcode" size="14" class="focus"/>
384
			[% END %]
400
			[% END %]
385
            <input type="submit" class="submit" value="Submit" />
401
            <input type="submit" class="submit" value="Submit" />
402
403
            [% IF Koha.Preference('SpecifyReturnDate') %]
404
                <div class="date-select" id="return_date_override_fields">
405
                    <div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
406
407
                    <input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override %]" readonly="readonly" />
408
409
                    <label for="return_date_override_remember"> Remember for session:</label>
410
                    [% IF ( return_date_override_remember ) %]
411
                        <input type="checkbox" id="return_date_override_remember" onclick="this.form.barcode.focus();" name="return_date_override_remember" checked="checked" />
412
                    [% ELSE %]
413
                        <input type="checkbox" id="return_date_override_remember" onclick="this.form.barcode.focus();" name="return_date_override_remember" />
414
                    [% END %]
415
416
                    <input type="button" class="action" id="cleardate" value="Clear" name="cleardate" onclick="this.checked = false; this.form.return_date_override.value = ''; this.form.return_date_override_remember.checked = false; this.form.barcode.focus(); return false;" />
417
            </div>
418
        [% END %]
386
            [% FOREACH inputloo IN inputloop %]
419
            [% FOREACH inputloo IN inputloop %]
387
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
420
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
388
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
421
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
389
- 

Return to bug 10694