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

(-)a/C4/Circulation.pm (+5 lines)
Lines 1393-1398 sub AddIssue { Link Here
1393
                }
1393
                }
1394
            }
1394
            }
1395
1395
1396
            if ( C4::Context->preference('UpdateItemLocationOnCheckout')) {
1397
                 # UpdateItemLocationOnCheckout is on, set the value of the shelving location (items.location) to blank upon checkout
1398
                 BlankShelvingLocation( $item->{itemnumber});
1399
            }
1400
1396
            ModItem(
1401
            ModItem(
1397
                {
1402
                {
1398
                    issues        => $item->{'issues'},
1403
                    issues        => $item->{'issues'},
(-)a/C4/Items.pm (+21 lines)
Lines 49-54 BEGIN { Link Here
49
        MoveItemFromBiblio
49
        MoveItemFromBiblio
50
        GetLastAcquisitions
50
        GetLastAcquisitions
51
        CartToShelf
51
        CartToShelf
52
        BlankShelvingLocation
52
        GetAnalyticsCount
53
        GetAnalyticsCount
53
        SearchItemsByField
54
        SearchItemsByField
54
        SearchItems
55
        SearchItems
Lines 184-189 sub CartToShelf { Link Here
184
    }
185
    }
185
}
186
}
186
187
188
=head2 BlankShelvingLocation
189
190
    BlankShelvingLocation($itemnumber);
191
192
Set the value of the shelving location to blank when an item is issued or returned.
193
194
This is called by C4::Circulation->AddIssue if the BlankItemLocationOnCheckout syspref is enabled
195
196
=cut
197
198
sub BlankShelvingLocation {
199
    my ($itemnumber) = @_;
200
    unless ($itemnumber) {
201
         croak "Failed BlankShelvingLocation() - no itemnumber supplied";
202
    }
203
    my $item = GetItem($itemnumber);
204
    $item->{'location'} = '';
205
    ModItem($item, undef, $itemnumber);
206
}
207
187
=head2 AddItemFromMarc
208
=head2 AddItemFromMarc
188
209
189
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
210
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 512-517 Circulation: Link Here
512
            - <br>**Use of an _ALL_ rule will override/ignore any other values**
512
            - <br>**Use of an _ALL_ rule will override/ignore any other values**
513
            - <br>Each pair of values should be on a separate line.
513
            - <br>Each pair of values should be on a separate line.
514
        -
514
        -
515
            - pref: UpdateItemLocationOnCheckout
516
              choices:
517
                  yes: Blank
518
                  no: "Don't blank"
519
            - Blank the 952$c (shelving location) field of item when it is issued.
520
        -
515
            - pref: UpdateNotForLoanStatusOnCheckin
521
            - pref: UpdateNotForLoanStatusOnCheckin
516
              type: textarea
522
              type: textarea
517
              class: code
523
              class: code
(-)a/t/db_dependent/Circulation/issue.t (-2 / +25 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 44;
20
use Test::More tests => 46;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 420-426 ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location va Link Here
420
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
420
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
421
421
422
422
423
my $itemnumber3;
424
($biblionumber, $biblioitemnumber, $itemnumber3) = C4::Items::AddItem(
425
    {
426
         barcode        => 'barcode_5',
427
         itemcallnumber => 'callnumber5',
428
         homebranch     => $branchcode_1,
429
         holdingbranch  => $branchcode_1,
430
         location       => 'CART',
431
         itype          => $itemtype
432
    },
433
    $biblionumber
434
);
435
436
#BlankItemLocationOnCheckout
437
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 0);
438
AddIssue($borrower_1, 'barcode_5', $daysago10, 0 , $today, 0);
439
my $item3 = GetItem($itemnumber3);
440
ok($item3->{location} eq 'CART', q{UpdateItemLocationOnCheckout does not update item shelving location value from 'CART' to '' when not enabled} );
423
441
442
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 1);
443
if (C4::Context->preference('UpdateItemLocationOnCheckout') ) {
444
    BlankShelvingLocation($itemnumber3);
445
}
446
$item3 = GetItem($itemnumber3);
447
ok($item3->{location} eq '', q{UpdateItemLocationOnCheckout updates item shelving location value from 'CART' to '' when enabled} );
424
448
425
# Bug 14640 - Cancel the hold on checking out if asked
449
# Bug 14640 - Cancel the hold on checking out if asked
426
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
450
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
427
- 

Return to bug 21159