From e11872aeb14c9f0bf5598102ab9e5de2409ee598 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 12 Nov 2002 15:58:43 +0000 Subject: [PATCH] road to 1.3.2 : * many bugfixes * adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance) --- C4/Biblio.pm | 59 ++++++++---- MARCdetail.pl | 1 + acqui.simple/addbiblio.pl | 91 +++++++++++++----- acqui.simple/marcimport.pl | 16 +++- .../default/en/acqui.simple/addbiblio.tmpl | 46 ++++----- .../default/en/acqui.simple/addbiblio2.tmpl | 4 +- .../en/value_builder/unimarc_field_100.tmpl | 48 ++++++++++ thesaurus_popup.pl | 94 +++++++++---------- value_builder/unimarc_field_100.pl | 52 ++++++++++ 9 files changed, 296 insertions(+), 115 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl create mode 100755 value_builder/unimarc_field_100.pl diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b8aaa612c2..23543038c8 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1,6 +1,11 @@ package C4::Biblio; # $Id$ # $Log$ +# Revision 1.26 2002/11/12 15:58:43 tipaul +# road to 1.3.2 : +# * many bugfixes +# * adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance) +# # Revision 1.25 2002/10/25 10:58:26 tipaul # Road to 1.3.2 # * bugfixes and improvements @@ -355,20 +360,24 @@ sub MARCgettagslib { } if ($forlibrarian eq 1) { - $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib,tab, mandatory, repeatable,authorised_value from marc_subfield_structure"); + $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder from marc_subfield_structure"); } else { - $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib,tab, mandatory, repeatable,authorised_value from marc_subfield_structure"); + $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder from marc_subfield_structure"); } $sth->execute; my $subfield; my $authorised_value; - while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value) = $sth->fetchrow) { + my $thesaurus_category; + my $value_builder; + while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value,$thesaurus_category,$value_builder) = $sth->fetchrow) { $res->{$tag}->{$subfield}->{lib}=$lib; $res->{$tag}->{$subfield}->{tab}=$tab; $res->{$tag}->{$subfield}->{mandatory}=$mandatory; $res->{$tag}->{$subfield}->{repeatable}=$repeatable; $res->{$tag}->{$subfield}->{authorised_value}=$authorised_value; + $res->{$tag}->{$subfield}->{thesaurus_category}=$thesaurus_category; + $res->{$tag}->{$subfield}->{value_builder}=$value_builder; } return $res; } @@ -461,7 +470,7 @@ sub MARCadditem { sub MARCaddsubfield { # Add a new subfield to a tag into the DB. - my ($dbh,$bibid,$tagid,$indicator,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue) = @_; + my ($dbh,$bibid,$tagid,$tag_indicator,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue) = @_; # if not value, end of job, we do nothing if (not($subfieldvalue)) { return; @@ -476,21 +485,21 @@ sub MARCaddsubfield { $sth=$dbh->prepare("select max(blobidlink)from marc_blob_subfield"); $sth->execute; my ($res)=$sth->fetchrow; - $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)"); + $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?,?)"); if ($tagid<100) { - $sth->execute($bibid,'0'.$tagid,$tagorder,$subfieldcode,$subfieldorder,$res); + $sth->execute($bibid,'0'.$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$res); } else { - $sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$res); + $sth->execute($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$res); } if ($sth->errstr) { - print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue)\n"; + print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue)\n"; } # $dbh->do("unlock tables"); } else { - my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values (?,?,?,?,?,?)"); - $sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue); + my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values (?,?,?,?,?,?,?)"); + $sth->execute($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue); if ($sth->errstr) { - print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue)\n"; + print STDERR "ERROR ==> insert into marc_subfield_table (bibid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values ($bibid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue)\n"; } } &MARCaddword($dbh,$bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$subfieldvalue); @@ -509,6 +518,7 @@ sub MARCgetbiblio { $sth->execute($bibid); my $prevtagorder=1; my $prevtag; + my $previndicator; my %subfieldlist={}; while (my $row=$sth->fetchrow_hashref) { if ($row->{'valuebloblink'}) { #---- search blob if there is one @@ -517,16 +527,24 @@ sub MARCgetbiblio { $sth2->finish; $row->{'subfieldvalue'}=$row2->{'subfieldvalue'}; } +# warn "$row->{bibid} = $row->{tag} - $row->{subfieldcode}"; if ($row->{tagorder} ne $prevtagorder) { - my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist); + if (length($prevtag) <3) { + $prevtag = "0".$prevtag; + } + $previndicator.=" "; + my $field = MARC::Field->new( $prevtag, substr($previndicator,0,1), substr($previndicator,1,1), %subfieldlist); +# warn $field->as_formatted(); $record->add_fields($field); $prevtagorder=$row->{tagorder}; $prevtag = $row->{tag}; + $previndicator=$row->{tag}; %subfieldlist={}; %subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'}; } else { %subfieldlist->{$row->{'subfieldcode'}} = $row->{'subfieldvalue'}; $prevtag= $row->{tag}; + $previndicator=$row->{indicator}; } } # the last has not been included inside the loop... do it now ! @@ -841,14 +859,18 @@ sub MARCkoha2marcOnefield { } sub MARChtml2marc { - my ($dbh,$rtags,$rsubfields,$rvalues) = @_; + my ($dbh,$rtags,$rsubfields,$rvalues,%indicators) = @_; my $prevtag = @$rtags[0]; my $record = MARC::Record->new(); my %subfieldlist={}; for (my $i=0; $i<= @$rtags; $i++) { # rebuild MARC::Record if (@$rtags[$i] ne $prevtag) { - my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist); + if ($prevtag<10) { + $prevtag='0'.10; + } + $indicators{$prevtag}.=' '; + my $field = MARC::Field->new( $prevtag, substr($indicators{$prevtag},0,1),substr($indicators{$prevtag},1,1), %subfieldlist); $record->add_fields($field); $prevtag = @$rtags[$i]; %subfieldlist={}; @@ -991,8 +1013,8 @@ sub NEWnewbiblio { $sth->execute("biblioitems.biblioitemnumber"); (my $tagfield2, my $tagsubfield2) = $sth->fetchrow; if ($tagsubfield1 != $tagsubfield2) { - print STDERR "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same field number"; - print "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same field number"; + print STDERR "Error in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same subfield number"; + print "Content-Type: text/html\n\nError in NEWnewbiblio : biblio.biblionumber and biblioitems.biblioitemnumber MUST have the same subfield number"; die; } my $newfield = MARC::Field->new( $tagfield1,'','', @@ -1008,6 +1030,7 @@ sub NEWnewbiblio { sub NEWnewitem { my ($dbh, $record,$bibid) = @_; + warn "add item : ".$record->as_formatted(); # add item in old-DB my $item = &MARCmarc2koha($dbh,$record); # needs old biblionumber and biblioitemnumber @@ -1408,7 +1431,7 @@ sub OLDnewitems { # foreach my $barcode (@barcodes) { # $barcode = uc($barcode); $barcode = $dbh->quote($barcode); - $sth->prepare("Insert into items set + $sth=$dbh->prepare("Insert into items set itemnumber = ?, biblionumber = ?, biblioitemnumber = ?, barcode = ?, booksellerid = ?, dateaccessioned = NOW(), @@ -1422,7 +1445,7 @@ sub OLDnewitems { $item->{'booksellerid'}, $item->{'homebranch'},$item->{'homebranch'}, $item->{'price'},$item->{'replacementprice'}, - NOW(),$item->{'itemnotes'},$item->{'loan'}); + $item->{'itemnotes'},$item->{'loan'}); $sth->execute; if (defined $sth->errstr) { diff --git a/MARCdetail.pl b/MARCdetail.pl index baf3415447..14ddd6ac55 100755 --- a/MARCdetail.pl +++ b/MARCdetail.pl @@ -59,6 +59,7 @@ my $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$biblionumber); my $tagslib = &MARCgettagslib($dbh,1); my $record =MARCgetbiblio($dbh,$bibid); +warn $record->as_formatted(); # open template my $template = gettemplate("catalogue/MARCdetail.tmpl",0); # fill arrays diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl index 7f485d0893..ab3cc0d3fd 100755 --- a/acqui.simple/addbiblio.pl +++ b/acqui.simple/addbiblio.pl @@ -35,16 +35,19 @@ use HTML::Template; use MARC::File::USMARC; sub find_value { - my ($tagfield,$subfield,$record) = @_; + my ($tagfield,$insubfield,$record) = @_; my $result; + my $indicator; foreach my $field ($record->field($tagfield)) { my @subfields = $field->subfields(); foreach my $subfield (@subfields) { - if (@$subfield[0] eq $subfield) { + if (@$subfield[0] eq $insubfield) { $result .= @$subfield[1]; + $indicator = $field->indicator(1).$field->indicator(2); } } } + return($indicator,$result); } sub MARCfindbreeding { @@ -55,13 +58,12 @@ sub MARCfindbreeding { if ($marc) { my $record = MARC::File::USMARC::decode($marc); if (ref($record) eq undef) { - warn "not a MARC record !"; + warn "not a MARC record : $marc"; return -1; } else { return $record; } } - warn "not MARC"; return -1; } @@ -88,12 +90,21 @@ my $record = MARCfindbreeding($dbh,$isbn) if ($isbn); if ($op eq "addbiblio") { #------------------------------------------------------------------------------------------------------------------------------ # rebuild - my @tags = $input->param('tag[]'); - my @subfields = $input->param('subfield[]'); - my @values = $input->param('value[]'); - my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values); + my @tags = $input->param('tag'); + my @subfields = $input->param('subfield'); + my @values = $input->param('field_value'); + # build indicator hash. + my @ind_tag = $input->param('ind_tag'); + my @indicator = $input->param('indicator'); + my %indicators; + for (my $i=0;$i<=$#ind_tag;$i++) { + $indicators{$ind_tag[$i]} = $indicator[$i]; + } + my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); +# warn "record ".$record->as_formatted(); # MARC::Record builded => now, record in DB my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record); + my $authorised_values_sth = $dbh->prepare("select authorised_value from authorised_values where category=?"); # build item screen. There is no item for instance. my @loop_data =(); my $i=0; @@ -111,7 +122,23 @@ if ($op eq "addbiblio") { $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; - $subfield_data{marc_value}=""; + if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { + $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); + my @authorised_values; + push @authorised_values, "" unless ($subfield_data{mandatory}); + while ((my $value) = $authorised_values_sth->fetchrow_array) { + push @authorised_values, $value; + } + $subfield_data{marc_value}= CGI::scrolling_list(-name=>'field_value', + -values=> \@authorised_values, + -size=>1, + -multiple=>0, + ); + } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { + $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; + } else { + $subfield_data{marc_value}=""; + } push(@loop_data, \%subfield_data); } } @@ -121,10 +148,19 @@ if ($op eq "addbiblio") { #------------------------------------------------------------------------------------------------------------------------------ } elsif ($op eq "additem") { #------------------------------------------------------------------------------------------------------------------------------ - my @tags = $input->param('tag[]'); - my @subfields = $input->param('subfield[]'); - my @values = $input->param('value[]'); - my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values); + my @tags = $input->param('tag'); + my @subfields = $input->param('subfield'); + my @values = $input->param('field_value'); +# my @ind_tag = $input->param('ind_tag'); +# my @indicator = $input->param('indicator'); +# my %indicators; +# for (my $i=0;$i<=$#ind_tag;$i++) { +# $indicators{$ind_tag[$i]} = $indicator[$i]; +# } + my %indicators; + $indicators{995}=' '; + warn "REs : $tags[0] - $tags[1] - $subfields[0] - $subfields[1] - $values[0] - $values[1]"; + my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid); # now, build existiing item list my $temp = MARCgetbiblio($dbh,$bibid); @@ -203,17 +239,17 @@ if ($op eq "addbiblio") { 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 +# loop through each tab 0 through 9 for (my $tabloop = 0; $tabloop<=9;$tabloop++) { - # loop through each tag # my @fields = $record->fields(); my @loop_data =(); foreach my $tag (keys %{$tagslib}) { my $previous_tag = ''; my @subfields_data; - # loop through each subfield + my $indicator; +# loop through each subfield foreach my $subfield (keys %{$tagslib->{$tag}}) { - next if ($subfield eq 'lib'); + next if ($subfield eq 'lib'); # skip lib and tabs, which are koha internal next if ($subfield eq 'tab'); next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop); my %subfield_data; @@ -222,8 +258,10 @@ if ($op eq "addbiblio") { $subfield_data{marc_lib}="
".$tagslib->{$tag}->{$subfield}->{lib}."
"; $subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; + # if breeding is not empty if ($record ne -1) { - my $value = find_value($tag,$subfield,$record); + my ($x,$value) = find_value($tag,$subfield,$record); + $indicator = $x if $x; if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); my @authorised_values; @@ -237,9 +275,14 @@ if ($op eq "addbiblio") { -size=>1, -multiple=>0, ); + } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { + $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; + } elsif ($tagslib->{$tag}->{$subfield}->{value_builder}) { + $subfield_data{marc_value}=" {$tag}->{$subfield}->{value_builder}?index=$i',$i)\">..."; } else { $subfield_data{marc_value}=""; } + # if breeding is empty } else { if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); @@ -253,6 +296,10 @@ if ($op eq "addbiblio") { -size=>1, -multiple=>0, ); + } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { + $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; + } elsif ($tagslib->{$tag}->{$subfield}->{value_builder}) { + $subfield_data{marc_value}=" {$tag}->{$subfield}->{value_builder}?index=$i',$i)\">..."; } else { $subfield_data{marc_value}=""; } @@ -262,8 +309,10 @@ if ($op eq "addbiblio") { } if ($#subfields_data>=0) { my %tag_data; - $tag_data{tag}=$tag.' -'. $tagslib->{$tag}->{lib}; - $tag_data{subfield} = \@subfields_data; + $tag_data{tag}=$tag; + $tag_data{tag_lib} = $tagslib->{$tag}->{lib}; + $tag_data{indicator} = $indicator; + $tag_data{subfield_loop} = \@subfields_data; push (@loop_data, \%tag_data); } } @@ -283,7 +332,7 @@ if ($op eq "addbiblio") { $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; - $subfield_data{marc_value}=""; + $subfield_data{marc_value}=""; push(@loop_data, \%subfield_data); $i++ } diff --git a/acqui.simple/marcimport.pl b/acqui.simple/marcimport.pl index ef8d311187..20ab1fa9a1 100755 --- a/acqui.simple/marcimport.pl +++ b/acqui.simple/marcimport.pl @@ -95,6 +95,8 @@ if ($uploadmarc && length($uploadmarc)>0) { my $oldbiblio = MARCmarc2koha($dbh,$marcrecord); # if isbn found and biblio does not exist, add it. If isbn found and biblio exists, overwrite or ignore depending on user choice if ($oldbiblio->{isbn} || $oldbiblio->{issn}) { + # drop every "special" char : spaces, - ... + $oldbiblio->{isbn} =~ s/ |-|\.//g, # search if biblio exists my $biblioitemnumber; if ($oldbiblio->{isbn}) { @@ -117,10 +119,11 @@ if ($uploadmarc && length($uploadmarc)>0) { ($breedingresult) = $searchbreeding->fetchrow; } if (!$breedingresult || $overwrite_biblio) { - if ($oldbiblio->{isbn} eq '0025003402') { - warn "IMPORT => $marcarray[$i]\x1D')"; - } - $insertsql ->execute($filename,$oldbiblio->{isbn}.$oldbiblio->{issn},$marcarray[$i]."\x1D')"); + my $recoded; + warn "IMPORT => $marcarray[$i]\x1D')"; + $recoded = $marcrecord->as_usmarc(); #MARC::File::USMARC::encode($marcrecord); + warn "RECODED : $recoded"; + $insertsql ->execute($filename,$oldbiblio->{isbn}.$oldbiblio->{issn},$recoded); $imported++; } else { $alreadyinfarm++; @@ -796,6 +799,11 @@ sub FormatMarcText { #--------------- # log cleared, as marcimport is (almost) rewritten from scratch. # $Log$ +# Revision 1.22 2002/11/12 15:58:43 tipaul +# road to 1.3.2 : +# * many bugfixes +# * adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance) +# # Revision 1.21 2002/10/22 15:50:23 tipaul # road to 1.3.2 : adding a biblio in MARC format. # seems to work a few. diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl index ea2cf5f72d..f0d3549368 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl @@ -28,8 +28,8 @@
- - + + @@ -49,8 +49,8 @@
">"> -
 
- - + + @@ -70,8 +70,8 @@
">"> -
 
- - + + @@ -91,8 +91,8 @@
">"> -
 
- - + + @@ -112,8 +112,8 @@
">"> -
 
- - + + @@ -133,8 +133,8 @@
">"> -
 
- - + + @@ -154,8 +154,8 @@
">"> -
 
- - + + @@ -175,8 +175,8 @@
">"> -
 
- - + + @@ -196,8 +196,8 @@
">"> -
 
- - + + @@ -217,8 +217,8 @@
">"> -
 
- - + + @@ -252,7 +252,6 @@
">"> -
 
- @@ -293,6 +292,11 @@ function Check(f) { alert(alertString2); } } +function Dopop(link,i) { + defaultvalue=document.forms[0].field_value[i].value; + newin=window.open(link+"&result="+defaultvalue,"value builder",'width=500,height=400,toolbar=false,scrollbars=yes'); +} + diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio2.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio2.tmpl index 2c14424764..39493d6e9c 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio2.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio2.tmpl @@ -59,8 +59,8 @@ - "> - "> + "> + "> diff --git a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl new file mode 100644 index 0000000000..d1259d2a19 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl @@ -0,0 +1,48 @@ + + +UNIMARC Field 100 builder + + +
+ + + + + + + + + + + + + + + + + +
Date d'enregistrement ">
Code date publication +
Année début">
Année fin">
+
+ + + diff --git a/thesaurus_popup.pl b/thesaurus_popup.pl index 422df3571c..1a011790bb 100755 --- a/thesaurus_popup.pl +++ b/thesaurus_popup.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # written 10/5/2002 by Paul -# build Subject field using bibliothesaurus table +# build result field using bibliothesaurus table # Copyright 2000-2002 Katipo Communications @@ -24,68 +24,64 @@ use strict; use CGI; use C4::Context; +use HTML::Template; use C4::Search; -use C4::Circulation::Circ2; +#use C4::Circulation::Circ2; use C4::Output; +#use C4::Biblio; # get all the data .... my %env; my $input = new CGI; -my $subject = $input->param('subject'); +my $result = $input->param('result'); my $search_string= $input->param('search_string'); my $op = $input->param('op'); -my $freelib_text = $input->param('freelib_text'); +my $id = $input->param('id'); +my $category = $input->param('category'); +my $index= $input->param('index'); my $dbh = C4::Context->dbh; # make the page ... -print $input->header; +#print $input->header; if ($op eq "select") { - $subject .= "|$freelib_text"; + my $sti = $dbh->prepare("select stdlib from bibliothesaurus where id=?"); + $sti->execute($id); + my ($freelib_text) = $sti->fetchrow_array; + if (length($result)>0) { + $result .= "|$freelib_text"; + } else { + $result = $freelib_text; + } } -print <<"EOF"; - - - Subject builder - - -
-
-

