koha-devel
[Top][All Lists]
Advanced

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

[Koha-devel] CVS: koha/circ circulation.pl,1.14,1.15


From: Chris Cormack
Subject: [Koha-devel] CVS: koha/circ circulation.pl,1.14,1.15
Date: Thu, 22 Mar 2001 14:20:31 -0800

Update of /cvsroot/koha/koha/circ
In directory usw-pr-cvs1:/tmp/cvs-serv11487/circ

Modified Files:
        circulation.pl 
Log Message:
Changes made by Glen to allow the circulation module to work with a
ASCII-wand, or CueCat (weird encoded) input equally well.

Do not bother installing the CueCat driver or any other software - it's not
needed.



Index: circulation.pl
===================================================================
RCS file: /cvsroot/koha/koha/circ/circulation.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** circulation.pl      2001/02/21 22:33:48     1.14
--- circulation.pl      2001/03/22 22:20:29     1.15
***************
*** 14,18 ****
  my $linecolor1='#bbbbbb';
  my $linecolor2='#dddddd';
! my $backgroundimage="/images/background-mem.gif";
  my $query=new CGI;
  my $branches=getbranches(\%env);
--- 14,18 ----
  my $linecolor1='#bbbbbb';
  my $linecolor2='#dddddd';
! my $backgroundimage="/koha/images/background-mem.gif";
  my $query=new CGI;
  my $branches=getbranches(\%env);
***************
*** 84,88 ****
  <th width=30%><font color=black>$branchname</font></th>
  <th width=10%>
!       <a 
href=circulation.pl?module=issues&branch=$branch&printer=$printer><font 
color=black><img src=/images/issues.gif border=0 height=40></font></a>
  </th>
  <th width=10%>
--- 84,88 ----
  <th width=30%><font color=black>$branchname</font></th>
  <th width=10%>
!       <a 
href=circulation.pl?module=issues&branch=$branch&printer=$printer><font 
color=black><img src=/koha/images/issues.gif border=0 height=40></font></a>
  </th>
  <th width=10%>
***************
*** 90,94 ****
  </th>
  <th width=10%>
!     <a 
href=circulation.pl?module=returns&branch=$branch&printer=$printer><font 
color=black><img src=/images/returns.gif border=0 height=40></font></a>
  </th>
  <th width=30%><font color=black>$printername</font></th>
--- 90,94 ----
  </th>
  <th width=10%>
!     <a 
href=circulation.pl?module=returns&branch=$branch&printer=$printer><font 
color=black><img src=/koha/images/returns.gif border=0 height=40></font></a>
  </th>
  <th width=30%><font color=black>$printername</font></th>
