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

(-)a/C4/Circulation.pm (+6 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
1398
                BlankShelvingLocation( $item->{itemnumber});
1399
            }
1400
1401
1396
            ModItem(
1402
            ModItem(
1397
                {
1403
                {
1398
                    issues        => $item->{'issues'},
1404
                    issues        => $item->{'issues'},
(-)a/C4/Items.pm (-1 / +22 lines)
Lines 84-90 BEGIN { Link Here
84
    GetLatestAcquisitions
84
    GetLatestAcquisitions
85
85
86
        CartToShelf
86
        CartToShelf
87
87
        BlankShelvingLocation
88
	GetAnalyticsCount
88
	GetAnalyticsCount
89
89
90
        SearchItemsByField
90
        SearchItemsByField
Lines 198-203 sub CartToShelf { Link Here
198
    }
198
    }
199
}
199
}
200
200
201
202
=head2 BlankShelvingLocation
203
204
    BalnkShelvingLocation($itemnumber);
205
206
Set the value of the shelving location to blank when an item is issued or returned.
207
208
This is called by C4::Circulation->AddIssue if the BlankItemLocationOnCheckout syspref is enabled
209
210
=cut
211
212
sub BlankShelvingLocation {
213
    my ($itemnumber) = @_;
214
    unless ($itemnumber) {
215
        croak "Failed BlankShelvingLocation() - no itemnumber supplied";
216
    }
217
    my $item = GetItem($itemnumber);
218
    $item->{'location'} = '';
219
    ModItem($item, undef, $itemnumber);
220
}
221
201
=head2 AddItemFromMarc
222
=head2 AddItemFromMarc
202
223
203
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
224
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
(-)a/installer/data/mysql/atomicupdate/bug_21159-add_UpdateItemLocationOnCheckout.sql (+1 lines)
Line 0 Link Here
1
INSERT INTO systempreferences (variable, value, explanation, type) VALUES ('UpdateItemLocationOnCheckout', 0, 'Blank the 952$c (Shelving Location) field of item when it is issued', 'YesNo');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 500-505 Circulation: Link Here
500
            - <br>**Use of an _ALL_ rule will override/ignore any other values**
500
            - <br>**Use of an _ALL_ rule will override/ignore any other values**
501
            - <br>Each pair of values should be on a separate line.
501
            - <br>Each pair of values should be on a separate line.
502
        -
502
        -
503
            - pref: BlankShelvingLocationOnIssue
504
            - choices:
505
                  yes: Blank
506
                  no: "Don't blank"
507
            - Blank the 952$c (shelving location) field of item when it is issued.
508
        -
503
            - pref: UpdateNotForLoanStatusOnCheckin
509
            - pref: UpdateNotForLoanStatusOnCheckin
504
              type: textarea
510
              type: textarea
505
              class: code
511
              class: code
(-)a/t/db_dependent/Circulation/issue.t (-2 / +22 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 419-426 $item2 = GetItem( $itemnumber2 ); Link Here
419
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
419
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
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
my $itemnumber3;
423
($biblionumber, $biblioitemnumber, $itemnumber3) = C4::Items::AddItem(
424
    {
425
        barcode        => 'barcode_5',
426
        itemcallnumber => 'callnumber5',
427
        homebranch     => $branchcode_1,
428
        holdingbranch  => $branchcode_1,
429
        location       => 'CART',
430
        itype          => $itemtype
431
    },
432
    $biblionumber
433
);
422
434
435
#BlankItemLocationOnCheckout
436
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 0);
437
AddIssue($borrower_1, 'barcode_5', $daysago10, 0 , $today, 0);
438
my $item3 = GetItem($itemnumber3);
439
ok($item3->{location} eq 'CART', q{UpdateItemLocationOnCheckout does not update item shelving location value from 'CART' to '' when not enabled} );
423
440
441
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 1);
442
AddIssue($borrower_1, 'barcode_5', $daysago10, 0, $today, '');
443
$item3 = GetItem($itemnumber3);
444
ok($item3->{location} eq '', q{UpdateItemLocationOnCheckout updates item shelving location value from 'CART' to '' when enabled} );
424
445
425
# Bug 14640 - Cancel the hold on checking out if asked
446
# Bug 14640 - Cancel the hold on checking out if asked
426
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
447
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
427
- 

Return to bug 21159