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

(-)a/C4/Circulation.pm (-2 / +13 lines)
Lines 3610-3618 sub ReturnLostItem{ Link Here
3610
3610
3611
3611
3612
sub LostItem{
3612
sub LostItem{
3613
    my ($itemnumber, $mark_returned) = @_;
3613
    my ($itemnumber, $mark_lost_from, $force_mark_returned) = @_;
3614
3614
3615
    $mark_returned //= C4::Context->preference('MarkLostItemsAsReturned');
3615
    unless ( $mark_lost_from ) {
3616
        # Temporary check to avoid regressions
3617
        die q|LostItem called without $mark_lost_from, check the API.|;
3618
    }
3619
3620
    my $mark_returned;
3621
    if ( $force_mark_returned ) {
3622
        $mark_returned = 1;
3623
    } else {
3624
        my $pref = C4::Context->preference('MarkLostItemsAsReturned') // q{};
3625
        $mark_returned = ( $mark_lost_from =~ m|$pref| );
3626
    }
3616
3627
3617
    my $dbh = C4::Context->dbh();
3628
    my $dbh = C4::Context->dbh();
3618
    my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title 
3629
    my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title 
(-)a/catalogue/updateitem.pl (-1 / +1 lines)
Lines 80-85 elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form Link Here
80
80
81
ModItem($item_changes, $biblionumber, $itemnumber);
81
ModItem($item_changes, $biblionumber, $itemnumber);
82
82
83
LostItem($itemnumber) if $itemlost;
83
LostItem($itemnumber, 'moredetail') if $itemlost;
84
84
85
print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
85
print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
(-)a/cataloguing/additem.pl (-1 / +1 lines)
Lines 695-701 if ($op eq "additem") { Link Here
695
        $itemnumber = q{};
695
        $itemnumber = q{};
696
        my $olditemlost = $item->{itemlost};
696
        my $olditemlost = $item->{itemlost};
697
        my $newitemlost = $newitem->{itemlost};
697
        my $newitemlost = $newitem->{itemlost};
698
        LostItem( $item->{itemnumber} )
698
        LostItem( $item->{itemnumber}, 'additem' )
699
            if $newitemlost && $newitemlost ge '1' && !$olditemlost;
699
            if $newitemlost && $newitemlost ge '1' && !$olditemlost;
700
    }
700
    }
701
    $nextop="additem";
701
    $nextop="additem";
(-)a/installer/data/mysql/atomicupdate/bug_19974.perl (+26 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    my ( $original_value ) = $dbh->selectrow_array(q|
4
        SELECT value FROM systempreferences WHERE variable="MarkLostItemsAsReturned"
5
    |);
6
    if ( $original_value and $original_value eq '1' ) {
7
        $dbh->do(q|
8
            UPDATE systempreferences
9
            SET type="multiple",
10
                options="batchmod|moredetail|cronjob|additem",
11
                value="batchmod|moredetail|cronjob|additem"
12
            WHERE variable="MarkLostItemsAsReturned"
13
        |);
14
    } else {
15
        $dbh->do(q|
16
            UPDATE systempreferences
17
            SET type="multiple",
18
                options="batchmod|moredetail|cronjob|additem",
19
                value=""
20
            WHERE variable="MarkLostItemsAsReturned"
21
        |);
22
    }
23
24
    SetVersion( $DBversion );
25
    print "Upgrade to $DBversion done (Bug 19974 - Make MarkLostItemsAsReturned multiple)\n";
26
}
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 260-266 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
260
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
260
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
261
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
261
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
262
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
262
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
263
('MarkLostItemsAsReturned','1','','Mark items as returned when flagged as lost','YesNo'),
263
('MarkLostItemsAsReturned','batchmod|moredetail|cronjob|additem','batchmod|moredetail|cronjob|additem','Mark items as returned when flagged as lost','multiple'),
264
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
264
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
265
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
265
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
266
('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'),
266
('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-4 / +7 lines)
Lines 413-423 Circulation: Link Here
413
                  nothing : "do nothing"
413
                  nothing : "do nothing"
414
            - .
414
            - .
415
        -
415
        -
416
            - "Mark items as returned when flagged as lost "
416
            - pref: MarkLostItemsAsReturned
417
            - pref: MarkLostItemsAsReturned
417
              choices:
418
              multiple:
418
                  yes: "Mark"
419
                cronjob: "from the longoverdue cronjob"
419
                  no: "Do not mark"
420
                batchmod: "from the batch item modification tool"
420
            - "items as returned when flagged as lost"
421
                additem: "when cataloguing an item"
422
                moredetail: "from the items tab of the catalog module"
423
            - .
421
        -
424
        -
422
            - pref: AllowMultipleIssuesOnABiblio
425
            - pref: AllowMultipleIssuesOnABiblio
423
              choices:
426
              choices:
(-)a/misc/cronjobs/longoverdue.pl (-1 / +1 lines)
Lines 310-316 foreach my $startrange (sort keys %$lost) { Link Here
310
            if($confirm) {
310
            if($confirm) {
311
                ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'});
311
                ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'});
312
                if ( $charge && $charge eq $lostvalue ) {
312
                if ( $charge && $charge eq $lostvalue ) {
313
                    LostItem( $row->{'itemnumber'}, $mark_returned );
313
                    LostItem( $row->{'itemnumber'}, 'cronjob', $mark_returned );
314
                } elsif ( $mark_returned ) {
314
                } elsif ( $mark_returned ) {
315
                    my $patron = Koha::Patrons->find( $row->{borrowernumber} );
315
                    my $patron = Koha::Patrons->find( $row->{borrowernumber} );
316
                    MarkIssueReturned($row->{borrowernumber},$row->{itemnumber},undef,undef,$patron->privacy)
316
                    MarkIssueReturned($row->{borrowernumber},$row->{itemnumber},undef,undef,$patron->privacy)
(-)a/t/db_dependent/Circulation.t (-2 / +2 lines)
Lines 846-852 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
846
    t::lib::Mocks::mock_preference('WhenLostForgiveFine','0');
846
    t::lib::Mocks::mock_preference('WhenLostForgiveFine','0');
847
    t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0');
847
    t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0');
848
848
849
    LostItem( $itemnumber, 1 );
849
    LostItem( $itemnumber, 'test', 1 );
850
850
851
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
851
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
852
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
852
    ok( !$item->onloan(), "Lost item marked as returned has false onloan value" );
Lines 871-877 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
871
        }
871
        }
872
    );
872
    );
873
873
874
    LostItem( $itemnumber2, 0 );
874
    LostItem( $itemnumber2, 'test', 0 );
875
875
876
    my $item2 = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber2);
876
    my $item2 = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber2);
877
    ok( $item2->onloan(), "Lost item *not* marked as returned has true onloan value" );
877
    ok( $item2->onloan(), "Lost item *not* marked as returned has true onloan value" );
(-)a/tools/batchMod.pl (-2 / +1 lines)
Lines 207-213 if ($op eq "action") { Link Here
207
                if ( $modified ) {
207
                if ( $modified ) {
208
                    eval {
208
                    eval {
209
                        if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) {
209
                        if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) {
210
                            LostItem($itemnumber) if $item->{itemlost} and not $itemdata->{itemlost};
210
                            LostItem($itemnumber, 'batchmod') if $item->{itemlost} and not $itemdata->{itemlost};
211
                        }
211
                        }
212
                    };
212
                    };
213
                }
213
                }
214
- 

Return to bug 19974