[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.9,1.10 addbooks.pl,1.14,1.15 additem.pl,1.8,1.9

Paul POULAIN tipaul at users.sourceforge.net
Tue Dec 10 14:29:11 CET 2002


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

Modified Files:
	addbiblio.pl addbooks.pl additem.pl 
Log Message:
* bugfixes
* improvements done during dombes intallation/tests
* adding authentication (new Auth.pm)

Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbiblio.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** addbiblio.pl	2 Dec 2002 15:13:05 -0000	1.9
--- addbiblio.pl	10 Dec 2002 13:29:09 -0000	1.10
***************
*** 80,85 ****
--- 80,89 ----
  $record = MARCfindbreeding($dbh,$isbn) if ($isbn);
  my $is_a_modif=0;
+ my ($oldbiblionumtagfield,$oldbiblionumtagsubfield);
  if ($bibid) {
  	$is_a_modif=1;
+ ($oldbiblionumtagfield,$oldbiblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber");
+ warn "==>$oldbiblionumtagfield,$oldbiblionumtagsubfield";
+ 
  }
  #------------------------------------------------------------------------------------------------------------------------------
***************
*** 102,106 ****
  	my $oldbibitemnum;
  	if ($is_a_modif) {
! 		($bibid,$oldbibnum,$oldbibitemnum) = NEWmodbiblio($dbh,$record,$bibid);
  	} else {
  		($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record);
--- 106,110 ----
  	my $oldbibitemnum;
  	if ($is_a_modif) {
! 		 NEWmodbiblio($dbh,$record,$bibid);
  	} else {
  		($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record);
***************
*** 117,121 ****
  	my $tag;
  	my $i=0;
! 	my $authorised_values_sth = $dbh->prepare("select authorised_value from authorised_values where category=?");
  # loop through each tab 0 through 9
  	for (my $tabloop = 0; $tabloop<=9;$tabloop++) {
--- 121,125 ----
  	my $tag;
  	my $i=0;
! 	my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=? order by authorised_value");
  # loop through each tab 0 through 9
  	for (my $tabloop = 0; $tabloop<=9;$tabloop++) {
***************
*** 143,146 ****
--- 147,151 ----
  					if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
  						my @authorised_values;
+ 						my %authorised_lib;
  						# builds list, depending on authorised value...
  						#---- branch
***************
*** 151,154 ****
--- 156,160 ----
  							while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
  								push @authorised_values, $branchcode;
+ 								$authorised_lib{$branchcode}=$branchname;
  							}
  						#----- itemtypes
***************
*** 159,162 ****
--- 165,169 ----
  							while (my ($itemtype,$description) = $sth->fetchrow_array) {
  								push @authorised_values, $itemtype;
+ 								$authorised_lib{$itemtype}=$description;
  							}
  						#---- "true" authorised value
***************
*** 164,169 ****
  							$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
  							push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 							while ((my $value) = $authorised_values_sth->fetchrow_array) {
  								push @authorised_values, $value;
  							}
  						}
--- 171,177 ----
  							$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;
  							}
  						}
***************
*** 171,184 ****
  																					-values=> \@authorised_values,
  																					-default=>"$value",
  																					-size=>1,
  																					-multiple=>0,
  																					);
  					} elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>"; #"
  					} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
  						my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
  						require $plugin;
  						my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
  					} else {
  						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
--- 179,194 ----
  																					-values=> \@authorised_values,
  																					-default=>"$value",
+ 																					-labels => \%authorised_lib,
  																					-size=>1,
  																					-multiple=>0,
  																					);
  					} elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255> <a href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>"; #"
  					} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
  						my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
  						require $plugin;
  						my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
! 						my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,$tabloop);
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  value=\"$value\" size=47 maxlength=255 OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i)\"> <a href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
  					} else {
  						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
***************
*** 190,209 ****
  					if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
  						my @authorised_values;
  						# 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, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
  							while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
  								push @authorised_values, $branchcode;
  							}
  						#----- 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;
  							}
  						#---- "true" authorised value
--- 200,222 ----
  					if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
  						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 branchcode");
  							$sth->execute;
  							push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
  							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 itemtype");
  							$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
***************
*** 211,216 ****
  							$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
  							push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 							while ((my $value) = $authorised_values_sth->fetchrow_array) {
  								push @authorised_values, $value;
  							}
  						}
--- 224,230 ----
  							$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;
  							}
  						}
***************
*** 218,221 ****
--- 232,236 ----
  																					-values=> \@authorised_values,
  																					-default=>"$value",
+ 																					-labels => \%authorised_lib,
  																					-size=>1,
  																					-multiple=>0,
***************
*** 227,231 ****
  						require $plugin;
  						my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
  					} else {
  						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=50 maxlength=255>";
--- 242,247 ----
  						require $plugin;
  						my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
! 						my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,$tabloop);
! 						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i)\"> <a href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
  					} else {
  						$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=50 maxlength=255>";
***************
*** 267,271 ****
  	$template->param(
  							oldbiblionumber => $oldbiblionumber,
! 							bibid => $bibid);
  }
  print "Content-Type: text/html\n\n", $template->output;
