bug 3314: remove disused scripts and API functions
authorGalen Charlton <galen.charlton@liblime.com>
Mon, 8 Jun 2009 20:11:42 +0000 (15:11 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 8 Jun 2009 22:03:05 +0000 (17:03 -0500)
The distributedto column of the subscription table is
no longer used, having been replaced by the serials
routing list table.  This patch removes two C4::Serials
functions and a script and template, none of which were
reachable by current code:

C4::Serials::GetDistributedTo()
C4::Serials::SetDistributedTo()
koha-tmpl/intranet-tmpl/prog/en/modules/serials/distributedto.tmpl
serials/distributedto.pl

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/Serials.pm
koha-tmpl/intranet-tmpl/prog/en/modules/serials/distributedto.tmpl [deleted file]
serials/distributedto.pl [deleted file]
t/lib/KohaTest/Serials.pm

index 96908bf..7d81586 100644 (file)
@@ -51,7 +51,6 @@ BEGIN {
     
     &UpdateClaimdateIssues
     &GetSuppliersWithLateIssues             &getsupplierbyserialid
-    &GetDistributedTo   &SetDistributedTo
     &getroutinglist     &delroutingmember   &addroutingmember
     &reorder_members
     &check_routing &updateClaim &removeMissingIssue
@@ -855,27 +854,6 @@ sub GetLatestSerials {
     return \@serials;
 }
 
-=head2 GetDistributedTo
-
-=over 4
-
-$distributedto=GetDistributedTo($subscriptionid)
-This function select the old previous value of distributedto in the database.
-
-=back
-
-=cut
-
-sub GetDistributedTo {
-    my $dbh = C4::Context->dbh;
-    my $distributedto;
-    my $subscriptionid = @_;
-    my $query = "SELECT distributedto FROM subscription WHERE subscriptionid=?";
-    my $sth   = $dbh->prepare($query);
-    $sth->execute($subscriptionid);
-    return ($distributedto) = $sth->fetchrow;
-}
-
 =head2 GetNextSeq
 
 =over 4
@@ -1830,29 +1808,6 @@ sub HasSubscriptionExpired {
     return 0;  # Notice that you'll never get here.
 }
 
-=head2 SetDistributedto
-
-=over 4
-
-SetDistributedto($distributedto,$subscriptionid);
-This function update the value of distributedto for a subscription given on input arg.
-
-=back
-
-=cut
-
-sub SetDistributedto {
-    my ( $distributedto, $subscriptionid ) = @_;
-    my $dbh   = C4::Context->dbh;
-    my $query = qq|
-        UPDATE subscription
-        SET    distributedto=?
-        WHERE  subscriptionid=?
-    |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $distributedto, $subscriptionid );
-}
-
 =head2 DelSubscription
 
 =over 4
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/distributedto.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/distributedto.tmpl
deleted file mode 100644 (file)
index f828d4a..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Serials &rsaquo; Distribution Lists</title>
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<script language="javascript" type="text/javascript">
-//<![CDATA[
-// GPL code coming from PhpMyAdmin
-               function insertValueQuery() {
-                       var myQuery = document.Aform.distributedto;
-                       var myListBox = document.Aform.borlist;
-               
-                       if(myListBox.options.length > 0) {
-                               var chaineAj = "";
-                               var NbSelect = 0;
-                               for(var i=0; i<myListBox.options.length; i++) {
-                                       if (myListBox.options[i].selected){
-                                               NbSelect++;
-                                               if (NbSelect > 1)
-                                                       chaineAj += ", ";
-                                               chaineAj += myListBox.options[i].value;
-                                       }
-                               }
-               
-                               //IE support
-                               if (document.selection) {
-                                       myQuery.focus();
-                                       sel = document.selection.createRange();
-                                       sel.text = chaineAj;
-                                       document.Aform.insert.focus();
-                               }
-                               //MOZILLA/NETSCAPE support
-                               else if (document.Aform.distributedto.selectionStart || document.Aform.distributedto.selectionStart == "0") {
-                                       var startPos = document.Aform.distributedto.selectionStart;
-                                       var endPos = document.Aform.distributedto.selectionEnd;
-                                       var chaineSql = document.Aform.distributedto.value;
-                                       myQuery.value = chaineSql.substring(0, startPos) +''+ chaineAj+"\n" + chaineSql.substring(endPos, chaineSql.length);
-                               } else {
-                                       myQuery.value += chaineAj;
-                               }
-                       }
-               }
-               function FSaveList() {
-                       document.Aform.SaveList.value="1";
-                       document.Aform.submit();
-               }
-       //]]>
-       </script>
-</head>
-<body>
-<!-- TMPL_INCLUDE NAME="header.inc" -->
-<!-- TMPL_INCLUDE NAME="serials-search.inc" -->
-
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Distribution Lists</div>
-
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
-
-       <h1>Select borrowers or enter manually the names</h1>
-       <form action="/cgi-bin/koha/serials/distributedto.pl" method="post" name="Aform">
-                       <table>
-                       <tr>
-                       <td>
-                               <input type="text" name="searchfield" value="<!-- TMPL_VAR name="searchfield" -->" />
-                               <input type="submit" class="button" value="Filter" />
-                       </td>
-                       <td rowspan="2">
-                               <h2>Distributed to</h2>
-                               <p>
-                                       <textarea name="distributedto" rows="15" cols="30"><!-- TMPL_VAR name="distributedto" --></textarea>
-                               </p>
-                               
-                                       <!-- TMPL_IF name="save" -->
-                                               <p>saved</p>
-                                       <!-- /TMPL_IF -->
-                                       <input type="hidden" name="SaveList" value="0" />
-                                       <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
-                                       <input type="button" name="save" value="Save" class="button" onclick="FSaveList()" />
-                                       <input type="button" name="clode" value="Close" class="button" onclick="window.close()" />
-                       </td>
-                       </tr>
-                       <tr>
-                       <td>
-                               <!-- TMPL_VAR NAME="borrowername" -->
-                               <!-- TMPL_IF NAME="borlist" --><select name="borlist" size="15">
-                                       <!-- TMPL_LOOP name="borlist" -->
-                                               <option value="<!-- TMPL_VAR name="surname" --><!-- TMPL_VAR name="firstname" -->">
-                                                       <!-- TMPL_VAR name="surname" --> <!-- TMPL_VAR name="firstname" -->
-                                               </option>
-                                       <!-- /TMPL_LOOP -->
-                               </select><!-- /TMPL_IF -->
-                               <input type="button" name="insert" value="&gt;&gt;" class="button" onclick="insertValueQuery()" title="Insert" />
-                       </td>
-                       </tr>
-                       </table>
-               </form>
-       
-</div>
-</div>
-
-<div class="yui-b">
-<!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
-</div>
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/serials/distributedto.pl b/serials/distributedto.pl
deleted file mode 100755 (executable)
index af4088b..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-
-=head1 NAME
-
-distributedto
-
-=head1 DESCRIPTION
-
-this script is launched as a popup. It allows to choose for who the subscription can be distributed.
-
-=head1 PARAMETERS
-
-=over 4
-
-=item searchfield
-to filter on the members.
-
-=item distributedto
-to know if there are already some members to in the distributed list
-
-=item subscriptionid
-to know what subscription this scrpit have to distribute.
-
-=item SaveList
-
-=back
-
-=cut
-
-
-use strict;
-use CGI;
-use C4::Dates;
-use C4::Auth;
-use C4::Context;
-use C4::Output;
-
-use C4::Serials;
-use C4::Members;
-
-my $input = new CGI;
-my $searchfield=$input->param('searchfield');
-defined $searchfield or $searchfield='';
-my $distributedto=$input->param('distributedto');
-my $subscriptionid = $input->param('subscriptionid');
-$searchfield=~ s/\,//g;
-my $SaveList=$input->param('SaveList');
-my $dbh = C4::Context->dbh;
-
-$distributedto = GetDistributedTo($subscriptionid) unless $distributedto;
-
-SetDistributedto($distributedto,$subscriptionid) if ($SaveList) ;
-
-my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name => "serials/distributedto.tmpl",
-                 query => $input,
-                 type => "intranet",
-                 authnotrequired => 0,
-                 flagsrequired => {serials => 1},
-                 debug => 1,
-                 });
-
-my ($count,$results)=SearchMember($searchfield,"firstname","simple",) if $searchfield;
-my $toggle="0";
-my @loop_data =();
-for (my $i=0; $i < $count; $i++){
-    if ($i % 2){
-            $toggle=1;
-    } else {
-            $toggle=0;
-    }
-    my %row_data;
-    $row_data{toggle} = $toggle;
-    $row_data{firstname} = $results->[$i]{'firstname'};
-    $row_data{surname} = $results->[$i]{'surname'};
-    push(@loop_data, \%row_data);
-}
-$template->param(borlist => \@loop_data,
-                searchfield => $searchfield,
-                distributedto => $distributedto,
-                SaveList => $SaveList,
-                subscriptionid => $subscriptionid,
-                );
-output_html_with_http_headers $input, $cookie, $template->output;
index e572d1f..07aa69e 100644 (file)
@@ -28,7 +28,6 @@ sub methods : Test( 1 ) {
                       GetSerials
                       GetSerials2
                       GetLatestSerials
-                      GetDistributedTo
                       GetNextSeq
                       GetSeq
                       GetExpirationDate
@@ -41,7 +40,6 @@ sub methods : Test( 1 ) {
                       NewIssue
                       ItemizeSerials
                       HasSubscriptionExpired
-                      SetDistributedto
                       DelSubscription
                       DelIssue
                       GetLateOrMissingIssues