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

(-)a/C4/Circulation.pm (+5 lines)
Lines 1450-1455 sub AddIssue { Link Here
1450
                }
1450
                }
1451
            }
1451
            }
1452
1452
1453
            if (C4::Context->preference('UpdateItemLocationOnCheckout')) {
1454
                # UpdateItemLocationOnCheckout is on, set the value of the shelving location (items.location) to blank upon checkout
1455
                BlankShelvingLocation( $item_object->itemnumber );
1456
            }
1457
1453
            ModItem(
1458
            ModItem(
1454
                {
1459
                {
1455
                    issues        => $item_object->issues + 1,
1460
                    issues        => $item_object->issues + 1,
(-)a/C4/Items.pm (+24 lines)
Lines 47-52 BEGIN { Link Here
47
        DelItemCheck
47
        DelItemCheck
48
        MoveItemFromBiblio
48
        MoveItemFromBiblio
49
        CartToShelf
49
        CartToShelf
50
        BlankShelvingLocation
50
        GetAnalyticsCount
51
        GetAnalyticsCount
51
        SearchItemsByField
52
        SearchItemsByField
52
        SearchItems
53
        SearchItems
Lines 140-145 sub CartToShelf { Link Here
140
    }
141
    }
141
}
142
}
142
143
144
=head2 BlankShelvingLocation
145
146
    BlankShelvingLocation($itemnumber);
147
148
Set the value of the shelving location to blank when an
149
item is issued or returned.
150
151
This is called by
152
C4:Circulation->AddIssue if the BlankItemLocationOnCheckout
153
syspref is enabled
154
155
=cut
156
157
sub BlankShelvingLocation {
158
    my ($itemnumber) = @_;
159
    unless ($itemnumber) {
160
        croak "Failed BlankShelvingLocation() - no itemnumber supplied";
161
    }
162
    my $item = GetItem($itemnumber);
163
    $item->location = '';
164
    ModItem($item, undef, $itemnumber);
165
}
166
143
=head2 AddItemFromMarc
167
=head2 AddItemFromMarc
144
168
145
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
169
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 533-538 Circulation: Link Here
533
            - <br><b>Use of an _ALL_ rule will override/ignore any other values.</b>
533
            - <br><b>Use of an _ALL_ rule will override/ignore any other values.</b>
534
            - <br>Each pair of values should be on a separate line.
534
            - <br>Each pair of values should be on a separate line.
535
        -
535
        -
536
            -pref: UpdateItemLocationOnCheckout
537
             choices:
538
                 yes: Blank
539
                 no: "Don't Blank"
540
            - Blank the 952$c (shelving location) field of the item when is is issued.
541
        -
536
            - pref: UpdateNotForLoanStatusOnCheckin
542
            - pref: UpdateNotForLoanStatusOnCheckin
537
              type: textarea
543
              type: textarea
538
              class: code
544
              class: code
(-)a/t/db_dependent/Circulation/issue.t (-2 / +28 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 45;
20
use Test::More tests => 47;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 423-429 ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location valu Link Here
423
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
423
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
424
424
425
425
426
my $itemnumber3;
427
($biblionumber, $biblioitemnumber, $itemnumber3) = C4::Items::AddItem(
428
    {
429
        barcode         => 'barcode_5',
430
        itemcallnumber  => 'callnumber5',
431
        homebranch      => $branchcode_1,
432
        holdingbranch   => $branchcode_1,
433
        location        => 'CART',
434
        itype           => $itemtype
435
    },
436
    $biblionumber
437
);
426
438
439
#BlankItemLocationOnCheckout
440
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 0);
441
AddIssue($borrower_1, 'barcode_5', $daysago10, 0, $today, 0);
442
my $item3 = GetItem($itemnumber3);
443
ok($item3->location eq 'CART'),
444
q{UpdateItemLocationOnCheckout does not update item shelving location value from 'CART' to '' when not enabled} );
445
446
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 1);
447
if (C4::Context->preference('UpdateItemLocationOnCheckout') )
448
{
449
    BlankShelvingLocation($itemnumber3);
450
}
451
$item3 = GetItem($itemnumber3);
452
ok($item3->location eq '', q{UpdateItemLocationOnCheckout updates item shelving location value from 'CART'
453
 to '' when enabled} );
427
454
428
# Bug 14640 - Cancel the hold on checking out if asked
455
# Bug 14640 - Cancel the hold on checking out if asked
429
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
456
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
430
- 

Return to bug 21159