***************
*** 167,170 ****
--- 167,198 ----
  
  
+ sub decode {
+     ($encoded) = @_;
+     $seq = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-';
+     @s = map { index($seq,$_); } split(//,$encoded);
+     $l = ($#s+1) % 4;
+     if ($l)
+     {
+       if ($l == 1)
+       {
+           print "Error!";
+           return;
+       }
+       $l = 4-$l;
+       $#s += $l;
+     }
+     $r = '';
+     while ($#s >= 0)
+     {
+       $n = (($s[0] << 6 | $s[1]) << 6 | $s[2]) << 6 | $s[3];
+       $r .=chr(($n >> 16) ^ 67) .
+            chr(($n >> 8 & 255) ^ 67) .
+            chr(($n & 255) ^ 67);
+       @s = @s[4..$#s];
+     }
+     $r = substr($r,0,length($r)-$l);
+     return $r;
+ }
+ 
  sub returns {
      my %returneditems;
***************
*** 177,180 ****
--- 205,218 ----
        (next) if ($counter>20);
        my $barcode=$query->param("ri-$counter");
+       # I'm not POSITIVE this decode belongs here - can't tell what causes it 
to run.
+       # decode cuecat
+       chomp($barcode);
+       @fields = split(/\./,$barcode);
+       @results = map(decode($_), @fields[1..$#fields]);
+       if ($#results == 2)
+       {
+       $barcode=$results[2];
+       }
+       # end decode
        my $duedate=$query->param("dd-$counter");
        my $borrowernumber=$query->param("bn-$counter");
***************
*** 188,191 ****
--- 226,238 ----
      }
      if (my $barcode=$query->param('barcode')) {
+       # decode cuecat
+       chomp($barcode);
+       @fields = split(/\./,$barcode);
+       @results = map(decode($_), @fields[1..$#fields]);
+       if ($#results == 2)
+       {
+       $barcode=$results[2];
+       }
+       # end decode
        $ritext.="<input type=hidden name=ri-0 value=$barcode>\n";
        $returneditems{0}=$barcode;
***************
*** 204,207 ****
--- 251,263 ----
  EOF
      if ((my $barcode=$query->param('barcode')) || (%returneditems)) {
+       # decode cuecat
+       chomp($barcode);
+       @fields = split(/\./,$barcode);
+       @results = map(decode($_), @fields[1..$#fields]);
+       if ($#results == 2)
+       {
+       $barcode=$results[2];
+       }
+       # end decode
        my ($iteminformation, $borrower, $messages, $overduecharge) = 
returnbook(\%env, $barcode);
        
***************
*** 341,349 ****
            my $overduetext="$duedate";
            ($overduetext="<font color=red>$duedate</font>") if ($duedate lt 
$todaysdate);
!           ($duedate) || ($overduetext="<img src=/images/blackdot.gif>");
            my $borrowernumber=$riborrowernumber{$_};
            my ($borrower) = getpatroninformation(\%env,$borrowernumber,0);
            my ($iteminformation) = getiteminformation(\%env, 0, $barcode);
!           print "<tr><td bgcolor=$color>$overduetext</td><td bgcolor=$color 
align=center><a 
href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra 
onClick=\"openWindow(this, 'Item', 480, 640)\">$barcode</a></td><td 
bgcolor=$color>$iteminformation->{'title'}</td><td 
bgcolor=$color>$iteminformation->{'author'}</td><td bgcolor=$color 
align=center>$iteminformation->{'itemtype'}</td><td bgcolor=$color><img 
src=/images/blackdot.gif><a 
href=/cgi-bin/koha/moremember.pl?bornum=$borrower->{'borrowernumber'} 
onClick=\"openWindow(this,'Member', 480, 640)\">$borrower->{'cardnumber'}</a> 
$borrower->{'firstname'} $borrower->{'surname'}</td></tr>\n";
        }
        print "</table>\n";
--- 397,405 ----
            my $overduetext="$duedate";
            ($overduetext="<font color=red>$duedate</font>") if ($duedate lt 
$todaysdate);
!           ($duedate) || ($overduetext="<img src=/koha/images/blackdot.gif>");
            my $borrowernumber=$riborrowernumber{$_};
            my ($borrower) = getpatroninformation(\%env,$borrowernumber,0);
            my ($iteminformation) = getiteminformation(\%env, 0, $barcode);
!           print "<tr><td bgcolor=$color>$overduetext</td><td bgcolor=$color 
align=center><a 
href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra 
onClick=\"openWindow(this, 'Item', 480, 640)\">$barcode</a></td><td 
bgcolor=$color>$iteminformation->{'title'}</td><td 
bgcolor=$color>$iteminformation->{'author'}</td><td bgcolor=$color 
align=center>$iteminformation->{'itemtype'}</td><td bgcolor=$color><img 
src=/koha/images/blackdot.gif><a 
href=/cgi-bin/koha/moremember.pl?bornum=$borrower->{'borrowernumber'} 
onClick=\"openWindow(this,'Member', 480, 640)\">$borrower->{'cardnumber'}</a> 
$borrower->{'firstname'} $borrower->{'surname'}</td></tr>\n";
        }
        print "</table>\n";
***************
*** 399,402 ****
--- 455,467 ----
        my $day=$query->param('day');
        if (my $barcode=$query->param('barcode')) {
+           # decode cuecat
+           chomp($barcode);
+           @fields = split(/\./,$barcode);
+           @results = map(decode($_), @fields[1..$#fields]);
+           if ($#results == 2)
+           {
+                   $barcode=$results[2];
+           }
+           # end decode
            my $invalidduedate=0;
            $env{'datedue'}='';




reply via email to

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