koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] first block of patches


From: Pat Eyler
Subject: [Koha-devel] first block of patches
Date: Wed Apr 3 17:06:36 2002

Since it looks like sourceforge isn't letting me update right now anyway,
and because I'd like some feedback before I go making changes, I thought
I'd pop a copy of 'cvs -Q diff -c' for my first batch of changes to the
list.  I'm also attaching three new files (C4::Koha.pm, koha.t, and
testKoha.pl)

The changes are mostly inspired by the 'Program Repair Shop' articles by
mjd and by 'Refactoring' by Martin Fowler.  If anyone has thoughts,
comments, critiques, or recommendations please let me know.

I plan on writing more pod, and writing more tests as I go.

-pate


? koha.t
? testKoha.pl
? C4/Koha.pm
Index: fines.pl
===================================================================
RCS file: /cvsroot/koha/koha/fines.pl,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 fines.pl
*** fines.pl    19 Dec 2000 23:45:51 -0000      1.1.1.1
--- fines.pl    4 Apr 2002 00:40:30 -0000
***************
*** 23,31 ****
  my $bornum2;
  for (my $i=0;$i<$count;$i++){
    my @dates=split('-',$data->[$i]->{'date_due'});
!     my $date2=Date_DaysSince999($dates[1],$dates[2],$dates[0]);
!     my $due="$dates[2]/$dates[1]/$dates[0]";
!     if ($date2 <= $date){
        $count2++;
        my $difference=$date-$date2;
        if ($bornum != $data->[$i]->{'borrowernumber'}){
--- 23,34 ----
  my $bornum2;
  for (my $i=0;$i<$count;$i++){
    my @dates=split('-',$data->[$i]->{'date_due'});
!   # not going to change this one without investigating the $date vs $date2
!   # thing ...  FIXME
!   #
!   my $date2=Date_DaysSince999($dates[1],$dates[2],$dates[0]);
!   my $due="$dates[2]/$dates[1]/$dates[0]";
!   if ($date2 <= $date){
        $count2++;
        my $difference=$date-$date2;
        if ($bornum != $data->[$i]->{'borrowernumber'}){
Index: insertdata.pl
===================================================================
RCS file: /cvsroot/koha/koha/insertdata.pl,v
retrieving revision 1.4
diff -c -r1.4 insertdata.pl
*** insertdata.pl       26 Nov 2001 02:03:23 -0000      1.4
--- insertdata.pl       4 Apr 2002 00:40:30 -0000
***************
*** 69,74 ****
--- 69,78 ----
      # is adult check guarantees;
      my ($count,$guarantees)=findguarantees($data{'borrowernumber'});
      for (my $i=0;$i<$count;$i++){
+       # FIXME
+       # It looks like the $i is only being returned to handle walking through
+       # the array, which is probably better done as a foreach loop.
+       #
        my $guaquery="update borrowers set 
streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
          
streetcity='$data{'streetcity'}',phoneday='$data{'phoneday'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}'
          ,streetaddress='$data{'address'}'
Index: loadmodules.pl
===================================================================
RCS file: /cvsroot/koha/koha/loadmodules.pl,v
retrieving revision 1.1
diff -c -r1.1 loadmodules.pl
*** loadmodules.pl      5 Feb 2001 18:48:15 -0000       1.1
--- loadmodules.pl      4 Apr 2002 00:40:30 -0000
***************
*** 18,23 ****
--- 18,27 ----


  sub acquisitions {
+     # FIXME
+     # instead of getting a hash, then reading/writing to it at least twice
+     # and up to four times, maybe this should be a different function -
+     # areAquisitionsSimple() which returns a boolean
      my %systemprefs=systemprefs();
      ($systemprefs{'acquisitions'}) || ($systemprefs{'acquisitions'}='normal');
      if ($systemprefs{'acquisitions'} eq 'simple') {
Index: memberentry.pl
===================================================================
RCS file: /cvsroot/koha/koha/memberentry.pl,v
retrieving revision 1.4
diff -c -r1.4 memberentry.pl
*** memberentry.pl      5 Jul 2001 21:37:15 -0000       1.4
--- memberentry.pl      4 Apr 2002 00:40:31 -0000
***************
*** 45,51 ****
  }

  my $cardnumber=$data->{'cardnumber'};
! my %systemprefs=systemprefs();
  if ($cardnumber eq '' && $systemprefs{'autoMemberNum'} eq '1') {
    my $dbh=C4Connect;
    my $query="select max(substring(borrowers.cardnumber,2,7)) from borrowers";
--- 45,55 ----
  }

  my $cardnumber=$data->{'cardnumber'};
! my %sysemprefs=systemprefs();
! # FIXME
! # This logic should probably be moved out of the presentation code.
! # Not tonight though.
! #
  if ($cardnumber eq '' && $systemprefs{'autoMemberNum'} eq '1') {
    my $dbh=C4Connect;
    my $query="select max(substring(borrowers.cardnumber,2,7)) from borrowers";
Index: modbibitem.pl
===================================================================
RCS file: /cvsroot/koha/koha/modbibitem.pl,v
retrieving revision 1.3
diff -c -r1.3 modbibitem.pl
*** modbibitem.pl       10 Oct 2001 19:26:14 -0000      1.3
--- modbibitem.pl       4 Apr 2002 00:40:32 -0000
***************
*** 8,15 ****
  use strict;

  use C4::Search;
- use CGI;
  use C4::Output;

  my $input = new CGI;
  #
--- 8,17 ----
  use strict;

  use C4::Search;
  use C4::Output;
+ use C4::Koha;
+ use CGI;
+

  my $input = new CGI;
  #
***************
*** 152,159 ****
  #print @items;
  my address@hidden;
  for (my $i=0;$i<$count;$i++){
!   my @temp=split('-',$items[$i]->{'datelastseen'});
!   $items[$i]->{'datelastseen'}="$temp[2]/$temp[1]/$temp[0]";
    print <<printend
  <tr valign=top gcolor=#ffffcc>
  <td><input type=checkbox name="check_group_$items[$i]->{'barcode'}"></td>
--- 154,160 ----
  #print @items;
  my address@hidden;
  for (my $i=0;$i<$count;$i++){
!   $items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
    print <<printend
  <tr valign=top gcolor=#ffffcc>
  <td><input type=checkbox name="check_group_$items[$i]->{'barcode'}"></td>
Index: moredetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/moredetail.pl,v
retrieving revision 1.3
diff -c -r1.3 moredetail.pl
*** moredetail.pl       10 Sep 2001 23:37:09 -0000      1.3
--- moredetail.pl       4 Apr 2002 00:40:32 -0000
***************
*** 6,15 ****
  use strict;
  #use DBI;
  use C4::Search;
! use CGI;
  use C4::Output;
  use C4::Acquisitions;

  my $input = new CGI;
  print $input->header;
  #whether it is called from the opac of the intranet
--- 6,16 ----
  use strict;
  #use DBI;
  use C4::Search;
! use C4::Koha;
  use C4::Output;
  use C4::Acquisitions;

+ use CGI;
  my $input = new CGI;
  print $input->header;
  #whether it is called from the opac of the intranet
***************
*** 130,143 ****
  $items[$i]->{'withdrawn'}=~ s/0/No/;
  $items[$i]->{'withdrawn'}=~ s/1/Yes/;
  $items[$i]->{'replacementprice'}+=0.00;
  my $year=substr($items[$i]->{'timestamp0'},0,4);
  my $mon=substr($items[$i]->{'timestamp0'},4,2);
  my $day=substr($items[$i]->{'timestamp0'},6,2);
  $items[$i]->{'timestamp0'}="$day/$mon/$year";
! my @temp=split('-',$items[$i]->{'dateaccessioned'});
! $items[$i]->{'dateaccessioned'}="$temp[2]/$temp[1]/$temp[0]";
! @temp=split('-',$items[$i]->{'datelastseen'});
! $items[$i]->{'datelastseen'}="$temp[2]/$temp[1]/$temp[0]";
  print <<printend
  <FONT SIZE=2  face="arial, helvetica">
  <b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
--- 131,145 ----
  $items[$i]->{'withdrawn'}=~ s/0/No/;
  $items[$i]->{'withdrawn'}=~ s/1/Yes/;
  $items[$i]->{'replacementprice'}+=0.00;
+
  my $year=substr($items[$i]->{'timestamp0'},0,4);
  my $mon=substr($items[$i]->{'timestamp0'},4,2);
  my $day=substr($items[$i]->{'timestamp0'},6,2);
  $items[$i]->{'timestamp0'}="$day/$mon/$year";
!
! $items[$i]->{'dateaccessioned'} = 
slashifyDate($items[$i]->{'dateaccessioned'});
! $items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
!
  print <<printend
  <FONT SIZE=2  face="arial, helvetica">
  <b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
Index: moremember.pl
===================================================================
RCS file: /cvsroot/koha/koha/moremember.pl,v
retrieving revision 1.9
diff -c -r1.9 moremember.pl
*** moremember.pl       13 Mar 2002 03:26:43 -0000      1.9
--- moremember.pl       4 Apr 2002 00:40:33 -0000
***************
*** 15,35 ****
  use C4::Reserves2;
  use C4::Circulation::Renewals2;
  use C4::Circulation::Circ2;
  my $input = new CGI;
  my $bornum=$input->param('bornum');

  my %env;
  print $input->header;
  #start the page and read in includes
  print startpage();
  print startmenu('member');
  my $data=borrdata('',$bornum);
! my @temp=split('-',$data->{'dateenrolled'});
! $data->{'dateenrolled'}="$temp[2]/$temp[1]/$temp[0]";
! @temp=split('-',$data->{'expiry'});
! $data->{'expiry'}="$temp[2]/$temp[1]/$temp[0]";
! @temp=split('-',$data->{'dateofbirth'});
! $data->{'dateofbirth'}="$temp[2]/$temp[1]/$temp[0]";
  if ($data->{'ethnicity'} eq 'maori'){
    $data->{'ethnicity'} = 'Maori';
  }
--- 15,58 ----
  use C4::Reserves2;
  use C4::Circulation::Renewals2;
  use C4::Circulation::Circ2;
+ use C4::Koha;
+
  my $input = new CGI;
  my $bornum=$input->param('bornum');

+
+ # FIXME
+ # this hash is never assigned, though it is used (as a placeholder?)
+ #
  my %env;
+
  print $input->header;
  #start the page and read in includes
  print startpage();
  print startmenu('member');
  my $data=borrdata('',$bornum);
!
!
! $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'});
! $data->{'expiry'} = slashifyDate($data->{'expiry'});
! $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'});
!
! # FIXME
! # turn the ethnicity into a function and make it generalizable
! # check these files to see if one convention or the other makes sense
! #   boraccount.pl
! #   imemberentry.pl
! #   jmemberentry.pl
! #   mancredit.pl
! #   maninvoice.pl
! #   member.pl
! #   memberentry.pl
! #   moremember.pl
! #   moremember.pl
! #   pay.pl
! #   placerequest.pl
! #   readingrec.pl
! #
  if ($data->{'ethnicity'} eq 'maori'){
    $data->{'ethnicity'} = 'Maori';
  }
***************
*** 42,47 ****
--- 65,71 ----
  if ($data->{'ethnicity'}eq 'asian'){
    $data->{'ethnicity'} = 'Asian';
  }
+
  print <<printend
  <FONT SIZE=6><em>$data->{'firstname'} $data->{'surname'}</em></FONT><P>
  <p>
***************
*** 97,102 ****
--- 121,130 ----

  if ($data->{'categorycode'} ne 'C'){
    print " Guarantees:";
+   # FIXME
+   # It looks like the $i is only being returned to handle walking through
+   # the array, which is probably better done as a foreach loop.
+   #
    my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
    for (my $i=0;$i<$count;$i++){
      print "<A 
HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
***************
*** 137,142 ****
--- 165,176 ----
  ;
  my %bor;
  $bor{'borrowernumber'}=$bornum;
+
+ # FIXME
+ # it looks like $numaccts is a temp variable and that the
+ # for (my $i;$i<$numaccts;$i+++)
+ # can be turned into a foreach loop instead
+ #
  my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
  #if ($numaccts > 10){
  #  $numaccts=10;
***************
*** 148,155 ****
    if ($amount2 != 0){
      print "<tr VALIGN=TOP  >";
      my $item=" &nbsp; ";
!     @temp=split('-',$accts->[$i]{'date'});
!     $accts->[$i]{'date'}="$temp[2]/$temp[1]/$temp[0]";
      if ($accts->[$i]{'accounttype'} ne 'Res'){
      #get item data
      #$item=
--- 182,190 ----
    if ($amount2 != 0){
      print "<tr VALIGN=TOP  >";
      my $item=" &nbsp; ";
!
!     $accts->[$i]{'date'} = slashifyDate($accts->[$i]{'date'});
!
      if ($accts->[$i]{'accounttype'} ne 'Res'){
      #get item data
      #$item=
***************
*** 157,162 ****
--- 192,201 ----
      print "<td>$accts->[$i]{'date'}</td>";
  #  print "<TD>$accts->[$i]{'accounttype'}</td>";
      print "<TD>";
+
+     # FIXME
+     # why set this variable if it's not going to be used?
+     #
      my $env;
      if ($accts->[$i]{'accounttype'} ne 'Res'){
        my 
$iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
***************
*** 206,213 ****
    print "<tr VALIGN=TOP  >
    <TD>";
      my $datedue=ParseDate($issue->[$i]{'date_due'});
!   @temp=split('-',$issue->[$i]{'date_due'});
!   $issue->[$i]{'date_due'}="$temp[2]/$temp[1]/$temp[0]";
    if ($datedue < $today){
      print "<font color=red>";
    }
--- 245,253 ----
    print "<tr VALIGN=TOP  >
    <TD>";
      my $datedue=ParseDate($issue->[$i]{'date_due'});
!
!   $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
!
    if ($datedue < $today){
      print "<font color=red>";
    }
***************
*** 276,285 ****
  <input type=hidden name=from value=borrower>
  printend
  ;
  my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
  for (my $i=0;$i<$rescount;$i++){
!   @temp=split('-',$reserves->[$i]{'reservedate'});
!   $reserves->[$i]{'reservedate'}="$temp[2]/$temp[1]/$temp[0]";
    print "<tr VALIGN=TOP  >
    <TD><a 
href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
    <TD>$reserves->[$i]{'reservedate'}</td>
--- 316,331 ----
  <input type=hidden name=from value=borrower>
  printend
  ;
+
  my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
+
+ # FIXME
+ # does it make sense to turn this into a foreach my $i (0..$rescount)
+ # kind of loop?
+ #
  for (my $i=0;$i<$rescount;$i++){
!   $reserves->[$i]{'reservedate'} = 
slashifyDate($reserves->[$i]{'reservedate'});
!
    print "<tr VALIGN=TOP  >
    <TD><a 
href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
    <TD>$reserves->[$i]{'reservedate'}</td>
***************
*** 310,312 ****
--- 356,360 ----

  print endmenu('member');
  print endpage();
+
+
Index: request.pl
===================================================================
RCS file: /cvsroot/koha/koha/request.pl,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 request.pl
*** request.pl  19 Dec 2000 23:45:53 -0000      1.1.1.1
--- request.pl  4 Apr 2002 00:40:33 -0000
***************
*** 6,15 ****
  use strict;
  #use DBI;
  use C4::Search;
- use CGI;
  use C4::Output;
  use C4::Reserves2;
  use C4::Acquisitions;
  my $input = new CGI;
  print $input->header;

--- 6,17 ----
  use strict;
  #use DBI;
  use C4::Search;
  use C4::Output;
  use C4::Reserves2;
  use C4::Acquisitions;
+ use C4::Koha;
+
+ use CGI;
  my $input = new CGI;
  print $input->header;

***************
*** 159,166 ****
  #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'};
  #$bor=~ s/ /%20/g;
  my $bor=$reserves->[$i]{'borrowernumber'};
! my @temp=split('-',$reserves->[$i]{'reservedate'});
! $date="$temp[2]/$temp[1]/$temp[0]";
  my $type=$reserves->[$i]{'constrainttype'};
  #print "test";
  if ($type eq 'a'){
--- 161,168 ----
  #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'};
  #$bor=~ s/ /%20/g;
  my $bor=$reserves->[$i]{'borrowernumber'};
! $date = slashifyDate($reserves->[$i]{'reservedate'});
!
  my $type=$reserves->[$i]{'constrainttype'};
  #print "test";
  if ($type eq 'a'){
Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.pl,v
retrieving revision 1.5
diff -c -r1.5 search.pl
*** search.pl   13 Mar 2002 07:46:43 -0000      1.5
--- search.pl   4 Apr 2002 00:40:34 -0000
***************
*** 10,60 ****
  my $input = new CGI;
  print $input->header;
  #print $input->dump;
! #whether it is called from the opac of the intranet
! my $type=$input->param('type');
! if ($type eq ''){
    $type = 'intra';
  }
  my $ttype=$input->param('ttype');
! #setup colours
! my $main;
! my $secondary;
! if ($type eq 'opac'){
    $main='#99cccc';
    $secondary='#efe5ef';
! } else {
!   $main='#cccc99';
!   $secondary='#ffffcc';
  }

  #print $input->Dump;
  my $blah;
  my %search;
  #build hash of users input
  my $title=validate($input->param('title'));
  $search{'title'}=$title;
  my $keyword=validate($input->param('keyword'));
  $search{'keyword'}=$keyword;
  $search{'front'}=validate($input->param('front'));
  my $author=validate($input->param('author'));
  $search{'author'}=$author;
  my $illustrator=validate($input->param('illustrator'));
  $search{'illustrator'}=$illustrator;
  my $subject=validate($input->param('subject'));
  $search{'subject'}=$subject;
  my $itemnumber=validate($input->param('item'));
  $search{'item'}=$itemnumber;
  my $isbn=validate($input->param('isbn'));
  $search{'isbn'}=$isbn;
  my $datebefore=validate($input->param('date-before'));
  $search{'date-before'};
  my $class=$input->param('class');
  $search{'class'}=$class;
  $search{'ttype'}=$ttype;
  my $dewey=validate($input->param('dewey'));
  $search{'dewey'}=$dewey;
  my $branch=validate($input->param('branch'));
  $search{'branch'}=$branch;
  my @results;
  my $offset=$input->param('offset');
  if ($offset eq ''){
--- 10,77 ----
  my $input = new CGI;
  print $input->header;
  #print $input->dump;
!
! #whether it is called from the opac or the intranet
! my $type=$input->param('type');if ($type eq ''){
    $type = 'intra';
  }
+
  my $ttype=$input->param('ttype');
!
! #setup colours
! my $main;
! my $secondary;
!
! if ($type eq 'opac'){
    $main='#99cccc';
    $secondary='#efe5ef';
! } else {
!   $main='#cccc99';
!   $secondary='#ffffcc';
  }

  #print $input->Dump;
  my $blah;
  my %search;
+
  #build hash of users input
  my $title=validate($input->param('title'));
  $search{'title'}=$title;
+
  my $keyword=validate($input->param('keyword'));
  $search{'keyword'}=$keyword;
+
  $search{'front'}=validate($input->param('front'));
+
  my $author=validate($input->param('author'));
  $search{'author'}=$author;
+
  my $illustrator=validate($input->param('illustrator'));
  $search{'illustrator'}=$illustrator;
+
  my $subject=validate($input->param('subject'));
  $search{'subject'}=$subject;
+
  my $itemnumber=validate($input->param('item'));
  $search{'item'}=$itemnumber;
+
  my $isbn=validate($input->param('isbn'));
  $search{'isbn'}=$isbn;
+
  my $datebefore=validate($input->param('date-before'));
  $search{'date-before'};
+
  my $class=$input->param('class');
  $search{'class'}=$class;
+
  $search{'ttype'}=$ttype;
+
  my $dewey=validate($input->param('dewey'));
  $search{'dewey'}=$dewey;
+
  my $branch=validate($input->param('branch'));
  $search{'branch'}=$branch;
+
  my @results;
  my $offset=$input->param('offset');
  if ($offset eq ''){
Index: C4/Output.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Output.pm,v
retrieving revision 1.4
diff -c -r1.4 Output.pm
*** C4/Output.pm        31 Jan 2001 21:38:43 -0000      1.4
--- C4/Output.pm        4 Apr 2002 00:40:35 -0000
***************
*** 72,79 ****
  # make all your functions, whether exported or not;

  sub startpage{
!   my $string="<html>\n";
!   return($string);
  }

  sub gotopage{
--- 72,78 ----
  # make all your functions, whether exported or not;

  sub startpage{
!   return("<html>\n");
  }

  sub gotopage{
***************
*** 133,145 ****
  }

  sub mktablehdr {
!   my $string="<table border=0 cellspacing=0 cellpadding=5>\n";
!   return($string);
  }


  sub mktablerow {
!   #the last item in data may be a backgroundimage
    my ($cols,$colour,@data)address@hidden;
    my $i=0;
    my $string="<tr valign=top bgcolor=$colour>";
--- 132,147 ----
  }

  sub mktablehdr {
!     return("<table border=0 cellspacing=0 cellpadding=5>\n");
  }


  sub mktablerow {
!     #the last item in data may be a backgroundimage
!
!     # FIXME
!     # should this be a foreach (1..$cols) loop?
!
    my ($cols,$colour,@data)address@hidden;
    my $i=0;
    my $string="<tr valign=top bgcolor=$colour>";
***************
*** 162,169 ****
  }

  sub mktableft {
!   my $string="</table>\n";
!   return($string);
  }

  sub mkform{
--- 164,170 ----
  }

  sub mktableft {
!   return("</table>\n");
  }

  sub mkform{
***************
*** 350,357 ****


  sub endpage{
!   my $string="</body></html>\n";
!   return($string);
  }

  sub mklink {
--- 351,357 ----


  sub endpage{
!   return("</body></html>\n");
  }

  sub mklink {
***************
*** 376,390 ****
  }

  sub center {
!   my ($text)address@hidden;
!   my $string="<CENTER>\n";
!   return ($string);
  }

  sub endcenter {
!   my ($text)address@hidden;
!   my $string="</CENTER>\n";
!   return ($string);
  }

  sub bold {
--- 376,386 ----
  }

  sub center {
!   return ("<CENTER>\n");
  }

  sub endcenter {
!   return ("</CENTER>\n");
  }

  sub bold {
***************
*** 395,397 ****
--- 391,395 ----

  END { }       # module clean-up code here (global destructor)

+
+
Index: C4/Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.16
diff -c -r1.16 Search.pm
*** C4/Search.pm        13 Mar 2002 07:36:49 -0000      1.16
--- C4/Search.pm        4 Apr 2002 00:40:38 -0000
***************
*** 1,7 ****
! package C4::Search; #asummes C4/Search
!
! #requires DBI.pm to be installed
! #uses DBD:Pg

  use strict;
  require Exporter;
--- 1,4 ----
! package C4::Search; #assumes C4/Search

  use strict;
  require Exporter;
***************
*** 12,61 ****

  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

- # set the version for version checking
  $VERSION = 0.01;

  @ISA = qw(Exporter);
  @EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
  &itemdata &bibdata &GetItems &borrdata &itemnodata &itemcount
  &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
  &getboracctrecord &ItemType &itemissues &subject &subtitle
  &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
  &findguarantor);
- %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
-
- # your exported package globals go here,
- # as well as any optionally exported functions
-
- @EXPORT_OK   = qw($Var1 %Hashit);
-
-
- # non-exported package globals go here
- use vars qw(@more $stuff);
-
- # initalize package globals, first exported ones

- my $Var1   = '';
- my %Hashit = ();
-
- # then the others (which are still accessible as $Some::Module::stuff)
- my $stuff  = '';
- my @more   = ();
-
- # all file-scoped lexicals must be created before
- # the functions below that use them.
-
- # file-private lexicals go here
- my $priv_var    = '';
- my %secret_hash = ();
-
- # here's a file-private function as a closure,
- # callable as &$priv_func;  it cannot be prototyped.
- my $priv_func = sub {
-   # stuff goes here.
- };
-
- # make all your functions, whether exported or not;
  sub findguarantees{
    my ($bornum)address@hidden;
    my $dbh=C4Connect;
--- 9,25 ----

  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

  $VERSION = 0.01;

  @ISA = qw(Exporter);
+
  @EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
  &itemdata &bibdata &GetItems &borrdata &itemnodata &itemcount
  &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
  &getboracctrecord &ItemType &itemissues &subject &subtitle
  &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
  &findguarantor);

  sub findguarantees{
    my ($bornum)address@hidden;
    my $dbh=C4Connect;
***************
*** 70,76 ****
      $i++;
    }
    $sth->finish;
!   $dbh->disconnect;
    return($i,address@hidden);
  }
  sub findguarantor{
--- 34,44 ----
      $i++;
    }
    $sth->finish;
!   $dbh->disconnect;
!   # FIXME
!   # It looks like the $i is only being returned to handle walking through
!   # the array, which is probably better done as a foreach loop.
!   #
    return($i,address@hidden);
  }
  sub findguarantor{


Attachment: Koha.pm
Description: Text document

Attachment: koha.t
Description: Troff document

Attachment: testKoha.pl
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]