[Koha-cvs] CVS: koha/admin checkmarc.pl,1.6,1.7 itemtypes.pl,1.18,1.19 marctagstructure.pl,1.28,1.29

Paul POULAIN tipaul at users.sourceforge.net
Mon Jun 20 15:17:19 CEST 2005


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

Modified Files:
	checkmarc.pl itemtypes.pl marctagstructure.pl 
Log Message:
synch'ing 2.2 and head

Index: checkmarc.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/checkmarc.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** checkmarc.pl	22 Dec 2003 19:16:58 -0000	1.6
--- checkmarc.pl	20 Jun 2005 13:17:16 -0000	1.7
***************
*** 77,80 ****
--- 77,81 ----
  my $tab = $res2;
  my $subtotal=0;
+ warn "TAGF : $tagfield";
  while (($res,$res2,$field) = $sth->fetchrow) {
  	# (ignore itemnumber, that must be in -1 tab)
***************
*** 97,100 ****
--- 98,118 ----
  	$total++;
  }
+ 
+ $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where tab = 10");
+ $sth->execute;
+ my $totaltags = 0;
+ my $list = "";
+ while (($res2) = $sth->fetchrow) {
+ 	$totaltags++;
+ 	$list.=$res2.",";
+ }
+ if ($totaltags > 1) {
+ 	$template->param(itemtags => $list);
+ 	$total++;
+ } else {
+ 	$template->param(itemtags => 0);
+ }
+ 
+ 
  # checks biblioitems.itemtype must be mapped and use authorised_value=itemtype
  $sth = $dbh->prepare("select tagfield,tab,authorised_value from marc_subfield_structure where kohafield = \"biblioitems.itemtype\"");
***************
*** 146,149 ****
--- 164,189 ----
  }
  
+ $sth = $dbh->prepare("select count(*) from marc_biblio where frameworkcode is NULL");
+ $sth->execute;
+ ($res) = $sth->fetchrow;
+ if ($res) {
+ 	$template->param(frameworknull =>1);
+ 	$total++;
+ }
+ $sth = $dbh->prepare("select count(*) from marc_subfield_structure where frameworkcode is NULL");
+ $sth->execute;
+ ($res) = $sth->fetchrow;
+ if ($res) {
+ 	$template->param(frameworknull =>1);
+ 	$total++;
+ }
+ $sth = $dbh->prepare("select count(*) from marc_tag_structure where frameworkcode is NULL");
+ $sth->execute;
+ ($res) = $sth->fetchrow;
+ if ($res) {
+ 	$template->param(frameworknull =>1);
+ 	$total++;
+ }
+ 
  $template->param(total => $total);
  output_html_with_http_headers $input, $cookie, $template->output;

Index: itemtypes.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/itemtypes.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** itemtypes.pl	23 Mar 2005 09:44:59 -0000	1.18
--- itemtypes.pl	20 Jun 2005 13:17:16 -0000	1.19
***************
*** 177,184 ****
  		}
  		$row_data{toggle} = $toggle;
! 		$row_data{itemtype} = $results->[$i]{'itemtype'};
! 		$row_data{description} = $results->[$i]{'description'};
! 		$row_data{renewalsallowed} = $results->[$i]{'renewalsallowed'};
! 		$row_data{rentalcharge} = sprintf("%.2f",$results->[$i]{'rentalcharge'});
  		push(@loop_data, \%row_data);
  	}
--- 177,185 ----
  		}
  		$row_data{toggle} = $toggle;
! 		$row_data{itemtype} = $results->[$i]{itemtype};
! 		$row_data{description} = $results->[$i]{description};
! 		$row_data{renewalsallowed} = $results->[$i]{renewalsallowed};
! 		$row_data{notforloan} = $results->[$i]{notforloan};
! 		$row_data{rentalcharge} = sprintf("%.2f",$results->[$i]{rentalcharge});
  		push(@loop_data, \%row_data);
  	}

Index: marctagstructure.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/marctagstructure.pl,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** marctagstructure.pl	1 Mar 2005 13:40:50 -0000	1.28
--- marctagstructure.pl	20 Jun 2005 13:17:17 -0000	1.29
***************
*** 43,46 ****
--- 43,47 ----
  my $offset=$input->param('offset');
  my $op = $input->param('op');
+ my $dspchoice = $input->param('select_display');
  my $pagesize=20;
  
***************
*** 217,243 ****
  		 $template->param(searchfield => $searchfield);
  	}
! 	my $env;
! 	my ($count,$results)=StringSearch($env,$searchfield,$frameworkcode);
! 	my $toggle=0;
! 	my @loop_data = ();
! 	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
! 	  	if ($toggle eq 0){
! 			$toggle=1;
! 	  	} else {
! 			$toggle=0;
! 	  	}
! 		my %row_data;  # get a fresh hash for the row data
! 		$row_data{tagfield} = $results->[$i]{'tagfield'};
! 		$row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
! 		$row_data{repeatable} = $results->[$i]{'repeatable'};
! 		$row_data{mandatory} = $results->[$i]{'mandatory'};
! 		$row_data{authorised_value} = $results->[$i]{'authorised_value'};
! 		$row_data{subfield_link} ="marc_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 		$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 		$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 		$row_data{toggle} = $toggle;
! 		push(@loop_data, \%row_data);
  	}
- 	$template->param(loop => \@loop_data);
  	if ($offset>0) {
  		my $prevpage = $offset-$pagesize;
--- 218,317 ----
  		 $template->param(searchfield => $searchfield);
  	}
