[Koha-cvs] CVS: koha shelves.pl,1.12,1.12.2.1

Paul POULAIN tipaul at users.sourceforge.net
Fri Feb 6 15:22:25 CET 2004


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

Modified Files:
      Tag: rel_2_0
	shelves.pl 
Log Message:
fixing bugs in bookshelves management.

Index: shelves.pl
===================================================================
RCS file: /cvsroot/koha/koha/shelves.pl,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -r1.12 -r1.12.2.1
*** shelves.pl	5 Feb 2003 10:04:14 -0000	1.12
--- shelves.pl	6 Feb 2004 14:22:19 -0000	1.12.2.1
***************
*** 5,10 ****
  # $Header$
  #
- 
- 
  # Copyright 2000-2002 Katipo Communications
  #
--- 5,8 ----
***************
*** 36,40 ****
  my $env;
  my $query = new CGI;
- #print $query->header(-cookie => $cookie);
  my $headerbackgroundcolor='#663266';
  my $circbackgroundcolor='#555555';
--- 34,37 ----
***************
*** 45,83 ****
      = get_template_and_user({template_name => "shelves.tmpl",
  							query => $query,
!                             type => "intranet",
!                             authnotrequired => 0,
!                             flagsrequired => {parameters => 1},
!                          });
! #print startpage();
! #print startmenu('catalogue');
! #print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";
! 
! 
! my ($shelflist) = GetShelfList();
  
  if ($query->param('modifyshelfcontents')) {
!     my $shelfnumber=$query->param('shelfnumber');
!     my $barcode=$query->param('addbarcode');
!     my ($item) = getiteminformation($env, 0, $barcode);
!     AddToShelf($env, $item->{'itemnumber'}, $shelfnumber);
!     foreach ($query->param) {
! 	if (/REM-(\d*)/) {
! 	    my $itemnumber=$1;
! 	    RemoveFromShelf($env, $itemnumber, $shelfnumber);
  	}
-     }
  }
  
  SWITCH: {
! 	$template->param({	loggedinuser => $loggedinuser,
! 						viewshelf => $query->param('viewshelf'),
! 						shelves => $query->param('shelves'),
! 						headerbackgroundcolor => $headerbackgroundcolor,
! 						circbackgroundcolor => $circbackgroundcolor });
!     if ($query->param('viewshelf')) {  viewshelf($query->param('viewshelf')); last SWITCH;}
!     if ($query->param('shelves')) {  shelves(); last SWITCH;}
! 	my $color='';
! 	my @shelvesloop;
!     foreach my $element (sort keys %$shelflist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
--- 42,77 ----
      = get_template_and_user({template_name => "shelves.tmpl",
  							query => $query,
! 							type => "intranet",
! 							authnotrequired => 0,
! 							flagsrequired => {catalogue => 1},
! 						});
  
  if ($query->param('modifyshelfcontents')) {
! 	my $shelfnumber=$query->param('shelfnumber');
! 	my $barcode=$query->param('addbarcode');
! 	my ($item) = getiteminformation($env, 0, $barcode);
! 	AddToShelf($env, $item->{'itemnumber'}, $shelfnumber);
! 	foreach ($query->param) {
! 		if (/REM-(\d*)/) {
! 			my $itemnumber=$1;
! 			RemoveFromShelf($env, $itemnumber, $shelfnumber);
! 		}
  	}
  }
+ my ($shelflist) = GetShelfList();
  
+ $template->param({	loggedinuser => $loggedinuser,
+ 					headerbackgroundcolor => $headerbackgroundcolor,
+ 					circbackgroundcolor => $circbackgroundcolor });
  SWITCH: {
! 	if ($query->param('viewshelf')) {  viewshelf($query->param('viewshelf')); last SWITCH;}
! 	if ($query->param('shelves')) {  shelves(); last SWITCH;}
! }
! 
! ($shelflist) = GetShelfList(); # rebuild shelflist in case a shelf has been added
! 
! my $color='';
! my @shelvesloop;
! foreach my $element (sort keys %$shelflist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
***************
*** 87,106 ****
  		$line{'shelfbookcount'}=$shelflist->{$element}->{'count'};
  		push (@shelvesloop, \%line);
-     }
- 	$template->param(shelvesloop => \@shelvesloop);
  }
  
  output_html_with_http_headers $query, $cookie, $template->output;
  
- 
  sub shelves {
!     if (my $newshelf=$query->param('addshelf')) {
! 	my ($status, $string) = AddShelf($env,$newshelf);
! 	if ($status) {
! 	    $template->param(status1 => $status, string1 => $string);
  	}
-     }
  	my @paramsloop;
!     foreach ($query->param()) {
  		my %line;
  		if (/DEL-(\d+)/) {
--- 81,98 ----
  		$line{'shelfbookcount'}=$shelflist->{$element}->{'count'};
  		push (@shelvesloop, \%line);
  }
+ $template->param(shelvesloop => \@shelvesloop);
  
  output_html_with_http_headers $query, $cookie, $template->output;
  
  sub shelves {
! 	if (my $newshelf=$query->param('addshelf')) {
! 		my ($status, $string) = AddShelf($env,$newshelf);
! 		if ($status) {
! 			$template->param(status1 => $status, string1 => $string);
! 		}
  	}
  	my @paramsloop;
! 	foreach ($query->param()) {
  		my %line;
  		if (/DEL-(\d+)/) {
***************
*** 114,123 ****
  		#if the shelf is not deleted, %line points on null
  		push(@paramsloop,\%line);
!     }
  	$template->param(paramsloop => \@paramsloop);
!     my ($shelflist) = GetShelfList();
!     my $color='';
  	my @shelvesloop;
!     foreach my $element (sort keys %$shelflist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
--- 106,115 ----
  		#if the shelf is not deleted, %line points on null
  		push(@paramsloop,\%line);
! 	}
  	$template->param(paramsloop => \@paramsloop);
! 	my ($shelflist) = GetShelfList();
! 	my $color='';
  	my @shelvesloop;
! 	foreach my $element (sort keys %$shelflist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
***************
*** 127,143 ****
  		$line{'shelfbookcount'}=$shelflist->{$element}->{'count'} ;
  		push(@shelvesloop, \%line);
!     }
! 	$template->param(shelvesloop=>\@shelvesloop);
  }
  
- 
- 
  sub viewshelf {
!     my $shelfnumber=shift;
!     my ($itemlist) = GetShelfContents($env, $shelfnumber);
!     my $item='';
!     my $color='';
  	my @itemsloop;
!     foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
--- 119,135 ----
  		$line{'shelfbookcount'}=$shelflist->{$element}->{'count'} ;
  		push(@shelvesloop, \%line);
! 	}
! 	$template->param(shelvesloop=>\@shelvesloop,
! 							shelves => 1,
! 						);
  }
  
  sub viewshelf {
! 	my $shelfnumber=shift;
! 	my ($itemlist) = GetShelfContents($env, $shelfnumber);
! 	my $item='';
! 	my $color='';
  	my @itemsloop;
! 	foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
  		my %line;
  		($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
***************
*** 148,162 ****
  		$line{'author'}=$item->{'author'};
  		push(@itemsloop, \%line);
!     }
! 	$template->param(	itemsloop => \@itemsloop);
! 	$template->param(	shelfname => $shelflist->{$shelfnumber}->{'shelfname'});
! 	$template->param(	shelfnumber => $shelfnumber);
  }
  
- #print endpage();
- #print endmenu('catalogue');
- 
  #
  # $Log$
  # Revision 1.12  2003/02/05 10:04:14  acli
  # Worked around weirdness with HTML::Template; without the {}, it complains
--- 140,156 ----
  		$line{'author'}=$item->{'author'};
  		push(@itemsloop, \%line);
! 	}
! 	$template->param(	itemsloop => \@itemsloop,
! 						shelfname => $shelflist->{$shelfnumber}->{'shelfname'},
! 						shelfnumber => $shelfnumber,
! 						viewshelf => $query->param('viewshelf'),
! 					);
  }
  
  #
  # $Log$
+ # Revision 1.12.2.1  2004/02/06 14:22:19  tipaul
+ # fixing bugs in bookshelves management.
+ #
  # Revision 1.12  2003/02/05 10:04:14  acli
  # Worked around weirdness with HTML::Template; without the {}, it complains





More information about the Koha-cvs mailing list