[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.35,1.36 addbooks.pl,1.19,1.20 additem.pl,1.23,1.24

Paul POULAIN tipaul at users.sourceforge.net
Tue May 18 17:22:14 CEST 2004


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

Modified Files:
	addbiblio.pl addbooks.pl additem.pl 
Log Message:
framework management : 1 MARC framework for each itemtype


Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbiblio.pl,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** addbiblio.pl	17 Mar 2004 16:55:40 -0000	1.35
--- addbiblio.pl	18 May 2004 15:22:10 -0000	1.36
***************
*** 35,38 ****
--- 35,40 ----
  use vars qw( $is_a_modif );
  
+ my $itemtype; # created here because it can be used in build_authorized_values_list sub
+ 
  =item find_value
  
***************
*** 104,117 ****
  
  sub build_authorized_values_list ($$$$$) {
!     my($tag, $subfield, $value, $dbh,$authorised_values_sth) = @_;
  
!     my @authorised_values;
!     my %authorised_lib;
  
!     # builds list, depending on authorised value...
  
!     #---- branch
!     if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
! 	my $sth=$dbh->prepare("select branchcode,branchname from branches");
  	$sth->execute;
  	push @authorised_values, ""
--- 106,119 ----
  
  sub build_authorized_values_list ($$$$$) {
! 	my($tag, $subfield, $value, $dbh,$authorised_values_sth) = @_;
  
! 	my @authorised_values;
! 	my %authorised_lib;
  
! 	# builds list, depending on authorised value...
  
! 	#---- branch
! 	if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
! 	my $sth=$dbh->prepare("select branchcode,branchname from branches order by branchname");
  	$sth->execute;
  	push @authorised_values, ""
***************
*** 119,150 ****
  
  	while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
! 	    push @authorised_values, $branchcode;
! 	    $authorised_lib{$branchcode}=$branchname;
! 	}
! 
!     #----- itemtypes
!     } elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
! 	my $sth=$dbh->prepare("select itemtype,description from itemtypes");
! 	$sth->execute;
! 	push @authorised_values, ""
! 		unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 
! 	while (my ($itemtype,$description) = $sth->fetchrow_array) {
! 	    push @authorised_values, $itemtype;
! 	    $authorised_lib{$itemtype}=$description;
  	}
  
!     #---- "true" authorised value
!     } else {
! 	$authorised_values_sth->execute
! 		($tagslib->{$tag}->{$subfield}->{authorised_value});
  
! 	push @authorised_values, ""
! 		unless ($tagslib->{$tag}->{$subfield}->{mandatory});
  
! 	while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) {
! 	    push @authorised_values, $value;
! 	    $authorised_lib{$value}=$lib;
! 	}
      }
      return CGI::scrolling_list( -name     => 'field_value',
--- 121,150 ----
  
  	while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
! 		push @authorised_values, $branchcode;
! 		$authorised_lib{$branchcode}=$branchname;
  	}
  
! 	#----- itemtypes
! 	} elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
! 		my $sth=$dbh->prepare("select itemtype,description from itemtypes order by description");
! 		$sth->execute;
! 		push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 	
! 		while (my ($itemtype,$description) = $sth->fetchrow_array) {
! 			push @authorised_values, $itemtype;
! 			$authorised_lib{$itemtype}=$description;
! 		}
! 		$value=$itemtype unless ($value);
  
! 	#---- "true" authorised value
! 	} else {
! 		$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
  
! 		push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 	
! 		while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) {
! 			push @authorised_values, $value;
! 			$authorised_lib{$value}=$lib;
! 		}
      }
      return CGI::scrolling_list( -name     => 'field_value',
***************
*** 314,323 ****
--- 314,327 ----
  my $z3950 = $input->param('z3950');
  my $op = $input->param('op');
+ $itemtype = $input->param('itemtype');
  my $dbh = C4::Context->dbh;
  my $bibid;
  if ($oldbiblionumber) {
  	$bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber);
+ 	# find itemtype
+ 	$itemtype = &MARCfind_itemtype($dbh,$bibid) if $bibid;
  }else {
  	$bibid = $input->param('bibid');
+ 	$itemtype = &MARCfind_itemtype($dbh,$bibid) if $bibid;
  }
  my ($template, $loggedinuser, $cookie)
