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

(-)a/C4/Circulation.pm (-15 / +7 lines)
Lines 1383-1401 sub AddIssue { Link Here
1383
                }
1383
                }
1384
              );
1384
              );
1385
1385
1386
        if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART'  ) {
1386
            if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART'  ) {
1387
        ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart.
1387
            ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart.
1388
          CartToShelf( $item->{'itemnumber'} );
1389
        }
1390
        $item->{'issues'}++;
1391
        if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1392
            UpdateTotalIssues($item->{'biblionumber'}, 1);
1393
        }
1394
1395
            if ( C4::Context->preference('ReturnToShelvingCart') ) {
1396
                # ReturnToShelvingCart is on, anything issued should be taken off the cart.
1397
                CartToShelf( $item->{'itemnumber'} );
1388
                CartToShelf( $item->{'itemnumber'} );
1398
            }
1389
            }
1390
1399
            $item->{'issues'}++;
1391
            $item->{'issues'}++;
1400
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1392
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1401
                UpdateTotalIssues( $item->{'biblionumber'}, 1 );
1393
                UpdateTotalIssues( $item->{'biblionumber'}, 1 );
Lines 1872-1882 sub AddReturn { Link Here
1872
1864
1873
    my $borrowernumber = $borrower->{'borrowernumber'} || undef;    # we don't know if we had a borrower or not
1865
    my $borrowernumber = $borrower->{'borrowernumber'} || undef;    # we don't know if we had a borrower or not
1874
1866
1875
    my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin');
1867
    my $yaml_loc = C4::Context->preference('UpdateItemLocationOnCheckin');
1876
    if ($yaml) {
1868
    if ($yaml_loc) {
1877
        $yaml = "$yaml\n\n";  # YAML is strict on ending \n. Surplus does not hurt
1869
        $yaml_loc = "$yaml_loc\n\n";  # YAML is strict on ending \n. Surplus does not hurt
1878
        my $rules;
1870
        my $rules;
1879
        eval { $rules = YAML::Load($yaml); };
1871
        eval { $rules = YAML::Load($yaml_loc); };
1880
        if ($@) {
1872
        if ($@) {
1881
            warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@";
1873
            warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@";
1882
        }
1874
        }
(-)a/C4/Items.pm (-23 / +2 lines)
Lines 84-90 BEGIN { Link Here
84
    GetLatestAcquisitions
84
    GetLatestAcquisitions
85
85
86
        CartToShelf
86
        CartToShelf
87
        ShelfToCart
88
87
89
	GetAnalyticsCount
88
	GetAnalyticsCount
90
89
Lines 199-225 sub CartToShelf { Link Here
199
    }
198
    }
200
}
199
}
201
200
202
=head2 ShelfToCart
203
204
  ShelfToCart($itemnumber);
205
206
Set the current shelving location of the item
207
to shelving cart ('CART').
208
209
=cut
210
211
sub ShelfToCart {
212
    my ( $itemnumber ) = @_;
213
214
    unless ( $itemnumber ) {
215
        croak "FAILED ShelfToCart() - no itemnumber supplied";
216
    }
217
218
    my $item = GetItem($itemnumber);
219
    $item->{'location'} = 'CART';
220
    ModItem($item, undef, $itemnumber);
221
}
222
223
=head2 AddItemFromMarc
201
=head2 AddItemFromMarc
224
202
225
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
203
  my ($biblionumber, $biblioitemnumber, $itemnumber) 
Lines 619-627 sub ModItemTransfer { Link Here
619
    my ( $itemnumber, $frombranch, $tobranch ) = @_;
597
    my ( $itemnumber, $frombranch, $tobranch ) = @_;
620
598
621
    my $dbh = C4::Context->dbh;
599
    my $dbh = C4::Context->dbh;
600
    my $item = GetItem( $itemnumber );
622
601
623
    # Remove the 'shelving cart' location status if it is being used.
602
    # Remove the 'shelving cart' location status if it is being used.
624
    CartToShelf( $itemnumber ) if ( C4::Context->preference("ReturnToShelvingCart") );
603
    CartToShelf( $itemnumber ) if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' );
625
604
626
    #new entry in branchtransfers....
605
    #new entry in branchtransfers....
627
    my $sth = $dbh->prepare(
606
    my $sth = $dbh->prepare(
(-)a/C4/Reserves.pm (-4 / +5 lines)
Lines 1158-1164 sub ModReserveStatus { Link Here
1158
    my $sth_set = $dbh->prepare($query);
1158
    my $sth_set = $dbh->prepare($query);
1159
    $sth_set->execute( $newstatus, $itemnumber );
1159
    $sth_set->execute( $newstatus, $itemnumber );
1160
1160
1161
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1161
    my $item = GetItem($itemnumber);
1162
    if ( ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART'  ) && $newstatus ) {
1162
      CartToShelf( $itemnumber );
1163
      CartToShelf( $itemnumber );
1163
    }
1164
    }
1164
}
1165
}
Lines 1210-1218 sub ModReserveAffect { Link Here
1210
      if ( !$transferToDo && !$already_on_shelf );
1211
      if ( !$transferToDo && !$already_on_shelf );
1211
1212
1212
    _FixPriority( { biblionumber => $biblionumber } );
1213
    _FixPriority( { biblionumber => $biblionumber } );
1213
1214
    my $item = GetItem($itemnumber);
1214
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1215
    if ( ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART'  ) ) {
1215
        CartToShelf($itemnumber);
1216
      CartToShelf( $itemnumber );
1216
    }
1217
    }
1217
1218
1218
    return;
1219
    return;
(-)a/C4/UsageStats.pm (-2 lines)
Lines 143-149 sub BuildReport { Link Here
143
        AutoRemoveOverduesRestrictions
143
        AutoRemoveOverduesRestrictions
144
        CircControl
144
        CircControl
145
        HomeOrHoldingBranch
145
        HomeOrHoldingBranch
146
        InProcessingToShelvingCart
147
        IssueLostItem
146
        IssueLostItem
148
        IssuingInProcess
147
        IssuingInProcess
149
        ManInvInNoissuesCharge
148
        ManInvInNoissuesCharge
Lines 152-158 sub BuildReport { Link Here
152
        RenewalSendNotice
151
        RenewalSendNotice
153
        RentalsInNoissuesCharge
152
        RentalsInNoissuesCharge
154
        ReturnBeforeExpiry
153
        ReturnBeforeExpiry
155
        ReturnToShelvingCart
156
        TransfersMaxDaysWarning
154
        TransfersMaxDaysWarning
157
        UseBranchTransferLimits
155
        UseBranchTransferLimits
158
        useDaysMode
156
        useDaysMode
(-)a/installer/data/mysql/sysprefs.sql (-2 lines)
Lines 204-210 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
204
('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
204
('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
205
('OnSiteCheckouts','0','','Enable/Disable the on-site checkouts feature','YesNo'),
205
('OnSiteCheckouts','0','','Enable/Disable the on-site checkouts feature','YesNo'),
206
('OnSiteCheckoutsForce','0','','Enable/Disable the on-site for all cases (Even if a user is debarred, etc.)','YesNo'),
206
('OnSiteCheckoutsForce','0','','Enable/Disable the on-site for all cases (Even if a user is debarred, etc.)','YesNo'),
207
('InProcessingToShelvingCart','0','','If set, when any item with a location code of PROC is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
208
('INTRAdidyoumean','',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
207
('INTRAdidyoumean','',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
209
('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'),
208
('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'),
210
('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'),
209
('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'),
Lines 456-462 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
456
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
455
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
457
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
456
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
458
('ReturnpathDefault','',NULL,'Use this email address as return path or bounce address for undeliverable emails','Free'),
457
('ReturnpathDefault','',NULL,'Use this email address as return path or bounce address for undeliverable emails','Free'),
459
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
460
('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'),
458
('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'),
461
('RisExportAdditionalFields',  '', NULL ,  'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.',  'textarea'),
459
('RisExportAdditionalFields',  '', NULL ,  'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.',  'textarea'),
462
('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
460
('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+2 lines)
Lines 44-49 Link Here
44
    var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" );
44
    var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" );
45
    var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" );
45
    var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" );
46
    var MSG_LOADING = _( "Loading..." );
46
    var MSG_LOADING = _( "Loading..." );
47
    var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values");
48
    var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:");
47
49
48
//]]>
50
//]]>
49
</script>
51
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/authorised_values.tt (-2 / +2 lines)
Lines 16-22 Link Here
16
    <li>'BOR_NOTES' is for values for custom patron notes that appear on the circulation screen and the OPAC.</li>
16
    <li>'BOR_NOTES' is for values for custom patron notes that appear on the circulation screen and the OPAC.</li>
17
    <li>'Bsort1' is for patron statistical purposes.</li>
17
    <li>'Bsort1' is for patron statistical purposes.</li>
18
    <li>'Bsort2' is used for patron statistical purposes.</li>
18
    <li>'Bsort2' is used for patron statistical purposes.</li>
19
    <li>'CART' is the shelving cart location, used by InProcessingToShelvingCart and ReturnToShelvingCart</li>
19
    <li>'CART' is the shelving cart location, used by UpdateItemLocationOnCheckin </li>
20
    <li>'CCODE' is for collection codes (appears when cataloging and working with items).</li>
20
    <li>'CCODE' is for collection codes (appears when cataloging and working with items).</li>
21
    <li>'DAMAGED' is for descriptions of damaged items, and appears when cataloging and working with items.</li>
21
    <li>'DAMAGED' is for descriptions of damaged items, and appears when cataloging and working with items.</li>
22
    <li>'HINGS_AS' is for General Holdings: Acquisition Status Designator, a data element that specifies the acquisition status for the unit at the time of the holdings report.</li>
22
    <li>'HINGS_AS' is for General Holdings: Acquisition Status Designator, a data element that specifies the acquisition status for the unit at the time of the holdings report.</li>
Lines 32-38 Link Here
32
</li>
32
</li>
33
    <li>'MANUAL_INV' includes values for manual invoicing.</li>
33
    <li>'MANUAL_INV' includes values for manual invoicing.</li>
34
    <li>'NOT_LOAN' is used to list reasons why a title is not for loan.</li>
34
    <li>'NOT_LOAN' is used to list reasons why a title is not for loan.</li>
35
    <li>'PROC' is for the location to be used for NewItemsDefaultLocation (change description as desired), also the location expected by InProcessingToShelvingCart.</li>
35
    <li>'PROC' is for the location to be used for NewItemsDefaultLocation (change description as desired), also a special location for UpdateItemLocationOnCheckin.</li>
36
    <li>'REPORT_GROUP' provides a way to sort and filter your reports, the default values in this category include the Koha modules (Accounts, Acquisitions, Catalog, Circulation, Patrons)</li>
36
    <li>'REPORT_GROUP' provides a way to sort and filter your reports, the default values in this category include the Koha modules (Accounts, Acquisitions, Catalog, Circulation, Patrons)</li>
37
    <li>'REPORT_SUBGROUP' can be used to further sort and filter your reports. This category is empty by default. Values here need to include the authorized value code from REPORT_GROUP in the Description (OPAC) field to link the subgroup to the appropriate group.</li>
37
    <li>'REPORT_SUBGROUP' can be used to further sort and filter your reports. This category is empty by default. Values here need to include the authorized value code from REPORT_GROUP in the Description (OPAC) field to link the subgroup to the appropriate group.</li>
38
    <li>'RESTRICTED' is used for the restricted status of an item</li>
38
    <li>'RESTRICTED' is used for the restricted status of an item</li>
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-4 / +4 lines)
Lines 141-158 $( document ).ready( function () { Link Here
141
    $("#pref_UpdateItemLocationOnCheckin").change(function(){
141
    $("#pref_UpdateItemLocationOnCheckin").change(function(){
142
        var the_text = $(this).val();
142
        var the_text = $(this).val();
143
        var alert_text = '';
143
        var alert_text = '';
144
        if ( the_text.indexOf('_ALL_:') != -1 ) alert_text= _("Note: _ALL_ value will override all other values") + '\n';
144
        if ( the_text.indexOf('_ALL_:') != -1 ) alert_text = MSG_ALL_VALUE_WARN + '\n';
145
        var split_text  =the_text.split("\n");
145
        var split_text  =the_text.split("\n");
146
        var alert_issues = '';
146
        var alert_issues = '';
147
        var issue_count = 0;
147
        var issue_count = 0;
148
        var reg_check = /.*:\s.*/;
148
        var reg_check = /.*:\s.*/;
149
        for (var i=0; i < split_text.length; i++){
149
        for (var i=0; i < split_text.length; i++){
150
            if ( !split_text[i].match(reg_check) && split_text[i].length ) {
150
            if ( !split_text[i].match(reg_check) && split_text[i].length ) {
151
            alert_issues+=split_text[i]+"\n";
151
                alert_issues+=split_text[i]+"\n";
152
            issue_count++;
152
                issue_count++;
153
            }
153
            }
154
        }
154
        }
155
        if (issue_count) alert_text += "\n"+_("The following values are not formatted correctly:")+"\n"+alert_issues;
155
        if (issue_count) alert_text += "\n"+ MSG_UPD_LOC_FORMAT_WARN  +"\n"+alert_issues;
156
        if ( alert_text.length )  alert(alert_text);
156
        if ( alert_text.length )  alert(alert_text);
157
    });
157
    });
158
158
(-)a/svc/checkin (-14 lines)
Lines 60-79 $data->{itemnumber} = $itemnumber; Link Here
60
$data->{borrowernumber} = $borrowernumber;
60
$data->{borrowernumber} = $borrowernumber;
61
$data->{branchcode}     = $branchcode;
61
$data->{branchcode}     = $branchcode;
62
62
63
if ( C4::Context->preference("InProcessingToShelvingCart") ) {
64
    my $item = GetItem($itemnumber);
65
    if ( $item->{'location'} eq 'PROC' ) {
66
        $item->{'location'} = 'CART';
67
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
68
    }
69
}
70
71
if ( C4::Context->preference("ReturnToShelvingCart") ) {
72
    my $item = GetItem($itemnumber);
73
    $item->{'location'} = 'CART';
74
    ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
75
}
76
77
my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber });
63
my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber });
78
$data->{patronnote} = $checkout ? $checkout->note : q||;
64
$data->{patronnote} = $checkout ? $checkout->note : q||;
79
65
(-)a/t/db_dependent/Circulation/Returns.t (-47 / +7 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 4;
20
use Test::More tests => 3;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 59-105 my $rule = Koha::IssuingRule->new( Link Here
59
);
59
);
60
$rule->store();
60
$rule->store();
61
61
62
subtest "InProcessingToShelvingCart tests" => sub {
63
64
    plan tests => 2;
65
66
    $branch = $builder->build({ source => 'Branch' })->{ branchcode };
67
    my $permanent_location = 'TEST';
68
    my $location           = 'PROC';
69
70
    # Create a biblio record with biblio-level itemtype
71
    my $record = MARC::Record->new();
72
    my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
73
    my $built_item = $builder->build({
74
        source => 'Item',
75
        value  => {
76
            biblionumber  => $biblionumber,
77
            homebranch    => $branch,
78
            holdingbranch => $branch,
79
            location      => $location,
80
            permanent_location => $permanent_location
81
        }
82
    });
83
    my $barcode = $built_item->{ barcode };
84
    my $itemnumber = $built_item->{ itemnumber };
85
    my $item;
86
87
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 1 );
88
    AddReturn( $barcode, $branch );
89
    $item = GetItem( $itemnumber );
90
    is( $item->{location}, 'CART',
91
        "InProcessingToShelvingCart functions as intended" );
92
93
    $item->{location} = $location;
94
    ModItem( $item, undef, $itemnumber );
95
96
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 0 );
97
    AddReturn( $barcode, $branch );
98
    $item = GetItem( $itemnumber );
99
    is( $item->{location}, $permanent_location,
100
        "InProcessingToShelvingCart functions as intended" );
101
};
102
103
62
104
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
63
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
105
64
Lines 174-185 subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { Link Here
174
133
175
    is( $stat->itemtype, $ilevel_itemtype,
134
    is( $stat->itemtype, $ilevel_itemtype,
176
        "item-level itype recorded on statistics for return");
135
        "item-level itype recorded on statistics for return");
177
    warning_like { AddIssue( $borrower, $item_without_itemtype->{ barcode } ) }
136
    warnings_like { AddIssue( $borrower, $item_without_itemtype->{ barcode } ) }
178
                 qr/^item-level_itypes set but no itemtype set for item/,
137
                 [qr/^item-level_itypes set but no itemtype set for item/,qr/^item-level_itypes set but no itemtype set for item/,qr/^item-level_itypes set but no itemtype set for item/],
179
                 'Item without itemtype set raises warning on AddIssue';
138
                 'Item without itemtype set raises warning on AddIssue';
180
    warning_like { AddReturn( $item_without_itemtype->{ barcode }, $branch ) }
139
    warnings_like { AddReturn( $item_without_itemtype->{ barcode }, $branch ) }
181
                 qr/^item-level_itypes set but no itemtype set for item/,
140
                [qr/^item-level_itypes set but no itemtype set for item/,qr/^item-level_itypes set but no itemtype set for item/,qr/^item-level_itypes set but no itemtype set for item/],
182
                 'Item without itemtype set raises warning on AddReturn';
141
                 'Item without itemtype set raises warnings on AddReturn';
183
    # Test biblio-level itemtype was recorded on the 'statistics' table
142
    # Test biblio-level itemtype was recorded on the 'statistics' table
184
    $stat = $schema->resultset('Statistic')->search({
143
    $stat = $schema->resultset('Statistic')->search({
185
        branch     => $branch,
144
        branch     => $branch,
Lines 316-320 subtest 'Handle ids duplication' => sub { Link Here
316
    isnt( $original_checkout->issue_id, $new_checkout->{issue_id}, 'AddReturn should return the issue with the new issue_id' );
275
    isnt( $original_checkout->issue_id, $new_checkout->{issue_id}, 'AddReturn should return the issue with the new issue_id' );
317
    isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' );
276
    isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' );
318
};
277
};
278
$schema->storage->txn_rollback;
319
279
320
1;
280
1;
(-)a/t/db_dependent/Circulation/issue.t (-15 / +15 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 33;
21
use DateTime::Duration;
20
use DateTime::Duration;
22
21
23
use t::lib::Mocks;
22
use t::lib::Mocks;
Lines 33-39 use Koha::Database; Link Here
33
use Koha::DateUtils;
32
use Koha::DateUtils;
34
use Koha::Library;
33
use Koha::Library;
35
34
36
use Test::More tests => 44;
35
use Test::More tests => 45;
37
36
38
BEGIN {
37
BEGIN {
39
    require_ok('C4::Circulation');
38
    require_ok('C4::Circulation');
Lines 370-398 my $itemnumber2; Link Here
370
    {
369
    {
371
        barcode        => 'barcode_4',
370
        barcode        => 'barcode_4',
372
        itemcallnumber => 'callnumber4',
371
        itemcallnumber => 'callnumber4',
373
        homebranch     => $samplebranch1->{branchcode},
372
        homebranch     => $branchcode_1,
374
        holdingbranch  => $samplebranch1->{branchcode},
373
        holdingbranch  => $branchcode_1,
375
        location => 'FIC',
374
        location => 'FIC',
375
        itype          => $itemtype
376
    },
376
    },
377
    $biblionumber
377
    $biblionumber
378
);
378
);
379
379
380
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', q{} );
380
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} );
381
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
381
AddReturn( 'barcode_4', $branchcode_1 );
382
my $item2 = GetItem( $itemnumber2 );
382
my $item2 = GetItem( $itemnumber2 );
383
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
383
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
384
384
385
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
385
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
386
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
386
AddReturn( 'barcode_4', $branchcode_1 );
387
$item2 = GetItem( $itemnumber2 );
387
$item2 = GetItem( $itemnumber2 );
388
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
388
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
389
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
389
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
390
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
390
AddReturn( 'barcode_4', $branchcode_1 );
391
$item2 = GetItem( $itemnumber2 );
391
$item2 = GetItem( $itemnumber2 );
392
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
392
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
393
393
394
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
394
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
395
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
395
AddReturn( 'barcode_4', $branchcode_1 );
396
$item2 = GetItem( $itemnumber2 );
396
$item2 = GetItem( $itemnumber2 );
397
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
397
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
398
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
398
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
Lines 400-414 AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' ); Link Here
400
$item2 = GetItem( $itemnumber2 );
400
$item2 = GetItem( $itemnumber2 );
401
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
401
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
402
402
403
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
403
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
404
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
404
AddReturn( 'barcode_4', $branchcode_1 );
405
$item2 = GetItem( $itemnumber2 );
405
$item2 = GetItem( $itemnumber2 );
406
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
406
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
407
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
407
AddReturn( 'barcode_4', $branchcode_1 );
408
$item2 = GetItem( $itemnumber2 );
408
$item2 = GetItem( $itemnumber2 );
409
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
409
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
410
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
410
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
411
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
411
AddReturn( 'barcode_4', $branchcode_1 );
412
$item2 = GetItem( $itemnumber2 );
412
$item2 = GetItem( $itemnumber2 );
413
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
413
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
414
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
414
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
(-)a/t/db_dependent/UsageStats.t (-3 lines)
Lines 396-402 sub mocking_systempreferences_to_a_set_value { Link Here
396
        CircControl
396
        CircControl
397
        HomeOrHoldingBranch
397
        HomeOrHoldingBranch
398
        HomeOrHoldingBranchReturn
398
        HomeOrHoldingBranchReturn
399
        InProcessingToShelvingCart
400
        IssueLostItem
399
        IssueLostItem
401
        IssuingInProcess
400
        IssuingInProcess
402
        ManInvInNoissuesCharge
401
        ManInvInNoissuesCharge
Lines 405-411 sub mocking_systempreferences_to_a_set_value { Link Here
405
        RenewalSendNotice
404
        RenewalSendNotice
406
        RentalsInNoissuesCharge
405
        RentalsInNoissuesCharge
407
        ReturnBeforeExpiry
406
        ReturnBeforeExpiry
408
        ReturnToShelvingCart
409
        TransfersMaxDaysWarning
407
        TransfersMaxDaysWarning
410
        UseBranchTransferLimits
408
        UseBranchTransferLimits
411
        useDaysMode
409
        useDaysMode
412
- 

Return to bug 14576