From 5e44e797eb9e685339971f17f1b76291b3b32c38 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Jun 2005 13:15:46 +0000 Subject: [PATCH] synch'ing 2.2 and head --- acqui.simple/addbiblio.pl | 68 ++++++------- acqui.simple/isbnsearch.pl | 90 +++++------------ acqui/acqui-home.pl | 3 +- acqui/basket.pl | 28 +++++- acqui/histsearch.pl | 10 +- admin/checkmarc.pl | 40 ++++++++ admin/itemtypes.pl | 9 +- admin/marctagstructure.pl | 122 ++++++++++++++++++----- authorities/authorities-home.pl | 5 +- authorities/authorities.pl | 43 ++------ authorities/blinddetail-biblio-search.pl | 1 - authorities/detail.pl | 1 + bull/statecollection.pl | 14 ++- 13 files changed, 256 insertions(+), 178 deletions(-) diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl index ffbff9905d..4120717f8c 100755 --- a/acqui.simple/addbiblio.pl +++ b/acqui.simple/addbiblio.pl @@ -185,7 +185,7 @@ sub create_input () { unless (opendir(DIR, "$cgidir")) { $cgidir = C4::Context->intranetdir."/value_builder"; } - my $plugin=$cgidir."/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; + my $plugin=$cgidir."/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; require $plugin; my $extended_param = plugin_parameters($dbh,$rec,$tagslib,$i,$tabloop); my ($function_name,$javascript) = plugin_javascript($dbh,$rec,$tagslib,$i,$tabloop); @@ -340,14 +340,17 @@ my $op = $input->param('op'); my $frameworkcode = $input->param('frameworkcode'); my $dbh = C4::Context->dbh; my $bibid; + + if ($oldbiblionumber) { $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber); # find framework type - $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if $bibid; + $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode)); }else { $bibid = $input->param('bibid'); - $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if $bibid; + $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode)); } +$frameworkcode='' if ($frameworkcode eq 'Default'); my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "acqui.simple/addbiblio.tmpl", query => $input, @@ -357,6 +360,29 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); +#Getting the list of all frameworks +my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from biblio_framework"); +$queryfwk->execute; +my %select_fwk; +my @select_fwk; +my $curfwk; +push @select_fwk,"Default"; +$select_fwk{"Default"} = "Default"; +while (my ($description, $fwk) =$queryfwk->fetchrow) { + push @select_fwk, $fwk; + $select_fwk{$fwk} = $description; +} +$curfwk=$frameworkcode; +my $framework=CGI::scrolling_list( -name => 'Frameworks', + -id => 'Frameworks', + -default => $curfwk, + -OnChange => 'Changefwk(this);', + -values => \@select_fwk, + -labels => \%select_fwk, + -size => 1, + -multiple => 0 ); +$template->param( framework => $framework); + $tagslib = &MARCgettagslib($dbh,1,$frameworkcode); my $record=-1; my $encoding=""; @@ -400,6 +426,7 @@ if ($op eq "addbiblio") { my $oldbibnum; my $oldbibitemnum; if ($is_a_modif) { + NEWmodbiblioframework($dbh,$bibid,$frameworkcode); NEWmodbiblio($dbh,$record,$bibid,$frameworkcode); } else { ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record,$frameworkcode); @@ -434,41 +461,14 @@ if ($op eq "addbiblio") { # build indicator hash. my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); - splice(@tags,$addedfield,0,$tags[$addedfield]); - splice(@subfields,$addedfield,0,$subfields[$addedfield]); - splice(@values,$addedfield,0,$values[$addedfield]); - splice(@ind_tag,$addedfield,0,$ind_tag[$addedfield]); - my %indicators; - for (my $i=0;$i<=$#ind_tag;$i++) { - $indicators{$ind_tag[$i]} = $indicator[$i]; - } -# search the part of the array to duplicate. - my $start=0; - my $end=0; - my $started; - for (my $i=$#tags;$i>0;$i--) { - $end=$i if ($end eq 0 && $tags[$i] == $addedfield); - $start=$i if ($end>0 && $tags[$i] eq $addedfield); - last if ($end>0 && $tags[$i] ne $addedfield); - } - # add an empty line in all arrays. This forces a new field in MARC::Record. - splice(@tags,$end+1,0,''); - splice(@subfields,$end+1,0,''); - splice(@values,$end+1,0,''); - splice(@ind_tag,$end+1,0,''); - splice(@indicator,$end+1,0,''); -# then duplicate the field. - splice(@tags,$end+2,0,@tags[$start..$end]); - splice(@subfields,$end+2,0,@subfields[$start..$end]); - splice(@values,$end+2,0,@values[$start..$end]); - splice(@ind_tag,$end+2,0,@ind_tag[$start..$end]); - splice(@indicator,$end+2,0,@indicator[$start..$end]); - my %indicators; for (my $i=0;$i<=$#ind_tag;$i++) { $indicators{$ind_tag[$i]} = $indicator[$i]; } my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); + # adding an empty field + my $field = MARC::Field->new("$addedfield",'','','a'=> ""); + $record->append_fields($field); build_tabs ($template, $record, $dbh,$encoding); build_hidden_data; $template->param( @@ -495,7 +495,7 @@ if ($op eq "addbiblio") { $bibid = ""; $oldbiblionumber= ""; } - + build_tabs ($template, $record, $dbh,$encoding); build_hidden_data; $template->param( diff --git a/acqui.simple/isbnsearch.pl b/acqui.simple/isbnsearch.pl index 54619b1b62..10bac9bc19 100755 --- a/acqui.simple/isbnsearch.pl +++ b/acqui.simple/isbnsearch.pl @@ -124,73 +124,29 @@ my $dbh = C4::Context->dbh; push @field_data, { term => "value", val=>$value[$i] }; } - if ( $count < ( $offset + $num ) ) { - $total = $count; - } - else { - $total = $offset + $num; - } # else - - my @loop_data = (); - my $toggle; - for ( my $i = $offset ; $i < $total ; $i++ ) { - if ( $i % 2 ) { - $toggle = 0; - } else { - $toggle = 1; - } - my %row_data; # get a fresh hash for the row data - $row_data{toggle} = $toggle; - $row_data{biblionumber} = $results[$i]->{'biblionumber'}; - $row_data{title} = $results[$i]->{'title'}; - $row_data{author} = $results[$i]->{'author'}; - $row_data{copyrightdate} = $results[$i]->{'copyrightdate'}; - $row_data{classification} = $results[$i]->{'classification'}; - $row_data{NOTMARC} = !$marc_p; - push ( @loop_data, \%row_data ); - } - $template->param( startfrom => $offset + 1 ); - ( $offset + $num <= $count ) - ? ( $template->param( endat => $offset + $num ) ) - : ( $template->param( endat => $count ) ); - $template->param( numrecords => $count ); - my $nextstartfrom = ( $offset + $num < $count ) ? ( $offset + $num ) : (-1); - my $prevstartfrom = ( $offset - $num >= 0 ) ? ( $offset - $num ) : (-1); - $template->param( nextstartfrom => $nextstartfrom ); - my $displaynext = 1; - my $displayprev = 0; - ( $nextstartfrom == -1 ) ? ( $displaynext = 0 ) : ( $displaynext = 1 ); - ( $prevstartfrom == -1 ) ? ( $displayprev = 0 ) : ( $displayprev = 1 ); - $template->param( displaynext => $displaynext ); - $template->param( displayprev => $displayprev ); - my @numbers = (); - my $term; - my $value; - - if ($isbn) { - $term = "isbn"; - $value = $isbn; - } - else { - $term = "title"; - $value = $title; - } - if ( $count > 10 ) { - for ( my $i = 1 ; $i < $count / 10 + 1 ; $i++ ) { - if ( $i < 16 ) { - my $highlight = 0; - ( $offset == ( $i - 1 ) * 10 ) && ( $highlight = 1 ); - push @numbers, - { - number => $i, - highlight => $highlight, - term => $term, - value => $value, - startfrom => ( $i - 1 ) * 10 - }; - } - } - } + my @numbers = (); + + if ($total>$resultsperpage) { + for (my $i=1; $i<$total/$resultsperpage+1; $i++) { + if ($i<16) { + my $highlight=0; + ($startfrom==($i-1)) && ($highlight=1); + push @numbers, { number => $i, + highlight => $highlight , + searchdata=> \@field_data, + startfrom => ($i-1)}; + } + } + } + my $from = $startfrom*$resultsperpage+1; + my $to; + + if($total < (($startfrom+1)*$resultsperpage)) + { + $to = $total; + } else { + $to = (($startfrom+1)*$resultsperpage); + } # fill with books in breeding farm my $toggle=0; diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index ba7666a1c3..30cc75fce4 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -63,6 +63,7 @@ $template->param(classlist => $classlist, suggestion => $suggestion, totspent => sprintf("%.2f",$totspent), totcomtd => sprintf("%.2f",$totcomtd), - totavail => sprintf("%.2f",$totavail)); + totavail => sprintf("%.2f",$totavail), + nobudget => $#results==-1?1:0); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/acqui/basket.pl b/acqui/basket.pl index 515abfdecc..fbec06e443 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -55,6 +55,8 @@ my $basket = getbasket($basketno); $booksellerid = $basket->{booksellerid} unless $booksellerid; my ($count2,@booksellers)=bookseller($booksellerid); +# get librarian branch... + # if new basket, pre-fill infos $basket->{creationdate} = "" unless ($basket->{creationdate}); $basket->{authorisedby} = $loggedinuser unless ($basket->{authorisedby}); @@ -65,25 +67,30 @@ my $sub_total; # total of line totals my $gist; # GST my $grand_total; # $subttotal + $gist +# my $line_total_est; # total of each line +my $sub_total_est; # total of line totals +my $gist_est; # GST +my $grand_total_est; # $subttotal + $gist + +my $qty_total; + my @books_loop; for (my $i=0;$i<$count;$i++){ my $rrp=$results[$i]->{'listprice'}; $rrp=curconvert($results[$i]->{'currency'},$rrp); + $sub_total_est+=$results[$i]->{'quantity'}*$results[$i]->{'rrp'}; $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'}; $sub_total+=$line_total; + $qty_total += $results[$i]->{'quantity'}; my %line; - if ($i % 2){ - $line{highlight}=1; - } else { - $line{highlight}=0; - } $line{ordernumber} = $results[$i]->{'ordernumber'}; $line{publishercode} = $results[$i]->{'publishercode'}; $line{isbn} = $results[$i]->{'isbn'}; $line{booksellerid} = $results[$i]->{'booksellerid'}; $line{basketno}=$basketno; $line{title} = $results[$i]->{'title'}; + $line{notes} = $results[$i]->{'notes'}; $line{author} = $results[$i]->{'author'}; $line{i} = $i; $line{rrp} = $results[$i]->{'rrp'}; @@ -93,11 +100,14 @@ for (my $i=0;$i<$count;$i++){ $line{line_total} = $line_total; $line{biblionumber} = $results[$i]->{'biblionumber'}; $line{bookfundid} = $results[$i]->{'bookfundid'}; + $line{odd} = $i %2; push @books_loop, \%line; } my $prefgist =C4::Context->preference("gist"); $gist=sprintf("%.2f",$sub_total*$prefgist); $grand_total=$sub_total+$gist; +$grand_total_est = $sub_total_est+sprintf("%.2f",$sub_total_est*$prefgist); +$gist_est = sprintf("%.2f",$sub_total_est*$prefgist); $template->param(basketno => $basketno, creationdate => $basket->{creationdate}, authorisedby => $basket->{authorisedby}, @@ -106,12 +116,20 @@ $template->param(basketno => $basketno, active => $booksellers[0]->{'active'}, booksellerid=> $booksellers[0]->{'id'}, name => $booksellers[0]->{'name'}, + address1 => $booksellers[0]->{'address1'}, + address2 => $booksellers[0]->{'address2'}, + address3 => $booksellers[0]->{'address3'}, + address4 => $booksellers[0]->{'address4'}, entrydate => format_date($results[0]->{'entrydate'}), books_loop => \@books_loop, count =>$count, sub_total => $sub_total, gist => $gist, grand_total =>$grand_total, + sub_total_est => $sub_total_est, + gist_est => $gist_est, + grand_total_est =>$grand_total_est, currency => $booksellers[0]->{'listprice'}, + qty_total => $qty_total, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 4bffebfbe1..baca8dc7b6 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -12,6 +12,8 @@ my $input = new CGI; my $title = $input->param('title'); my $author = $input->param('author'); my $name = $input->param('name'); +my $from_placed_on = $input->param('fromplacedon'); +my $to_placed_on = $input->param('toplacedon'); my $dbh = C4::Context->dbh; my ($template, $loggedinuser, $cookie) @@ -22,12 +24,12 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {acquisition => 1}, debug => 1, }); -my $order_loop= &histsearch($title,$author,$name); - -$template->param(numresults => scalar(@$order_loop), - suggestions_loop => $order_loop, +my $order_loop= &histsearch($title,$author,$name,$from_placed_on,$to_placed_on); +$template->param(suggestions_loop => $order_loop, title => $title, author => $author, name => $name, + from_placed_on =>$from_placed_on, + to_placed_on =>$to_placed_on ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/checkmarc.pl b/admin/checkmarc.pl index 82b5e062fe..2469f91d78 100755 --- a/admin/checkmarc.pl +++ b/admin/checkmarc.pl @@ -76,6 +76,7 @@ my $field; my $tagfield = $res; my $tab = $res2; my $subtotal=0; +warn "TAGF : $tagfield"; while (($res,$res2,$field) = $sth->fetchrow) { # (ignore itemnumber, that must be in -1 tab) if (($res ne $tagfield or $res2 ne $tab ) && $res2 ne -1) { @@ -96,6 +97,23 @@ if ($subtotal eq 0) { $template->param(itemfields => 1); $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\""); $sth->execute; @@ -145,5 +163,27 @@ unless ($res) { $total++; } +$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; diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 0bb7d74140..d4eb0c160f 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -176,10 +176,11 @@ if ($op eq 'add_form') { $toggle=0; } $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'}); + $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); } $template->param(loop => \@loop_data); diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 027875a915..030fe721fe 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -42,6 +42,7 @@ $searchfield=~ s/\,//g; my $offset=$input->param('offset'); my $op = $input->param('op'); +my $dspchoice = $input->param('select_display'); my $pagesize=20; my $script_name="/cgi-bin/koha/admin/marctagstructure.pl"; @@ -216,29 +217,102 @@ if ($op eq 'add_form') { if ($searchfield ne '') { $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&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{toggle} = $toggle; - push(@loop_data, \%row_data); + 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&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode; + $row_data{delete} = "$script_name?op=delete_confirm&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&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; + $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; + $row_data{toggle} = $toggle; + push(@loop_data, \%row_data); + } + $template->param(loop => \@loop_data); } - $template->param(loop => \@loop_data); if ($offset>0) { my $prevpage = $offset-$pagesize; $template->param(isprevpage => $offset, @@ -246,9 +320,9 @@ if ($op eq 'add_form') { searchfield => $searchfield, script_name => $script_name, frameworkcode => $frameworkcode, - ); + ); } - if ($offset+$pagesize<$count) { + if ($offset+$pagesize<$cnt) { my $nextpage =$offset+$pagesize; $template->param(nextpage =>$nextpage, searchfield => $searchfield, diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index 17a424a1e6..ec88223126 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -87,10 +87,11 @@ if ($op eq "do_search") { my @field_data = (); - + # we must get parameters once again. Because if there is a mainentry, it has been replaced by something else during the search, thus the links next/previous would not work anymore + my @marclist_ini = $query->param('marclist'); for(my $i = 0 ; $i <= $#marclist ; $i++) { - push @field_data, { term => "marclist", val=>$marclist[$i] }; + push @field_data, { term => "marclist", val=>$marclist_ini[$i] }; push @field_data, { term => "and_or", val=>$and_or[$i] }; push @field_data, { term => "excluding", val=>$excluding[$i] }; push @field_data, { term => "operator", val=>$operator[$i] }; diff --git a/authorities/authorities.pl b/authorities/authorities.pl index a1eee443e6..40ce13e225 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -239,6 +239,7 @@ sub build_tabs ($$$$) { my %tag_data; $tag_data{tag} = $tag; $tag_data{tag_lib} = $tagslib->{$tag}->{lib}; + $tag_data{repeatable} = $tagslib->{$tag}->{repeatable}; $tag_data{indicator} = $indicator; $tag_data{subfield_loop} = \@subfields_data; push (@loop_data, \%tag_data); @@ -365,41 +366,14 @@ if ($op eq "add") { # build indicator hash. my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); - splice(@tags,$addedfield,0,$tags[$addedfield]); - splice(@subfields,$addedfield,0,$subfields[$addedfield]); - splice(@values,$addedfield,0,$values[$addedfield]); - splice(@ind_tag,$addedfield,0,$ind_tag[$addedfield]); my %indicators; for (my $i=0;$i<=$#ind_tag;$i++) { $indicators{$ind_tag[$i]} = $indicator[$i]; } -# search the part of the array to duplicate. - my $start=0; - my $end=0; - my $started; - for (my $i=0;$i<=$#tags;$i++) { - $start=$i if ($start eq 0 && $tags[$i] == $addedfield); - $end=$i if ($start>0 && $tags[$i] eq $addedfield); - last if ($start>0 && $tags[$i] ne $addedfield); - } -# add an empty line in all arrays. This forces a new field in MARC::Record. - splice(@tags,$end+1,0,''); - splice(@subfields,$end+1,0,''); - splice(@values,$end+1,0,''); - splice(@ind_tag,$end+1,0,''); - splice(@indicator,$end+1,0,''); -# then duplicate the field. - splice(@tags,$end+2,0,@tags[$start..$end]); - splice(@subfields,$end+2,0,@subfields[$start..$end]); - splice(@values,$end+2,0,@values[$start..$end]); - splice(@ind_tag,$end+2,0,@ind_tag[$start..$end]); - splice(@indicator,$end+2,0,@indicator[$start..$end]); + my $record = AUTHhtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); + my $field = MARC::Field->new("$addedfield",'','','a'=> ""); + $record->append_fields($field); - my %indicators; - for (my $i=0;$i<=$#ind_tag;$i++) { - $indicators{$ind_tag[$i]} = $indicator[$i]; - } - my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); build_tabs ($template, $record, $dbh,$encoding); build_hidden_data; $template->param( @@ -417,7 +391,8 @@ if ($op eq "add") { build_hidden_data; } -if ($authid) { +unless ($op) { +# warn "BUILDING"; build_tabs ($template, $record, $dbh,$encoding); build_hidden_data; } @@ -431,7 +406,7 @@ $template->param( authtypecode => $authtypecode, ); - my $authtypes = getauthtypes; +my $authtypes = getauthtypes; my @authtypesloop; foreach my $thisauthtype (keys %$authtypes) { my $selected = 1 if $thisauthtype eq $authtypecode; @@ -442,5 +417,7 @@ foreach my $thisauthtype (keys %$authtypes) { push @authtypesloop, \%row; } -$template->param(authtypesloop => \@authtypesloop); +$template->param(authtypesloop => \@authtypesloop, + authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 320e0cdda7..a87d09c9ef 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -79,7 +79,6 @@ my @loop_data =(); my $tag; my @loop_data =(); if ($authid) { -warn "report $authtypecode => ".$auth_type->{auth_tag_to_report}.$record->as_formatted; foreach my $field ($record->field($auth_type->{auth_tag_to_report})) { my @subfields_data; my @subf=$field->subfields; diff --git a/authorities/detail.pl b/authorities/detail.pl index f797d7c173..519c09d0f0 100755 --- a/authorities/detail.pl +++ b/authorities/detail.pl @@ -143,6 +143,7 @@ foreach my $thisauthtype (keys %$authtypes) { $template->param(authid => $authid, count => $count, biblio_fields => $biblio_fields, + authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, authtypesloop => \@authtypesloop); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/statecollection.pl b/bull/statecollection.pl index d82ed2271a..cb5f00e550 100755 --- a/bull/statecollection.pl +++ b/bull/statecollection.pl @@ -31,11 +31,19 @@ if ($op eq 'modsubscriptionhistory') { } # change status except, if subscription has expired, for the "waited" issue. if ($op eq 'serialchangestatus') { - my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?"); + my $sth = $dbh->prepare("select status from serial where serialid=?"); for (my $i=0;$i<=$#serialids;$i++) { $sth->execute($serialids[$i]); - my ($x,$oldstatus) = $sth->fetchrow; - serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i]) unless ($hassubscriptionexpired && $oldstatus == 1); + my ($oldstatus) = $sth->fetchrow; + if ($serialids[$i]) { + serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i]) unless ($hassubscriptionexpired && $oldstatus == 1); + } else { + # add a special issue + if ($serialseqs[$i]) { + my $subscription=getsubscription($subscriptionid); + newissue($serialseqs[$i],$subscriptionid,$subscription->{biblionumber},$status[$i], format_date_in_iso($planneddates[$i])); + } + } } } my $subs = &getsubscription($subscriptionid); -- 2.39.5