Bug 15168: Remove C4:Serials::ItemizeSerials
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 11 Nov 2015 08:54:12 +0000 (08:54 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 17 Nov 2015 18:34:00 +0000 (15:34 -0300)
This subroutine has been introduced in 2006, when C4::Serials has been
added to the codebase.
If you checkout this commit
commit 18d2cd099085e443d713a1546e029faa81481814
Date:   Fri Jul 7 08:45:47 2006 +0000
    this file replace C4/Bull.pm

You won't find any occurrences of this subroutine neither.

Interesting module's name by the way.

Test plan:
  git grep ItemizeSerials
should not return any result

Followed test plan, no results found.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Serials.pm
t/db_dependent/Serials.t

index 7e977df..5f348ce 100644 (file)
@@ -69,7 +69,7 @@ BEGIN {
       &HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire
       &GetSubscriptionHistoryFromSubscriptionId
 
-      &GetNextSeq &GetSeq &NewIssue           &ItemizeSerials    &GetSerials
+      &GetNextSeq &GetSeq &NewIssue           &GetSerials
       &GetLatestSerials   &ModSerialStatus    &GetNextDate       &GetSerials2
       &ReNewSubscription  &GetLateOrMissingIssues
       &GetSerialInformation                   &AddItem2Serial
@@ -1588,141 +1588,6 @@ sub NewIssue {
     return $serialid;
 }
 
-=head2 ItemizeSerials
-
-ItemizeSerials($serialid, $info);
-$info is a hashref containing  barcode branch, itemcallnumber, status, location
-$serialid the serialid
-return :
-1 if the itemize is a succes.
-0 and @error otherwise. @error containts the list of errors found.
-
-=cut
-
-sub ItemizeSerials {
-    my ( $serialid, $info ) = @_;
-
-    return unless ($serialid);
-
-    my $now = POSIX::strftime( "%Y-%m-%d", localtime );
-
-    my $dbh   = C4::Context->dbh;
-    my $query = qq|
-        SELECT *
-        FROM   serial
-        WHERE  serialid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialid);
-    my $data = $sth->fetchrow_hashref;
-    if ( C4::Context->preference("RoutingSerials") ) {
-
-        # check for existing biblioitem relating to serial issue
-        my ( $count, @results ) = GetBiblioItemByBiblioNumber( $data->{'biblionumber'} );
-        my $bibitemno = 0;
-        for ( my $i = 0 ; $i < $count ; $i++ ) {
-            if ( $results[$i]->{'volumeddesc'} eq $data->{'serialseq'} . ' (' . $data->{'planneddate'} . ')' ) {
-                $bibitemno = $results[$i]->{'biblioitemnumber'};
-                last;
-            }
-        }
-        if ( $bibitemno == 0 ) {
-            my $sth = $dbh->prepare( "SELECT * FROM biblioitems WHERE biblionumber = ? ORDER BY biblioitemnumber DESC" );
-            $sth->execute( $data->{'biblionumber'} );
-            my $biblioitem = $sth->fetchrow_hashref;
-            $biblioitem->{'volumedate'}  = $data->{planneddate};
-            $biblioitem->{'volumeddesc'} = $data->{serialseq} . ' (' . format_date( $data->{'planneddate'} ) . ')';
-            $biblioitem->{'dewey'}       = $info->{itemcallnumber};
-        }
-    }
-
-    my $fwk = GetFrameworkCode( $data->{'biblionumber'} );
-    if ( $info->{barcode} ) {
-        my @errors;
-        if ( is_barcode_in_use( $info->{barcode} ) ) {
-            push @errors, 'barcode_not_unique';
-        } else {
-            my $marcrecord = MARC::Record->new();
-            my ( $tag, $subfield ) = GetMarcFromKohaField( "items.barcode", $fwk );
-            my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{barcode} );
-            $marcrecord->insert_fields_ordered($newField);
-            if ( $info->{branch} ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.homebranch", $fwk );
-
-                #warn "items.homebranch : $tag , $subfield";
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{branch} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{branch} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-                ( $tag, $subfield ) = GetMarcFromKohaField( "items.holdingbranch", $fwk );
-
-                #warn "items.holdingbranch : $tag , $subfield";
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{branch} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{branch} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            if ( $info->{itemcallnumber} ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.itemcallnumber", $fwk );
-
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{itemcallnumber} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{itemcallnumber} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            if ( $info->{notes} ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.itemnotes", $fwk );
-
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{notes} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{notes} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            if ( $info->{location} ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.location", $fwk );
-
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{location} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{location} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            if ( $info->{status} ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.notforloan", $fwk );
-
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $info->{status} );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{status} );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            if ( C4::Context->preference("RoutingSerials") ) {
-                my ( $tag, $subfield ) = GetMarcFromKohaField( "items.dateaccessioned", $fwk );
-                if ( $marcrecord->field($tag) ) {
-                    $marcrecord->field($tag)->add_subfields( "$subfield" => $now );
-                } else {
-                    my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $now );
-                    $marcrecord->insert_fields_ordered($newField);
-                }
-            }
-            require C4::Items;
-            C4::Items::AddItemFromMarc( $marcrecord, $data->{'biblionumber'} );
-            return 1;
-        }
-        return ( 0, @errors );
-    }
-}
-
 =head2 HasSubscriptionStrictlyExpired
 
 1 or 0 = HasSubscriptionStrictlyExpired($subscriptionid)
index 3a4942d..1f3ebb0 100644 (file)
@@ -15,7 +15,7 @@ use C4::Bookseller;
 use C4::Biblio;
 use C4::Budgets;
 use Koha::DateUtils;
-use Test::More tests => 46;
+use Test::More tests => 45;
 
 BEGIN {
     use_ok('C4::Serials');
@@ -175,8 +175,6 @@ is(C4::Serials::ModSerialStatus(),undef, 'test modding serials');
 
 is(C4::Serials::NewIssue(), undef, 'test getting 0 when nothing is entered');
 
-is(C4::Serials::ItemizeSerials(),undef, 'test getting nothing when nothing is entered');
-
 is(C4::Serials::HasSubscriptionStrictlyExpired(), undef, 'test if the subscriptions has expired');
 is(C4::Serials::HasSubscriptionExpired(), undef, 'test if the subscriptions has expired');