$res->{$tag}->{mandatory}=$mandatory;
}
- $sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso from marc_subfield_structure where itemtype=? order by tagfield,tagsubfield");
+ $sth=$dbh->prepare("select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,thesaurus_category,value_builder,kohafield,seealso,hidden,isurl from marc_subfield_structure where itemtype=? order by tagfield,tagsubfield");
$sth->execute($itemtype);
my $subfield;
my $value_builder;
my $kohafield;
my $seealso;
- while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value,$thesaurus_category,$value_builder,$kohafield,$seealso) = $sth->fetchrow) {
+ my $hidden;
+ my $isurl;
+ while ( ($tag, $subfield, $lib, $tab, $mandatory, $repeatable,$authorised_value,$thesaurus_category,$value_builder,$kohafield,$seealso,$hidden,$isurl) = $sth->fetchrow) {
$res->{$tag}->{$subfield}->{lib}=$lib;
$res->{$tag}->{$subfield}->{tab}=$tab;
$res->{$tag}->{$subfield}->{mandatory}=$mandatory;
$res->{$tag}->{$subfield}->{value_builder}=$value_builder;
$res->{$tag}->{$subfield}->{kohafield}=$kohafield;
$res->{$tag}->{$subfield}->{seealso}=$seealso;
+ $res->{$tag}->{$subfield}->{hidden}=$hidden;
+ $res->{$tag}->{$subfield}->{isurl}=$isurl;
}
return $res;
}
# $Id$
# $Log$
+# Revision 1.90 2004/05/28 08:25:53 tipaul
+# hidding hidden & isurl constraints into MARC subfield structure
+#
# Revision 1.89 2004/05/27 21:47:21 rangi
# Fix for bug 787
#
# we have bibid list. Now, loads title and author from [offset] to [offset]+[length]
my $counter = $offset;
- $sth = $dbh->prepare("SELECT biblio.biblionumber,author, title, items.holdingbranch, items.itemcallnumber, bibid
- FROM biblio, marc_biblio left join items on items.biblionumber = biblio.biblionumber
+ $sth = $dbh->prepare("SELECT biblio.*, biblioitems.*, items.*
+ FROM biblio, marc_biblio
+ LEFT JOIN items on items.biblionumber = biblio.biblionumber
+ LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
WHERE biblio.biblionumber = marc_biblio.biblionumber AND bibid = ?
GROUP BY items.biblionumber, items.holdingbranch, items.itemcallnumber");
my @finalresult = ();
my @CNresults=();
my $oldbiblionumber=0;
my $totalitems=0;
- my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid);
+ my $oldline;
+# my ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid);
my ($oldbibid, $oldauthor, $oldtitle,$oldbiblionumber);
while (($counter <= $#result) && ($counter <= ($offset + $length))) {
$sth->execute($result[$counter]);
- while (($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid) = $sth->fetchrow) {
-# warn "bibid : $oldbiblionumber ($biblionumber,$author,$title,$holdingbranch, $itemcallnumber, $bibid)";
+ while (my $line = $sth->fetchrow_hashref) {
# parse the result, putting holdingbranch & itemcallnumber in separate array
- # then author, title & 1st array in main array
- if ($oldbiblionumber && ($oldbiblionumber ne $biblionumber)) {
- my %line;
- $line{bibid}=$oldbibid;
- $line{author}=$oldauthor;
- $line{title}=$oldtitle;
- $line{totitem} = $totalitems;
- $line{biblionumber} = $oldbiblionumber;
+ # then all other fields in the main array
+ if ($oldbiblionumber && ($oldbiblionumber ne $line->{biblionumber})) {
+ my %newline;
+ %newline = %$oldline;
+ $newline{totitem} = $totalitems;
+ $newline{biblionumber} = $oldbiblionumber;
my @CNresults2= @CNresults;
- $line{CN} = \@CNresults2;
+ $newline{CN} = \@CNresults2;
+ $newline{'even'} = 1 if $counter % 2 == 0;
+ $newline{'odd'} = 1 if $counter % 2 == 1;
@CNresults = ();
- push @finalresult, \%line;
+ push @finalresult, \%newline;
$totalitems=0;
}
- $oldbibid = $bibid;
- $oldauthor = $author;
- $oldtitle = $title;
- $oldbiblionumber = $biblionumber;
- $totalitems++ if ($holdingbranch);
+ $oldbiblionumber = $line->{biblionumber};
+ $totalitems++ if ($line->{holdingbranch});
+ $oldline = $line;
+ # item callnumber & branch
my %lineCN;
- $lineCN{holdingbranch} = $holdingbranch;
- $lineCN{itemcallnumber} = $itemcallnumber;
+ $lineCN{holdingbranch} = $line->{holdingbranch};
+ $lineCN{itemcallnumber} = $line->{itemcallnumber};
push @CNresults,\%lineCN;
}
$counter++;
}
# add the last line, that is not reached byt the loop / if ($oldbiblionumber...)
- my %line;
- $line{bibid}=$oldbibid;
- $line{author}=$oldauthor;
- $line{title}=$oldtitle;
- $line{totitem} = $totalitems;
- $line{biblionumber} = $oldbiblionumber;
+ my %newline;
+ %newline = %$oldline;
+ $newline{totitem} = $totalitems;
+ $newline{biblionumber} = $oldbiblionumber;
my @CNresults2= @CNresults;
- $line{CN} = \@CNresults2;
+ $newline{CN} = \@CNresults2;
+ $newline{'even'} = 1 if $counter % 2 == 0;
+ $newline{'odd'} = 1 if $counter % 2 == 1;
@CNresults = ();
- push @finalresult, \%line;
+ my @CNresults2= @CNresults;
+ $newline{CN} = \@CNresults2;
+ @CNresults = ();
+ push @finalresult, \%newline;
my $nbresults = $#result + 1;
return (\@finalresult, $nbresults);
}
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
- my $sth=$dbh->prepare("Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where (tagfield like ? and itemtype=?) order by tagfield");
+ my $sth=$dbh->prepare("Select * from marc_subfield_structure where (tagfield like ? and itemtype=?) order by tagfield");
$sth->execute("$searchstring%",$itemtype);
my @results;
my $cnt=0;
closedir DIR;
# build values list
- my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and itemtype=?"); # and tagsubfield='$tagsubfield'");
+ my $sth=$dbh->prepare("select * from marc_subfield_structure where tagfield=? and itemtype=?"); # and tagsubfield='$tagsubfield'");
$sth->execute($tagfield,$itemtype);
my @loop_data = ();
my $toggle="white";
);
$row_data{repeatable} = CGI::checkbox("repeatable$i",$data->{'repeatable'}?'checked':'',1,'');
$row_data{mandatory} = CGI::checkbox("mandatory$i",$data->{'mandatory'}?'checked':'',1,'');
+ $row_data{hidden} = CGI::checkbox("hidden$i",$data->{'hidden'}?'checked':'',1,'');
+ $row_data{isurl} = CGI::checkbox("isurl$i",$data->{'isurl'}?'checked':'',1,'');
$row_data{bgcolor} = $toggle;
push(@loop_data, \%row_data);
$i++;
$row_data{seealso} = "";
$row_data{repeatable} = CGI::checkbox('repeatable','',1,'');
$row_data{mandatory} = CGI::checkbox('mandatory','',1,'');
+ $row_data{hidden} = CGI::checkbox('hidden','',1,'');
+ $row_data{isurl} = CGI::checkbox('isurl','',1,'');
$row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
-values=> \@kohafields,
-default=> "",
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
- my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,itemtype)
- values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
+ my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,itemtype)
+ values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
my @liblibrarian = $input->param('liblibrarian');
my @libopac = $input->param('libopac');
my $authorised_value =$authorised_values[$i];
my $thesaurus_category =$thesaurus_category[$i];
my $value_builder=$value_builder[$i];
+ my $hidden = $input->param("hidden$i")?1:0;
+ my $isurl = $input->param("isurl$i")?1:0;
if ($liblibrarian) {
unless (C4::Context->config('demo') eq 1) {
$sth->execute ($tagfield,
$seealso,
$authorised_value,
$thesaurus_category,
- $value_builder,$itemtype);
+ $value_builder,
+ $hidden,
+ $isurl,
+ $itemtype,
+ );
}
}
}
# called by default form, used to confirm deletion of data in DB
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder from marc_subfield_structure where tagfield=? and tagsubfield=? and itemtype=?");
+ my $sth=$dbh->prepare("select * from marc_subfield_structure where tagfield=? and tagsubfield=? and itemtype=?");
$sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
$row_data{authorised_value} = $results->[$i]{'authorised_value'};
$row_data{thesaurus_category} = $results->[$i]{'thesaurus_category'};
$row_data{value_builder} = $results->[$i]{'value_builder'};
+ $row_data{hidden} = $results->[$i]{'hidden'};
+ $row_data{isurl} = $results->[$i]{'isurl'};
$row_data{delete} = "$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&itemtype=$itemtype";
$row_data{bgcolor} = $toggle;
+ if ($row_data{tab} eq -1) {
+ $row_data{subfield_ignored} = 1;
+ }
+
push(@loop_data, \%row_data);
}
$template->param(loop => \@loop_data);