***************
*** 330,337 ****
  			     });
  
! $tagslib = &MARCgettagslib($dbh,1);
  my $record=-1;
  my $encoding="";
  $record = MARCgetbiblio($dbh,$bibid) if ($bibid);
  ($record,$encoding) = MARCfindbreeding($dbh,$breedingid) if ($breedingid);
  
--- 334,342 ----
  			     });
  
! $tagslib = &MARCgettagslib($dbh,1,$itemtype);
  my $record=-1;
  my $encoding="";
  $record = MARCgetbiblio($dbh,$bibid) if ($bibid);
+ warn "R".$record->as_formatted;
  ($record,$encoding) = MARCfindbreeding($dbh,$breedingid) if ($breedingid);
  
***************
*** 373,377 ****
  	}
  # now, redirect to additem page
! 	print $input->redirect("additem.pl?bibid=$bibid");
  	exit;
  #------------------------------------------------------------------------------------------------------------------------------
--- 378,383 ----
  	}
  # now, redirect to additem page
! 	print $input->redirect("additem.pl?bibid=$bibid&itemtype=$itemtype");
! 	warn "redirect : $itemtype";
  	exit;
  #------------------------------------------------------------------------------------------------------------------------------
***************
*** 435,439 ****
  	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=/cgi-bin/koha/search.marc/search.pl?type=intranet\"></html>";
  	exit;
! #------------------------------------------------------------------------------------------------------------------------------#------------------------------------------------------------------------------------------------------------------------------
  } else {
  #------------------------------------------------------------------------------------------------------------------------------
--- 441,446 ----
  	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=/cgi-bin/koha/search.marc/search.pl?type=intranet\"></html>";
  	exit;
! #------------------------------------------------------------------------------------------------------------------------------
! #------------------------------------------------------------------------------------------------------------------------------
  } else {
  #------------------------------------------------------------------------------------------------------------------------------
***************
*** 449,451 ****
--- 456,461 ----
  		oldbiblioitemnumber         => $oldbiblioitemnumber );
  }
+ $template->param(
+ 		itemtype => $itemtype
+ 		);
  output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file

Index: addbooks.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbooks.pl,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** addbooks.pl	4 May 2003 03:16:15 -0000	1.19
--- addbooks.pl	18 May 2004 15:22:10 -0000	1.20
***************
*** 41,44 ****
--- 41,45 ----
  use C4::Interface::CGI::Output;
  use HTML::Template;
+ use C4::Koha;
  
  my $query = new CGI;
***************
*** 56,61 ****
      }
  );
  my $marc_p = C4::Context->boolean_preference("marc");
! $template->param( NOTMARC => !$marc_p );
  
  output_html_with_http_headers $query, $cookie, $template->output;
--- 57,74 ----
      }
  );
+ 
+ # get itemtype list
+ my $itemtypes = getitemtypes;
+ my @itemtypesloop;
+ foreach my $thisitemtype (keys %$itemtypes) {
+ 	my %row =(value => $thisitemtype,
+ 				description => $itemtypes->{$thisitemtype}->{'description'},
+ 			);
+ 	push @itemtypesloop, \%row;
+ }
+ 
  my $marc_p = C4::Context->boolean_preference("marc");
! $template->param( NOTMARC => !$marc_p,
! 				itemtypeloop => \@itemtypesloop );
  
  output_html_with_http_headers $query, $cookie, $template->output;

Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** additem.pl	14 Apr 2004 19:43:58 -0000	1.23
--- additem.pl	18 May 2004 15:22:10 -0000	1.24
***************
*** 56,60 ****
  my $itemnum = $input->param('itemnum');
  
! my $tagslib = &MARCgettagslib($dbh,1);
  my $record = MARCgetbiblio($dbh,$bibid);
  my $itemrecord;
--- 56,63 ----
  my $itemnum = $input->param('itemnum');
  
! # find itemtype
! my $itemtype = &MARCfind_itemtype($dbh,$bibid);
! 
! my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
  my $record = MARCgetbiblio($dbh,$bibid);
  my $itemrecord;





More information about the Koha-cvs mailing list