--- 283,289 ----
  	$template->param(
  							oldbiblionumber => $oldbiblionumber,
! 							bibid => $bibid,
! 							oldbiblionumtagfield => $oldbiblionumtagfield,
! 							oldbiblionumtagsubfield => $oldbiblionumtagsubfield);
  }
  print "Content-Type: text/html\n\n", $template->output;

Index: addbooks.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbooks.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** addbooks.pl	15 Oct 2002 10:14:44 -0000	1.14
--- addbooks.pl	10 Dec 2002 13:29:09 -0000	1.15
***************
*** 36,39 ****
--- 36,40 ----
  use CGI;
  use strict;
+ use C4::Auth;
  use C4::Catalogue;
  use C4::Biblio;
***************
*** 42,48 ****
  
  my $query = new CGI;
  
  my $error   = $query->param('error');
  my $success = $query->param('biblioitem');
  my $template= gettemplate("acqui.simple/addbooks.tmpl");
! print "Content-Type: text/html\n\n",$template->output;
\ No newline at end of file
--- 43,52 ----
  
  my $query = new CGI;
+ my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
  
  my $error   = $query->param('error');
  my $success = $query->param('biblioitem');
  my $template= gettemplate("acqui.simple/addbooks.tmpl");
! $template->param(loggedinuser => $loggedinuser);
! 
! print $query->header(-cookie => $cookie),$template->output;

Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** additem.pl	19 Nov 2002 12:32:23 -0000	1.8
--- additem.pl	10 Dec 2002 13:29:09 -0000	1.9
***************
*** 71,75 ****
  	my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
  # MARC::Record builded => now, record in DB
! 	my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid);
  	$nextop = "additem";
  #------------------------------------------------------------------------------------------------------------------------------
--- 71,75 ----
  	my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
  # MARC::Record builded => now, record in DB
! 	my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid);
  	$nextop = "additem";
  #------------------------------------------------------------------------------------------------------------------------------
***************
*** 89,92 ****
--- 89,93 ----
  	my @ind_tag = $input->param('ind_tag');
  	my @indicator = $input->param('indicator');
+ #	my $itemnum = $input->param('itemnum');
  	my %indicators;
  	for (my $i=0;$i<=$#ind_tag;$i++) {
***************
*** 95,99 ****
  	my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
  # MARC::Record builded => now, record in DB
! 	my ($bibid,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0);
  	$nextop="additem";
  }
--- 96,100 ----
  	my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
  # MARC::Record builded => now, record in DB
! 	my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0);
  	$nextop="additem";
  }
***************
*** 156,160 ****
  my @loop_data =();
  my $i=0;
! my $authorised_values_sth = $dbh->prepare("select authorised_value from authorised_values where category=?");
  
  foreach my $tag (sort keys %{$tagslib}) {
--- 157,161 ----
  my @loop_data =();
  my $i=0;
! my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=? order by authorised_value");
  
  foreach my $tag (sort keys %{$tagslib}) {
***************
*** 175,178 ****
--- 176,180 ----
  		if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
  			my @authorised_values;
+ 			my %authorised_lib;
  			# builds list, depending on authorised value...
  			#---- branch
***************
*** 183,186 ****
--- 185,189 ----
  				while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
  					push @authorised_values, $branchcode;
+ 					$authorised_lib{$branchcode}=$branchname;
  				}
  			#----- itemtypes
***************
*** 191,194 ****
--- 194,198 ----
  				while (my ($itemtype,$description) = $sth->fetchrow_array) {
  					push @authorised_values, $itemtype;
+ 					$authorised_lib{$itemtype}=$description;
  				}
  			#---- "true" authorised value
***************
*** 196,201 ****
  				$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
  				push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! 				while ((my $value) = $authorised_values_sth->fetchrow_array) {
  					push @authorised_values, $value;
  				}
  			}
--- 200,206 ----
  				$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;
  				}
  			}
***************
*** 203,216 ****
  																		-values=> \@authorised_values,
  																		-default=>"$value",
  																		-size=>1,
  																		-multiple=>0,
  																		);
  		} elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! 			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
  		} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
  			my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
  			require $plugin;
  			my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,0);
! 			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
  		} else {
  			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
--- 208,223 ----
  																		-values=> \@authorised_values,
  																		-default=>"$value",
+ 																		-labels => \%authorised_lib,
  																		-size=>1,
  																		-multiple=>0,
  																		);
  		} elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! 			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255> <a href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
  		} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
  			my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
  			require $plugin;
  			my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,0);
! 			my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,0);
! 			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i)\"> <a href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
  		} else {
  			$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
***************
*** 228,231 ****
  						item => \@loop_data,
  						itemnum => $itemnum,
! 						op => $nextop);
  print "Content-Type: text/html\n\n", $template->output;
--- 235,241 ----
  						item => \@loop_data,
  						itemnum => $itemnum,
! 						itemtagfield => $itemtagfield,
! 						itemtagsubfield =>$itemtagsubfield,
! 						op => $nextop,
! 						opisadd => ($nextop eq "saveitem")?0:1);
  print "Content-Type: text/html\n\n", $template->output;





More information about the Koha-cvs mailing list