- -

-
-EOF + +my $template = gettemplate("thesaurus_popup.tmpl",0); # /search thesaurus terms starting by search_string - if ($search_string) { - print '
'; - print ' - - - -
-EOF +my @freelib; +my %stdlib; +my $select_list; +if ($search_string) { + my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where freelib like '".$search_string."%' and category ='$category'"); + $sti->execute; + while (my $line=$sti->fetchrow_hashref) { + $stdlib{$line->{'id'}} = "$line->{'freelib'}"; + push(@freelib,$line->{'id'}); } - print <<"EOF"; -
- -
- - - -EOF + $select_list= CGI::scrolling_list( -name=>'id', + -values=> \@freelib, + -default=> "", + -size=>1, + -multiple=>0, + -labels=> \%stdlib + ); +} +$template->param(select_list => $select_list, + search_string => $search_string, + result => $result, + category => $category, + index => $index + ); +print "Content-Type: text/html\n\n", $template->output; + + diff --git a/value_builder/unimarc_field_100.pl b/value_builder/unimarc_field_100.pl new file mode 100755 index 0000000000..384cb6c5d2 --- /dev/null +++ b/value_builder/unimarc_field_100.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +# written 10/5/2002 by Paul + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use CGI; +use C4::Context; +use HTML::Template; +use C4::Search; +use C4::Output; + +# get all the data .... +my %env; + +my $input = new CGI; +my $index= $input->param('index'); +my $result= $input->param('result'); + + +my $dbh = C4::Context->dbh; + +my $template = gettemplate("value_builder/unimarc_field_100.tmpl",0); +my $f1 = substr($result,0,8); +my $f2 = substr($result,8,1); +my $f3 = substr($result,9,4); +my $f4 = substr($result,13,4); +warn "f2 : $f2"; +$template->param(index => $index, + f1 => $f1, + f3 => $f3, + "f2$f2" => $f2, + f4 => $f4); +print "Content-Type: text/html\n\n", $template->output; + + -- 2.39.2