! 	my $cnt=0;
! 	if ($dspchoice) {
! 		#here, user only wants used tags/subfields displayed
! 		my $env;
! 		$searchfield=~ s/\'/\\\'/g;
! 		my @data=split(' ',$searchfield);
! 		my $sth=$dbh->prepare("Select marc_tag_structure.tagfield as mts_tagfield,marc_tag_structure.liblibrarian as mts_liblibrarian,marc_tag_structure.libopac as mts_libopac,marc_tag_structure.repeatable as mts_repeatable,marc_tag_structure.mandatory as mts_mandatory,marc_tag_structure.authorised_value as mts_authorized_value,marc_subfield_structure.* from marc_tag_structure LEFT JOIN marc_subfield_structure ON (marc_tag_structure.tagfield=marc_subfield_structure.tagfield AND marc_tag_structure.frameworkcode=marc_subfield_structure.frameworkcode) where (marc_tag_structure.tagfield >= ? and marc_tag_structure.frameworkcode=?) AND marc_subfield_structure.tab>=0 order by marc_tag_structure.tagfield,marc_subfield_structure.tagsubfield");
! 		#could be ordoned by tab
! 		$sth->execute($data[0], $frameworkcode);
! 		my @results = ();
! 		while (my $data=$sth->fetchrow_hashref){
! 			push(@results,$data);
! 			$cnt++;
! 		}
! 		$sth->finish;
! 		
! 		my $toggle=0;
! 		my @loop_data = ();
! 		my $j=1;
! 		my $i=$offset;
! 		while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
! 			if ($toggle eq 0){
! 				$toggle=1;
! 			} else {
! 				$toggle=0;
! 			}
! 			my %row_data;  # get a fresh hash for the row data
! 			$row_data{tagfield} = $results[$i]->{'mts_tagfield'};
! 			$row_data{liblibrarian} = $results[$i]->{'mts_liblibrarian'};
! 			$row_data{repeatable} = $results[$i]->{'mts_repeatable'};
! 			$row_data{mandatory} = $results[$i]->{'mts_mandatory'};
! 			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
! 			$row_data{subfield_link} ="marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{toggle} = $toggle;
! 			$j=$i;
! 			my @internal_loop = ();
! 			while (($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j< ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) {
! 				if ($toggle eq 0) {
! 					$toggle=1;
! 				} else {
! 					$toggle=0;
! 				}
! 				my %subfield_data;
! 				$subfield_data{tagsubfield} = $results[$j]->{'tagsubfield'};
! 				$subfield_data{liblibrarian} = $results[$j]->{'liblibrarian'};
! 				$subfield_data{kohafield} = $results[$j]->{'kohafield'};
! 				$subfield_data{repeatable} = $results[$j]->{'repeatable'};
! 				$subfield_data{mandatory} = $results[$j]->{'mandatory'};
! 				$subfield_data{tab} = $results[$j]->{'tab'};
! 				$subfield_data{seealso} = $results[$j]->{'seealso'};
! 				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
! 				$subfield_data{authtypecode}= $results[$j]->{'authtypecode'};
! 				$subfield_data{value_builder}= $results[$j]->{'value_builder'};
! 				$subfield_data{toggle}	= $toggle;
! # 				warn "tagfield :  ".$results[$j]->{'tagfield'}." tagsubfield :".$results[$j]->{'tagsubfield'};
! 				push @internal_loop,\%subfield_data;
! 				$j++;
! 			}
! 			$row_data{'subfields'}=\@internal_loop;
! 			push(@loop_data, \%row_data);
! #			undef @internal_loop;
! 			$i=$j;
! 		}
! 		$template->param(select_display => "True",
! 						loop => \@loop_data);
! 		#  $sth->execute;
! 		$sth->finish;
! 	} else {
! 		#here, normal old style : display every tags
! 		my $env;
! 		my ($count,$results)=StringSearch($env,$searchfield,$frameworkcode);
! 		$cnt = $count;
! 		my $toggle=0;
! 		my @loop_data = ();
! 		for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
! 			if ($toggle eq 0){
! 				$toggle=1;
! 			} else {
! 				$toggle=0;
! 			}
! 			my %row_data;  # get a fresh hash for the row data
! 			$row_data{tagfield} = $results->[$i]{'tagfield'};
! 			$row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
! 			$row_data{repeatable} = $results->[$i]{'repeatable'};
! 			$row_data{mandatory} = $results->[$i]{'mandatory'};
! 			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
! 			$row_data{subfield_link} ="marc_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
! 			$row_data{toggle} = $toggle;
! 			push(@loop_data, \%row_data);
! 		}
! 		$template->param(loop => \@loop_data);
  	}
  	if ($offset>0) {
  		my $prevpage = $offset-$pagesize;
***************
*** 247,253 ****
  						script_name => $script_name,
  						frameworkcode => $frameworkcode,
! 		 );
  	}
! 	if ($offset+$pagesize<$count) {
  		my $nextpage =$offset+$pagesize;
  		$template->param(nextpage =>$nextpage,
--- 321,327 ----
  						script_name => $script_name,
  						frameworkcode => $frameworkcode,
! 		);
  	}
! 	if ($offset+$pagesize<$cnt) {
  		my $nextpage =$offset+$pagesize;
  		$template->param(nextpage =>$nextpage,





More information about the Koha-cvs mailing list