1 package C4::Interface::ReserveentCDK; #asummes C4/Interface/ReserveCDK
5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
22 # FIXME - I'm pretty sure that this, along with the rest of the
23 # CDK-based stuff, is obsolete.
32 use vars qw($VERSION @ISA @EXPORT);
34 # set the version for version checking
38 @EXPORT = qw(&FindBiblioScreen &SelectBiblio &MakeReserveScreen);
40 sub FindBiblioScreen {
41 my ($env,$title,$numflds,$flds,$fldlns)=@_;
42 my $titlepanel = titlepanel($env,"Reserves","Find a title");
43 #my @coltitles=("a","b");
47 while ($ow < $nflds) {
48 @rowtitles[$ow]=@$flds[$ow];
52 my @coltypes = ("UMIXED");
54 my $entrymatrix = new Cdk::Matrix (
55 'ColTitles'=> \@coltitles,
56 'RowTitles'=> \@rowtitles,
57 'ColWidths'=> \@colwidths,
58 'ColTypes'=> \@coltypes,
62 #$entrymatrix->set('BoxCell'=>"FALSE");
63 #$entrymatrix->draw();
64 $entrymatrix->inject('Input'=>"KEY_DOWN");
66 my ($rows,$cols,$info) = $entrymatrix->activate();
72 while ($i < $numflds) {
73 $responses[$i] =$info->[$i][0];
77 return($reason,@responses);
81 my ($env,$count,$entries) = @_;
82 my $titlepanel = titlepanel($env,"Reserves","Select title");
83 my $biblist = new Cdk::Alphalist('Title'=>"Select a Title",
84 'List'=>\@$entries,'Height' => 22,'Width' => 76,
86 my $selection = $biblist->activate();
89 if (!defined $selection) {
94 return($reason,$result);
97 sub MakeReserveScreen {
98 my ($env,$bibliorec,$bitems,$branches) = @_;
99 my $titlepanel = titlepanel($env,"Reserves","Create Reservation");
100 my $line = fmtstr($env,$bibliorec->{'title'},"L72");
101 my $authlen = length($bibliorec->{'author'});
102 my $testlen = length($bibliorec->{'title'}) + $authlen;
104 $line = substr($line,0,71-$authlen)." ".$bibliorec->{'author'};
105 $line = fmtstr($env,$line,"L72");
107 my $split = int(($testlen-72)*0.7);
108 $line = substr($line,0,72+$split-$authlen)." ".$bibliorec->{'author'};
109 $line = fmtstr($env,$line,"L72");
112 my $bookpanel = new Cdk::Label ('Message' =>\@book,
115 my $branchlist = new Cdk::Radio('Title'=>"Collection Branch",
117 'Xpos'=>"20",'Ypos'=>"5",'Width'=>"18",'Height'=>"6");
120 my $brcnt = @$branches;
122 while (($brdef == 0) && ($i < $brcnt)) {
123 my $brcode = substr(@$branches[$i],0,2);
124 my $brtest = fmtstr($env,$env->{'branchcode'},"L2");
125 if ($brcode eq $brtest) {
128 $branchlist->inject('Input'=>"KEY_DOWN");
132 $branchlist->inject('Input'=>" ");
133 my @constraintlist = ("Any item","Only Selected","Except Selected");
134 my $constrainttype = new Cdk::Radio('Title'=>"Reserve Constraints",
135 'List'=>\@constraintlist,
136 'Xpos'=>"54",'Ypos'=>"5",'Width'=>"17",'Height'=>"6");
137 $constrainttype->draw();
138 my $numbit = @$bitems;
141 while ($i < $numbit) {
142 my $bitline = @$bitems[$i];
143 my @blarr = split("\t",$bitline);
144 my $line = @blarr[1]." ".@blarr[2];
146 my $line = $line.@blarr[3];
148 my $line = $line.@blarr[4]." ".@blarr[5];
149 $line = fmtstr($env,$line,"L40");
150 #$bitx{$line} = @blarr[0];
154 my @sel = ("Y ","N ");
155 my $itemlist = new Cdk::Selection('Title'=>"Items Held",
156 'List'=>\@itemarr,'Choices'=>\@sel,
157 'Xpos'=>"1",'Ypos'=>"12",'Width'=>"70",'Height'=>"8");
159 my $borrowerentry = new Cdk::Entry('Label'=>"",'Title'=>"Borrower",
160 'Max'=>"11",'Width'=>"11",
161 'Xpos'=>"2",'Ypos'=>"5",
163 borrbind($env,$borrowerentry);
164 # $borrowentry->bind('Key'=>"KEY_TAB",'Function'=>sub {$x = act($scroll1);});
168 while ($complete == 0) {
169 my $borrowercode = $borrowerentry->activate();
170 if (!defined $borrowercode) {
175 @answers[0] = $borrowercode;
176 if ($borrowercode ne "") { $complete = 1; };
177 while ($complete == 1) {
178 my $x = $branchlist->activate();
183 my @brline = split(" ",@$branches[$x]);
184 @answers[1] = @brline[0];
188 while ($complete == 2) {
190 my @constarr = ("a", "o", "e");
191 my $constans = $constrainttype->activate();
192 if (!defined $constans) {
193 $complete = 1; # go back a step
195 @answers[2] = $constarr[$constans];
197 if ($answers[2] ne "a") {
198 while ($complete == 3) {
199 my @itemans = $itemlist->activate();
200 if (!defined @itemans) {
201 $complete = 2; # go back a step
204 my $no_ans = @itemans;
210 if ($itemans[$i] == 0) {
211 my $bitline = @$bitems[$i];
212 my @blarr = split("\t",$bitline);
213 @items[$j] = @blarr[0];
218 @answers[3] = \@items;
231 return ($reason,@answers);
233 END { } # module clean-up code here (global destructor)