[Koha-cvs] CVS: koha/koha-curses circ.pl,1.4,1.5
Chris Cormack
rangi at users.sourceforge.net
Sun May 15 07:56:07 CEST 2005
Update of /cvsroot/koha/koha/koha-curses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32217
Modified Files:
circ.pl
Log Message:
Can now change branch and printer
Index: circ.pl
===================================================================
RCS file: /cvsroot/koha/koha/koha-curses/circ.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** circ.pl 15 May 2005 05:42:00 -0000 1.4
--- circ.pl 15 May 2005 05:56:05 -0000 1.5
***************
*** 26,29 ****
--- 26,30 ----
use C4::Search;
use C4::Print;
+ use C4::Context;
my $cui = new Curses::UI( -color_support => 1 );
***************
*** 38,41 ****
--- 39,49 ----
]
},
+ {
+ -label => 'Parameters',
+ -submenu => [
+ { -label => 'Branch', -value => \&changebranch },
+ { -label => 'Printer', -value => \&changeprinter }
+ ]
+ },
);
***************
*** 86,89 ****
--- 94,99 ----
$cui->mainloop();
+ my %env;
+
sub exit_dialog() {
my $return = $cui->dialog(
***************
*** 103,107 ****
);
my $branch = 'MAIN';
! my %env;
if ($barcode) {
my ( $returned, $messages, $iteminformation, $borrower ) =
--- 113,117 ----
);
my $branch = 'MAIN';
!
if ($barcode) {
my ( $returned, $messages, $iteminformation, $borrower ) =
***************
*** 130,134 ****
# this routine does the actual issuing
- my %env;
my $borrowernumber;
my $borrowerlist;
--- 140,143 ----
***************
*** 186,193 ****
$popupbox->focus();
- $borrowernumber = $popupbox->get();
- if ($borrowernumber) {
- doissues( $borrowernumber, \%env, $year, $month, $day );
- }
}
else {
--- 195,198 ----
***************
*** 283,284 ****
--- 288,340 ----
}
}
+
+ sub changebranch {
+ my $dbh = C4::Context->dbh();
+ my $sth = $dbh->prepare('SELECT * FROM branches');
+ $sth->execute();
+ my @branches;
+ while ( my $data = $sth->fetchrow_hashref() ) {
+ push @branches, $data->{'branchcode'};
+ }
+ $sth->finish;
+ $win1->delete('text');
+ $win1->delete('mypopupbox');
+ my $popupbox = $win1->add(
+ 'mypopupbox', 'Popupmenu',
+ -values => [@branches],
+ -onchange => \&setbranch,
+ );
+ $popupbox->focus();
+ }
+
+ sub changeprinter {
+ my $dbh = C4::Context->dbh();
+ my $sth = $dbh->prepare('SELECT * FROM printers');
+ $sth->execute();
+ my @printers;
+ while ( my $data = $sth->fetchrow_hashref() ) {
+ push @printers, $data->{'printqueue'};
+ }
+ $sth->finish;
+ $win1->delete('text');
+ $win1->delete('mypopupbox');
+ my $popupbox = $win1->add(
+ 'mypopupbox', 'Popupmenu',
+ -values => [@printers],
+ -onchange => \&setprinter,
+ );
+ $popupbox->focus();
+
+ }
+
+ sub setbranch {
+ my $list = shift;
+ my $branch = $list->get();
+ $env{'branch'} = $branch;
+ }
+
+ sub setprinter {
+ my $list = shift;
+ my $printer = $list->get();
+ $env{'printer'} = $printer;
+ }
More information about the Koha-cvs
mailing list