[Koha-cvs] CVS: koha/koha-curses circ.pl,1.3,1.4

Chris Cormack rangi at users.sourceforge.net
Sun May 15 07:42:03 CEST 2005


Update of /cvsroot/koha/koha/koha-curses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30668

Modified Files:
	circ.pl 
Log Message:
Got drop down list appearing when more than one borrower matches


Index: circ.pl
===================================================================
RCS file: /cvsroot/koha/koha/koha-curses/circ.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** circ.pl	15 May 2005 04:29:54 -0000	1.3
--- circ.pl	15 May 2005 05:42:00 -0000	1.4
***************
*** 25,28 ****
--- 25,29 ----
  use C4::Circulation::Circ2;
  use C4::Search;
+ use C4::Print;
  
  my $cui = new Curses::UI( -color_support => 1 );
***************
*** 137,141 ****
      my $month;
      my $day;
-     my $datedue;
  
      $win1->delete('text');
--- 138,141 ----
***************
*** 165,255 ****
  
          # if we have one single borrower, we can start issuing
!         my $borrower = getpatroninformation( \%env, $borrowernumber, 0 );
!         $win1->delete('borrowerdata');
!         my $borrowerdata = $win1->add( 'borrowerdata', 'TextViewer',
!             -text => "Cardnumber: $borrower->{'cardnumber'}\n"
!               . "Name: $borrower->{'title'} $borrower->{'firstname'} $borrower->{'surname'}"
          );
  
!         $borrowerdata->focus();
  
!         $win3->delete('pastissues');
!         my $issueslist = getissues($borrower);
!         my $oldissues;
!         foreach my $it ( keys %$issueslist ) {
!             $oldissues .=
!               $issueslist->{$it}->{'barcode'}
!               . " $issueslist->{$it}->{'title'} $issueslist->{$it}->{'date_due'}\n";
  
!         }
  
!         my $pastissues =
!           $win3->add( 'pastissues', 'TextViewer', -text => $oldissues, );
!         $pastissues->focus();
! 
!         $win2->delete('currentissues');
!         my $currentissues =
!           $win2->add( 'currentissues', 'TextViewer',
!             -text => "Todays issues go here", );
!         $currentissues->focus();
! 
!         # go into a loop issuing until a blank barcode is given
!         while ( my $barcode = $cui->question( -question => 'Barcode' ) ) {
!             my $issues;
!             my $issueconfirmed;
!             my ( $error, $question ) =
!               canbookbeissued( \%env, $borrower, $barcode, $year, $month,
!                 $day );
!             my $noerror    = 1;
!             my $noquestion = 1;
!             foreach my $impossible ( keys %$error ) {
!                 $cui->error( -message => $impossible );
!                 $noerror = 0;
!             }
!             if ($noerror) {
  
!                 # no point asking confirmation questions if we cant issue
!                 foreach my $needsconfirmation ( keys %$question ) {
!                     $noquestion     = 0;
!                     $issueconfirmed = $cui->dialog(
!                         -message =>
! "$needsconfirmation $question->{$needsconfirmation} Issue anyway?",
!                         -title   => "Confirmation",
!                         -buttons => [ 'yes', 'no' ],
  
!                     );
  
!                 }
!             }
!             if ( $noerror && ( $noquestion || $issueconfirmed ) ) {
!                 issuebook( \%env, $borrower, $barcode, $datedue );
!                 $issues .= "$barcode $datedue";
!                 $win2->delete('currentissues');
!                 $currentissues =
!                   $win2->add( 'currentissues', 'TextViewer', -text => $issues,
!                   );
  
              }
  
          }
  
      }
-     elsif ($borrowerlist) {
-         my $listbox = $win1->add(
-             'mylistbox',
-             'Listbox',
-             -values => [ 1, 2, 3 ],
-             -labels => {
-                 1 => 'One',
-                 2 => 'Two',
-                 3 => 'Three'
-             },
-             -radio => 1,
-         );
  
!         $listbox->focus();
!         my $selected = $listbox->get();
!     }
!     else {
      }
  }
--- 165,284 ----
  
          # if we have one single borrower, we can start issuing
