Working on interface

This commit is contained in:
chris 1999-10-28 22:43:37 +00:00
parent b3afbd381f
commit 619e3b3154
2 changed files with 42 additions and 42 deletions

View file

@ -52,39 +52,38 @@ my $priv_func = sub {
# make all your functions, whether exported or not;
sub Issue {
#get borrowerbarcode from scanner
my $borcode=&scanborrower;
# print $bornum;
# debug
# resultout('console',$borcode);
#connect to database
my $dbh=&C4Connect;
#start interface
my $interface=startint('console');
#get borrowerbarcode from scanner
my $borcode=&scanborrower($interface);
my $sth=$dbh->prepare("Select * from borrowers where cardnumber='$borcode'");
$sth->execute;
my @borrower=$sth->fetchrow_array;
my $bornum=$borrower[0];
# print @borrower;
# die;
if ($bornum eq ''){
#borrower not found
&resultout('console',"Borrower not found");
&resultout('console',"Borrower not found",$interface);
}
$sth->finish;
#process borrower traps (could be function)
#check first GNA trap (no address this is the 22nd item in the table)
if ($borrower[21] == 1){
#got to membership update and update member info
&resultout('console',"Whoop whoop no address");
&resultout('console',"Whoop whoop no address",$interface);
}
#check if member has a card reported as lost
if ($borrower[22] ==1){
#updae member info
&resultout('console',"Whoop whoop lost card");
&resultout('console',"Whoop whoop lost card",$interface);
}
#check the notes field if notes exist display them
if ($borrower[26] ne ''){
#display notes
#deal with notes as issue_process.doc
&resultout('console',"$borrower[26]");
&resultout('console',"$borrower[26]",$interface);
}
#check if borrower has overdue items
#call overdue checker
@ -99,14 +98,14 @@ sub Issue {
}
#deal with alternative loans
#now check items
&processitems;
&processitems($bornum,$interface);
$dbh->disconnect;
return (@borrower);
}
sub processitems {
my ($bornum)=@_;
my $itemnum=&scanbook;
my ($bornum,$interface)=@_;
my $itemnum=&scanbook($interface);
my $dbh=&C4Connect;
my $sth=$dbh->prepare("Select * from items where barcode = '$itemnum'");
$sth->execute;
@ -168,16 +167,18 @@ sub checkwaiting{
}
sub scanbook {
my ($interface)=@_;
#scan barcode
# my $number='L01781778';
my $number=&userdialog('console','Please enter a book barcode');
my $number=&userdialog('console','Please enter a book barcode',$interface);
return ($number);
}
sub scanborrower {
my ($interface)=@_;
#scan barcode
# my $number='L01781778';
my $number=&userdialog('console','Please enter a borrower barcode');
my $number=&userdialog('console','Please enter a borrower barcode',$interface);
return ($number);
}

View file

@ -14,7 +14,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&userdialog &resultout);
@EXPORT = qw(&userdialog &resultout &startint &endint);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -50,11 +50,10 @@ my $priv_func = sub {
# make all your functions, whether exported or not;
sub userdialog{
#create a dialog
my ($type,$text)=@_;
if ($type eq 'console'){
my ($mwh, $dwh);
sub startint {
my ($type)=@_;
if ($type eq 'console'){
my ($mwh);
my ($colours);
$mwh = new Curses;
$colours = has_colors();
@ -64,33 +63,34 @@ sub userdialog{
$mwh->keypad(1);
init_colours();
main_win($mwh);
$dwh = $mwh->subwin(8, $COLS - 2, 1, 1);
grab_key($mwh);
my $input=&input($mwh,$text);
endwin();
return($input);
return($mwh);
}
}
sub endint{
endwin();
}
sub userdialog{
#create a dialog
my ($type,$text,$mwh)=@_;
if ($type eq 'console'){
main_win($mwh);
my$dwh = $mwh->subwin(8, $COLS - 2, 1, 1);
# grab_key($mwh);
my $input=&input($mwh,$text);
return($input);
}
}
sub resultout{
#outputsome results
my ($type,$results)=@_;
my ($type,$results,$mwh)=@_;
if ($type eq 'console'){
my ($mwh, $dwh);
my ($colours);
$mwh = new Curses;
$colours = has_colors();
noecho();
cbreak();
halfdelay(10);
$mwh->keypad(1);
init_colours();
main_win($mwh);
$dwh = $mwh->subwin(8, $COLS - 2, 1, 1);
my $dwh = $mwh->subwin(8, $COLS - 2, 1, 1);
dialog($results,'red',$dwh,$mwh);
grab_key($mwh);
endwin();
}
}
@ -104,7 +104,6 @@ sub main_win {
$mwh->standout();
$mwh->addstr(0, 1, "Welcome to the Kumara Issues Screen");
$mwh->standend();
}
sub dialog {