From rangi@users.sourceforge.net Thu Mar 22 14:20:38 2001 From: Chris Cormack To: koha-devel@lists.koha-community.org Subject: [Koha-devel] CVS: koha/circ circulation.pl,1.14,1.15 Date: Thu, 22 Mar 2001 14:20:31 -0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2101642715968431645==" --===============2101642715968431645== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update of /cvsroot/koha/koha/circ In directory usw-pr-cvs1:/tmp/cvs-serv11487/circ Modified Files: circulation.pl=20 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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=3D'#bbbbbb'; my $linecolor2=3D'#dddddd'; ! my $backgroundimage=3D"/images/background-mem.gif"; my $query=3Dnew CGI; my $branches=3Dgetbranches(\%env); --- 14,18 ---- my $linecolor1=3D'#bbbbbb'; my $linecolor2=3D'#dddddd'; ! my $backgroundimage=3D"/koha/images/background-mem.gif"; my $query=3Dnew CGI; my $branches=3Dgetbranches(\%env); *************** *** 84,88 **** $branchname ! <= /font> --- 84,88 ---- $branchname ! *************** *** 90,94 **** ! $printername --- 90,94 ---- ! $printername *************** *** 167,170 **** --- 167,198 ---- =20 =20 + sub decode { + ($encoded) =3D @_; + $seq =3D 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678= 9+-'; + @s =3D map { index($seq,$_); } split(//,$encoded); + $l =3D ($#s+1) % 4; + if ($l) + { + if ($l =3D=3D 1) + { + print "Error!"; + return; + } + $l =3D 4-$l; + $#s +=3D $l; + } + $r =3D ''; + while ($#s >=3D 0) + { + $n =3D (($s[0] << 6 | $s[1]) << 6 | $s[2]) << 6 | $s[3]; + $r .=3Dchr(($n >> 16) ^ 67) . + chr(($n >> 8 & 255) ^ 67) . + chr(($n & 255) ^ 67); + @s =3D @s[4..$#s]; + } + $r =3D substr($r,0,length($r)-$l); + return $r; + } +=20 sub returns { my %returneditems; *************** *** 177,180 **** --- 205,218 ---- (next) if ($counter>20); my $barcode=3D$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 =3D split(/\./,$barcode); + @results =3D map(decode($_), @fields[1..$#fields]); + if ($#results =3D=3D 2) + { + $barcode=3D$results[2]; + } + # end decode my $duedate=3D$query->param("dd-$counter"); my $borrowernumber=3D$query->param("bn-$counter"); *************** *** 188,191 **** --- 226,238 ---- } if (my $barcode=3D$query->param('barcode')) { + # decode cuecat + chomp($barcode); + @fields =3D split(/\./,$barcode); + @results =3D map(decode($_), @fields[1..$#fields]); + if ($#results =3D=3D 2) + { + $barcode=3D$results[2]; + } + # end decode $ritext.=3D"\n"; $returneditems{0}=3D$barcode; *************** *** 204,207 **** --- 251,263 ---- EOF if ((my $barcode=3D$query->param('barcode')) || (%returneditems)) { + # decode cuecat + chomp($barcode); + @fields =3D split(/\./,$barcode); + @results =3D map(decode($_), @fields[1..$#fields]); + if ($#results =3D=3D 2) + { + $barcode=3D$results[2]; + } + # end decode my ($iteminformation, $borrower, $messages, $overduecharge) =3D returnbook= (\%env, $barcode); =09 *************** *** 341,349 **** my $overduetext=3D"$duedate"; ($overduetext=3D"$duedate") if ($duedate lt $= todaysdate); ! ($duedate) || ($overduetext=3D""); my $borrowernumber=3D$riborrowernumber{$_}; my ($borrower) =3D getpatroninformation(\%env,$borrowernumber,0); my ($iteminformation) =3D getiteminformation(\%env, 0, $barcode); ! print "$overduetext{'bi= blionumber'}&type=3Dintra onClick=3D\"openWindow(this, 'Item', 480, 640)\">$b= arcode$iteminformation->{'title'}$iteminformation->{'author'}$iteminformation->{'itemtype'}{'bo= rrowernumber'} onClick=3D\"openWindow(this,'Member', 480, 640)\">$borrower->{= 'cardnumber'} $borrower->{'firstname'} $borrower->{'surname'}\n= "; } print "\n"; --- 397,405 ---- my $overduetext=3D"$duedate"; ($overduetext=3D"$duedate") if ($duedate lt $= todaysdate); ! ($duedate) || ($overduetext=3D""); my $borrowernumber=3D$riborrowernumber{$_}; my ($borrower) =3D getpatroninformation(\%env,$borrowernumber,0); my ($iteminformation) =3D getiteminformation(\%env, 0, $barcode); ! print "$overduetext{'bi= blionumber'}&type=3Dintra onClick=3D\"openWindow(this, 'Item', 480, 640)\">$b= arcode$iteminformation->{'title'}$iteminformation->{'author'}$iteminformation->{'itemtype'}{'borrowernumber'} onClick=3D\"openWindow(this,'Member', 480, 640)\">$borrow= er->{'cardnumber'} $borrower->{'firstname'} $borrower->{'surname'}\n"; } print "\n"; *************** *** 399,402 **** --- 455,467 ---- my $day=3D$query->param('day'); if (my $barcode=3D$query->param('barcode')) { + # decode cuecat + chomp($barcode); + @fields =3D split(/\./,$barcode); + @results =3D map(decode($_), @fields[1..$#fields]); + if ($#results =3D=3D 2) + { + $barcode=3D$results[2]; + } + # end decode my $invalidduedate=3D0; $env{'datedue'}=3D''; --===============2101642715968431645==--