!         doissues( $borrowernumber, \%env, $year, $month, $day );
!     }
!     elsif ($borrowerlist) {
! 
!         # choose from a list then start issuing
!         my @borrowernumbers;
!         my %borrowernames;
!         foreach my $bor (@$borrowerlist) {
!             push @borrowernumbers, $bor->{'borrowernumber'};
!             $borrowernames{ $bor->{'borrowernumber'} } =
!               "$bor->{'cardnumber'} $bor->{'firstname'} $bor->{surname}";
!         }
!         $win1->delete('mypopupbox');
!         my $popupbox = $win1->add(
!             'mypopupbox', 'Popupmenu',
!             -values   => [@borrowernumbers],
!             -labels   => \%borrowernames,
!             -onchange => \&dolistissues,
          );
  
!         $popupbox->focus();
!         $borrowernumber = $popupbox->get();
!         if ($borrowernumber) {
!             doissues( $borrowernumber, \%env, $year, $month, $day );
!         }
!     }
!     else {
!     }
! }
  
! sub dolistissues {
!     my $list           = shift;
!     my $borrowernumber = $list->get();
!     doissues($borrowernumber);
! }
  
! sub doissues {
!     my ( $borrowernumber, $env, $year, $month, $day ) = @_;
!     my $datedue;
  
!     my $borrower = getpatroninformation( $env, $borrowernumber, 0 );
!     $win1->delete('borrowerdata');
!     my $borrowerdata = $win1->add( 'borrowerdata', 'TextViewer',
!         -text => "Cardnumber: $borrower->{'cardnumber'}\n"
!           . "Name: $borrower->{'title'} $borrower->{'firstname'} $borrower->{'surname'}"
!     );
  
!     $borrowerdata->focus();
  
!     $win3->delete('pastissues');
!     my $issueslist = getissues($borrower);
!     my $oldissues;
!     foreach my $it ( keys %$issueslist ) {
!         $oldissues .=
!           $issueslist->{$it}->{'barcode'}
!           . " $issueslist->{$it}->{'title'} $issueslist->{$it}->{'date_due'}\n";
  
!     }
! 
!     my $pastissues =
!       $win3->add( 'pastissues', 'TextViewer', -text => $oldissues, );
!     $pastissues->focus();
! 
!     $win2->delete('currentissues');
!     my $currentissues =
!       $win2->add( 'currentissues', 'TextViewer',
!         -text => "Todays issues go here", );
!     $currentissues->focus();
! 
!     # go into a loop issuing until a blank barcode is given
!     while ( my $barcode = $cui->question( -question => 'Barcode' ) ) {
!         my $issues;
!         my $issueconfirmed;
!         my ( $error, $question ) =
!           canbookbeissued( $env, $borrower, $barcode, $year, $month, $day );
!         my $noerror    = 1;
!         my $noquestion = 1;
!         foreach my $impossible ( keys %$error ) {
!             $cui->error( -message => $impossible );
!             $noerror = 0;
!         }
!         if ($noerror) {
! 
!             # no point asking confirmation questions if we cant issue
!             foreach my $needsconfirmation ( keys %$question ) {
!                 $noquestion     = 0;
!                 $issueconfirmed = $cui->dialog(
!                     -message =>
! "$needsconfirmation $question->{$needsconfirmation} Issue anyway?",
!                     -title   => "Confirmation",
!                     -buttons => [ 'yes', 'no' ],
! 
!                 );
  
              }
+         }
+         if ( $noerror && ( $noquestion || $issueconfirmed ) ) {
+             issuebook( $env, $borrower, $barcode, $datedue );
+             $issues .= "$barcode";
+             $win2->delete('currentissues');
+             $currentissues =
+               $win2->add( 'currentissues', 'TextViewer', -text => $issues, );
  
          }
  
      }
  
!     # finished issuing
!     my $printconfirm = $cui->dialog(
!         -message => "Print a slip for this borrower?",
!         -title   => "Print Slip",
!         -buttons => [ 'yes', 'no' ],
! 
!     );
!     if ($printconfirm) {
!         printslip( $env, $borrowernumber );
      }
  }





More information about the Koha-cvs mailing list