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);
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,
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="";
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);
# 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(
$bibid = "";
$oldbiblionumber= "";
}
-
+
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
$template->param(
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;
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;
$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});
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'};
$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},
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;
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)
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;
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) {
$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;
$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;
$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);
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";
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,
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,
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] };
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);
# 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(
build_hidden_data;
}
-if ($authid) {
+unless ($op) {
+# warn "BUILDING";
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
}
authtypecode => $authtypecode,
);
- my $authtypes = getauthtypes;
+my $authtypes = getauthtypes;
my @authtypesloop;
foreach my $thisauthtype (keys %$authtypes) {
my $selected = 1 if $thisauthtype eq $authtypecode;
push @authtypesloop, \%row;
}
-$template->param(authtypesloop => \@authtypesloop);
+$template->param(authtypesloop => \@authtypesloop,
+ authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
+ );
output_html_with_http_headers $input, $cookie, $template->output;
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;
$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;
}
# 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);