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 (+2 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');
2
(-)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 420-427 $item2 = GetItem( $itemnumber2 ); Link Here
420
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
420
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
421
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
421
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
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
);
423
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} );
424
441
442
t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 1);
443
AddIssue($borrower_1, 'barcode_5', $daysago10, 0, $today, '');
444
$item3 = GetItem($itemnumber3);
445
ok($item3->{location} eq '', q{UpdateItemLocationOnCheckout updates item shelving location value from 'CART' to '' when enabled} );
425
446
426
# Bug 14640 - Cancel the hold on checking out if asked
447
# Bug 14640 - Cancel the hold on checking out if asked
427
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
448
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
428
- 

Return to bug 21159