[Koha-patches] [PATCH] removing disused C4::Serials functions

Galen Charlton galen.charlton at liblime.com
Tue Jun 9 16:31:02 CEST 2009


The following functions are no longer in use:

* old_newsubscription
* old_modsubscription
* old_getserials
---
 C4/Serials.pm             |  227 ---------------------------------------------
 t/lib/KohaTest/Serials.pm |    3 -
 2 files changed, 0 insertions(+), 230 deletions(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index 2de4ab3..26b08db 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -55,7 +55,6 @@ BEGIN {
     &reorder_members
     &check_routing &updateClaim &removeMissingIssue
     
-    &old_newsubscription &old_modsubscription &old_getserials
 	);
 }
 
@@ -2358,232 +2357,6 @@ sub abouttoexpire {
    } else {return 0}
 }
 
-=head2 old_newsubscription
-
-=over 4
-
-($subscriptionid) = &old_newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-                        $startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
-                        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-                        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-                        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-                        $numberingmethod, $status, $callnumber, $notes, $hemisphere)
-
-this function is similar to the NewSubscription subroutine but has a few different
-values passed in 
-$firstacquidate - date of first serial issue to arrive
-$irregularity - the issues not expected separated by a '|'
-- eg. monthly issue but not expecting issue for june and july would have $irregularity of '6|7'
-$numberpattern - the number for an array of labels to reconstruct the javascript correctly in the 
-   subscription-add.tmpl file
-$callnumber - display the callnumber of the serial
-$hemisphere - either 2 = southern hemisphere or 1 = northern hemisphere - used for quarterly serials
-
-return :
-the $subscriptionid number of the new subscription
-
-=back
-
-=cut
-
-sub old_newsubscription {
-    my (
-        $auser,         $aqbooksellerid,  $cost,          $aqbudgetid,
-        $biblionumber,  $startdate,       $periodicity,   $firstacquidate,
-        $dow,           $irregularity,    $numberpattern, $numberlength,
-        $weeklength,    $monthlength,     $add1,          $every1,
-        $whenmorethan1, $setto1,          $lastvalue1,    $add2,
-        $every2,        $whenmorethan2,   $setto2,        $lastvalue2,
-        $add3,          $every3,          $whenmorethan3, $setto3,
-        $lastvalue3,    $numberingmethod, $status,        $callnumber,
-        $notes,         $hemisphere
-    ) = @_;
-    my $dbh = C4::Context->dbh;
-
-    #save subscription
-    my $sth = $dbh->prepare(
-"insert into subscription (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber,
-                                                        startdate,periodicity,firstacquidate,dow,irregularity,numberpattern,numberlength,weeklength,monthlength,
-                                                                add1,every1,whenmorethan1,setto1,lastvalue1,
-                                                                add2,every2,whenmorethan2,setto2,lastvalue2,
-                                                                add3,every3,whenmorethan3,setto3,lastvalue3,
-                                                                numberingmethod, status, callnumber, notes, hemisphere) values
-                                                          (?,?,?,?,?,?,?,?,?,?,?,
-                                                                                           ?,?,?,?,?,?,?,?,?,?,?,
-                                                                                           ?,?,?,?,?,?,?,?,?,?,?,?)"
-    );
-    $sth->execute(
-        $auser,         $aqbooksellerid,
-        $cost,          $aqbudgetid,
-        $biblionumber,  format_date_in_iso($startdate),
-        $periodicity,   format_date_in_iso($firstacquidate),
-        $dow,           $irregularity,
-        $numberpattern, $numberlength,
-        $weeklength,    $monthlength,
-        $add1,          $every1,
-        $whenmorethan1, $setto1,
-        $lastvalue1,    $add2,
-        $every2,        $whenmorethan2,
-        $setto2,        $lastvalue2,
-        $add3,          $every3,
-        $whenmorethan3, $setto3,
-        $lastvalue3,    $numberingmethod,
-        $status,        $callnumber,
-        $notes,         $hemisphere
-    );
-
-    #then create the 1st waited number
-    my $subscriptionid = $dbh->{'mysql_insertid'};
-    my $enddate        = GetExpirationDate($subscriptionid);
-
-    $sth =
-      $dbh->prepare(
-"insert into subscriptionhistory (biblionumber, subscriptionid, histstartdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)"
-      );
-    $sth->execute(
-        $biblionumber, $subscriptionid,
-        format_date_in_iso($startdate),
-        format_date_in_iso($enddate),
-        "", "", "", $notes
-    );
-
-   # reread subscription to get a hash (for calculation of the 1st issue number)
-    $sth =
-      $dbh->prepare("select * from subscription where subscriptionid = ? ");
-    $sth->execute($subscriptionid);
-    my $val = $sth->fetchrow_hashref;
-
-    # calculate issue number
-    my $serialseq = GetSeq($val);
-    $sth =
-      $dbh->prepare(
-"insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)"
-      );
-    $sth->execute( $serialseq, $subscriptionid, $val->{'biblionumber'},
-        1, format_date_in_iso($startdate) );
-    return $subscriptionid;
-}
-
-=head2 old_modsubscription
-
-=over 4
-
-($subscriptionid) = &old_modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-                        $startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
-                        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
-                        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
-                        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-                        $numberingmethod, $status, $callnumber, $notes, $hemisphere, $subscriptionid)
-
-this function is similar to the ModSubscription subroutine but has a few different
-values passed in 
-$firstacquidate - date of first serial issue to arrive
-$irregularity - the issues not expected separated by a '|'
-- eg. monthly issue but not expecting issue for june and july would have $irregularity of '6|7'
-$numberpattern - the number for an array of labels to reconstruct the javascript correctly in the 
-   subscription-add.tmpl file
-$callnumber - display the callnumber of the serial
-$hemisphere - either 2 = southern hemisphere or 1 = northern hemisphere - used for quarterly serials
-
-=back
-
-=cut
-
-sub old_modsubscription {
-    my (
-        $auser,        $aqbooksellerid, $cost,           $aqbudgetid,
-        $startdate,    $periodicity,    $firstacquidate, $dow,
-        $irregularity, $numberpattern,  $numberlength,   $weeklength,
-        $monthlength,  $add1,           $every1,         $whenmorethan1,
-        $setto1,       $lastvalue1,     $innerloop1,     $add2,
-        $every2,       $whenmorethan2,  $setto2,         $lastvalue2,
-        $innerloop2,   $add3,           $every3,         $whenmorethan3,
-        $setto3,       $lastvalue3,     $innerloop3,     $numberingmethod,
-        $status,       $biblionumber,   $callnumber,     $notes,
-        $hemisphere,   $subscriptionid
-    ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare(
-"update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
-                                                   periodicity=?,firstacquidate=?,dow=?,irregularity=?,numberpattern=?,numberlength=?,weeklength=?,monthlength=?,
-                                                  add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
-                                                  add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
-                                                  add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                                                  numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, hemisphere=? where subscriptionid = ?"
-    );
-    $sth->execute(
-        $auser,        $aqbooksellerid, $cost,           $aqbudgetid,
-        $startdate,    $periodicity,    $firstacquidate, $dow,
-        $irregularity, $numberpattern,  $numberlength,   $weeklength,
-        $monthlength,  $add1,           $every1,         $whenmorethan1,
-        $setto1,       $lastvalue1,     $innerloop1,     $add2,
-        $every2,       $whenmorethan2,  $setto2,         $lastvalue2,
-        $innerloop2,   $add3,           $every3,         $whenmorethan3,
-        $setto3,       $lastvalue3,     $innerloop3,     $numberingmethod,
-        $status,       $biblionumber,   $callnumber,     $notes,
-        $hemisphere,   $subscriptionid
-    );
-    $sth->finish;
-
-    $sth =
-      $dbh->prepare("select * from subscription where subscriptionid = ? ");
-    $sth->execute($subscriptionid);
-    my $val = $sth->fetchrow_hashref;
-
-    # calculate issue number
-    my $serialseq = Get_Seq($val);
-    $sth =
-      $dbh->prepare("UPDATE serial SET serialseq = ? WHERE subscriptionid = ?");
-    $sth->execute( $serialseq, $subscriptionid );
-
-    my $enddate = subscriptionexpirationdate($subscriptionid);
-    $sth = $dbh->prepare("update subscriptionhistory set enddate=?");
-    $sth->execute( format_date_in_iso($enddate) );
-}
-
-=head2 old_getserials
-
-=over 4
-
-($totalissues, at serials) = &old_getserials($subscriptionid)
-
-this function get a hashref of serials and the total count of them
-
-return :
-$totalissues - number of serial lines
-the serials into a table. Each line of this table containts a ref to a hash which it containts
-serialid, serialseq, status,planneddate,notes,routingnotes  from tables : serial where status is not 2, 4, or 5
-
-=back
-
-=cut
-
-sub old_getserials {
-    my ($subscriptionid) = @_;
-    my $dbh = C4::Context->dbh;
-
-    # status = 2 is "arrived"
-    my $sth =
-      $dbh->prepare(
-"select serialid,serialseq, status, planneddate,notes,routingnotes from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5"
-      );
-    $sth->execute($subscriptionid);
-    my @serials;
-    my $num = 1;
-    while ( my $line = $sth->fetchrow_hashref ) {
-        $line->{ "status" . $line->{status} } =
-          1;    # fills a "statusX" value, used for template status select list
-        $line->{"planneddate"} = format_date( $line->{"planneddate"} );
-        $line->{"num"}         = $num;
-        $num++;
-        push @serials, $line;
-    }
-    $sth = $dbh->prepare("select count(*) from serial where subscriptionid=?");
-    $sth->execute($subscriptionid);
-    my ($totalissues) = $sth->fetchrow;
-    return ( $totalissues, @serials );
-}
-
 =head2 GetNextDate
 
 ($resultdate) = &GetNextDate($planneddate,$subscription)
diff --git a/t/lib/KohaTest/Serials.pm b/t/lib/KohaTest/Serials.pm
index 07aa69e..e7bb249 100644
--- a/t/lib/KohaTest/Serials.pm
+++ b/t/lib/KohaTest/Serials.pm
@@ -53,9 +53,6 @@ sub methods : Test( 1 ) {
                       getroutinglist
                       countissuesfrom
                       abouttoexpire
-                      old_newsubscription
-                      old_modsubscription
-                      old_getserials
                       in_array
                       GetNextDate
                       itemdata
-- 
1.5.6.5




More information about the Koha-patches mailing list