[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.6,1.7 additem.pl,1.7,1.
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.6,1.7 additem.pl,1.7,1.8 |
Date: |
Tue, 19 Nov 2002 04:32:25 -0800 |
Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1:/tmp/cvs-serv30070/acqui.simple
Modified Files:
addbiblio.pl additem.pl
Log Message:
road to 1.3.2
Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbiblio.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** addbiblio.pl 12 Nov 2002 15:58:43 -0000 1.6
--- addbiblio.pl 19 Nov 2002 12:32:22 -0000 1.7
***************
*** 3,13 ****
# $Id$
- #
- # TODO
- #
- # Add info on biblioitems and items already entered as you enter new ones
- #
-
-
# Copyright 2000-2002 Katipo Communications
#
--- 3,6 ----
***************
*** 37,40 ****
--- 30,34 ----
sub find_value {
my ($tagfield,$insubfield,$record) = @_;
+ # warn "$tagfield / $insubfield // ";
my $result;
my $indicator;
***************
*** 70,80 ****
my $input = new CGI;
my $error = $input->param('error');
! my $oldbiblionumber=$input->param('bib'); # if bib exists, it's a modif, not
a new biblio.
my $isbn = $input->param('isbn');
my $op = $input->param('op');
my $dbh = C4::Context->dbh;
my $bibid;
! if ($oldbiblionumber) {;
! $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber)
}else {
$bibid = $input->param('bibid');
--- 64,74 ----
my $input = new CGI;
my $error = $input->param('error');
! my $oldbiblionumber=$input->param('oldbiblionumber'); # if bib exists, it's a
modif, not a new biblio.
my $isbn = $input->param('isbn');
my $op = $input->param('op');
my $dbh = C4::Context->dbh;
my $bibid;
! if ($oldbiblionumber) {
! $bibid =
&MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber);
}else {
$bibid = $input->param('bibid');
***************
*** 83,90 ****
my $tagslib = &MARCgettagslib($dbh,1);
!
! my $record = MARCgetbiblio($dbh,$bibid) if ($oldbiblionumber);
! my $record = MARCfindbreeding($dbh,$isbn) if ($isbn);
!
#------------------------------------------------------------------------------------------------------------------------------
if ($op eq "addbiblio") {
--- 77,87 ----
my $tagslib = &MARCgettagslib($dbh,1);
! my $record;
! $record = MARCgetbiblio($dbh,$bibid) if ($bibid);
! $record = MARCfindbreeding($dbh,$isbn) if ($isbn);
! my $is_a_modif=0;
! if ($bibid) {
! $is_a_modif=1;
! }
#------------------------------------------------------------------------------------------------------------------------------
if ($op eq "addbiblio") {
***************
*** 102,234 ****
}
my $record =
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%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;
! foreach my $tag (keys %{$tagslib}) {
! my $previous_tag = '';
! # loop through each subfield
! foreach my $subfield (keys %{$tagslib->{$tag}}) {
! next if ($subfield eq 'lib');
! next if ($subfield eq 'tab');
! next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne
"10");
! $i++;
! my %subfield_data;
! $subfield_data{tag}=$tag;
! $subfield_data{subfield}=$subfield;
!
$subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
!
$subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
!
$subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
! 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=> address@hidden,
!
-size=>1,
!
-multiple=>0,
!
);
! } elsif
($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! $subfield_data{marc_value}="<input
type=\"text\" name=\"field_value\" DISABLE READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
! } else {
! $subfield_data{marc_value}="<input
type=\"text\" name=\"field_value\">";
! }
! push(@loop_data, \%subfield_data);
! }
! }
! $template = gettemplate("acqui.simple/addbiblio2.tmpl");
! $template->param(bibid => $bibid,
! item => address@hidden);
!
#------------------------------------------------------------------------------------------------------------------------------
! } elsif ($op eq "additem") {
!
#------------------------------------------------------------------------------------------------------------------------------
! 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,address@hidden,address@hidden,address@hidden,%indicators);
! my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid);
! # now, build existiing item list
! my $temp = MARCgetbiblio($dbh,$bibid);
! my @fields = $temp->fields();
! my %witness; #---- stores the list of subfields used at least once,
with the "meaning" of the code
! my @big_array;
! foreach my $field (@fields) {
! my @subf=$field->subfields;
! my %this_row;
! # loop through each subfield
! for my $i (0..$#subf) {
! next if
($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10);
! $witness{$subf[$i][0]} =
$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
! $this_row{$subf[$i][0]} =$subf[$i][1];
! }
! if (%this_row) {
! push(@big_array, \%this_row);
! }
! }
! #fill big_row with missing datas
! foreach my $subfield_code (keys(%witness)) {
! for (my $i=0;$i<=$#big_array;$i++) {
! $big_array[$i]{$subfield_code}=" " unless
($big_array[$i]{$subfield_code});
! }
! }
! # now, construct template !
! my @item_value_loop;
! my @header_value_loop;
! for (my $i=0;$i<=$#big_array; $i++) {
! my $items_data;
! foreach my $subfield_code (keys(%witness)) {
! $items_data
.="<td>".$big_array[$i]{$subfield_code}."</td>";
! }
! my %row_data;
! $row_data{item_value} = $items_data;
! push(@item_value_loop,\%row_data);
! }
! foreach my $subfield_code (keys(%witness)) {
! my %header_value;
! $header_value{header_value} = $witness{$subfield_code};
! push(@header_value_loop, \%header_value);
! }
!
! # next item form
! my @loop_data =();
! my $i=0;
! foreach my $tag (keys %{$tagslib}) {
! my $previous_tag = '';
! # loop through each subfield
! foreach my $subfield (keys %{$tagslib->{$tag}}) {
! next if ($subfield eq 'lib');
! next if ($subfield eq 'tab');
! next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne
"10");
! my %subfield_data;
! $subfield_data{tag}=$tag;
! $subfield_data{subfield}=$subfield;
!
$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}="<input type=\"text\"
name=\"field_value\">";
! push(@loop_data, \%subfield_data);
! $i++
! }
! }
! $template = gettemplate("acqui.simple/addbiblio2.tmpl");
! $template->param(item_loop => address@hidden,
! item_header_loop =>
address@hidden,
! bibid => $bibid,
! item => address@hidden);
#------------------------------------------------------------------------------------------------------------------------------
} else {
--- 99,113 ----
}
my $record =
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
# MARC::Record builded => now, record in DB
! my $oldbibnum;
! my $oldbibitemnum;
! if ($is_a_modif) {
! ($bibid,$oldbibnum,$oldbibitemnum) =
NEWmodbiblio($dbh,$record,$bibid);
! } else {
! ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record);
! }
! # now, redirect to additem page
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=additem.pl?bibid=$bibid\"></html>";
! exit;
#------------------------------------------------------------------------------------------------------------------------------
} else {
***************
*** 244,253 ****
# my @fields = $record->fields();
my @loop_data =();
! foreach my $tag (keys %{$tagslib}) {
my $previous_tag = '';
my @subfields_data;
my $indicator;
# loop through each subfield
! foreach my $subfield (keys %{$tagslib->{$tag}}) {
next if ($subfield eq 'lib'); # skip lib and
tabs, which are koha internal
next if ($subfield eq 'tab');
--- 123,132 ----
# my @fields = $record->fields();
my @loop_data =();
! foreach my $tag (sort(keys (%{$tagslib}))) {
my $previous_tag = '';
my @subfields_data;
my $indicator;
# loop through each subfield
! foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
next if ($subfield eq 'lib'); # skip lib and
tabs, which are koha internal
next if ($subfield eq 'tab');
***************
*** 264,272 ****
$indicator = $x if $x;
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',
--- 143,172 ----
$indicator = $x if $x;
if
($tagslib->{$tag}->{$subfield}->{authorised_value}) {
my @authorised_values;
! # builds list, depending on
authorised value...
! #---- branch
! warn "==>
$tagslib->{$tag}->{$subfield}->{mandatory} /
".$tagslib->{$tag}->{$subfield}->{'authorised_value'};
! if
($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
! my
$sth=$dbh->prepare("select branchcode,branchname from branches");
! $sth->execute;
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my
($branchcode,$branchname) = $sth->fetchrow_array) {
! push
@authorised_values, $branchcode;
! }
! #----- itemtypes
! } elsif
($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
! my
$sth=$dbh->prepare("select itemtype,description from itemtypes");
! $sth->execute;
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my
($itemtype,$description) = $sth->fetchrow_array) {
! push
@authorised_values, $itemtype;
! }
! #---- "true" authorised value
! } else {
!
$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while ((my $value) =
$authorised_values_sth->fetchrow_array) {
! push
@authorised_values, $value;
! }
}
$subfield_data{marc_value}=
CGI::scrolling_list(-name=>'field_value',
***************
*** 277,306 ****
);
} elsif
($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" DISABLE
READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
! } elsif
($tagslib->{$tag}->{$subfield}->{value_builder}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" DISABLE
READONLY> <a
href=\"javascript:Dopop('../value_builder/$tagslib->{$tag}->{$subfield}->{value_builder}?index=$i',$i)\">...</a>";
} else {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"
value=\"$value\">";
}
# if breeding is empty
} else {
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=> address@hidden,
-size=>1,
-multiple=>0,
);
} elsif
($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" DISABLE
READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
! } elsif
($tagslib->{$tag}->{$subfield}->{value_builder}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" DISABLE
READONLY> <a
href=\"javascript:Dopop('../value_builder/$tagslib->{$tag}->{$subfield}->{value_builder}?index=$i',$i)\">...</a>";
} else {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">";
}
}
--- 177,236 ----
);
} elsif
($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=47
maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
#"
! } elsif
($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
! my
$plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
! require $plugin;
! my $extended_param =
plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=47
maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
} else {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"
value=\"$value\" size=50 maxlength=255>";
}
# if breeding is empty
} else {
+ my ($x,$value);
+ ($x,$value) =
find_value($tag,$subfield,$record) if ($record);
if
($tagslib->{$tag}->{$subfield}->{authorised_value}) {
my @authorised_values;
! # builds list, depending on
authorised value...
! #---- branch
! warn "==>
$tagslib->{$tag}->{$subfield}->{mandatory} /
".$tagslib->{$tag}->{$subfield}->{'authorised_value'};
! if
($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
! my
$sth=$dbh->prepare("select branchcode,branchname from branches");
! $sth->execute;
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my
($branchcode,$branchname) = $sth->fetchrow_array) {
! push
@authorised_values, $branchcode;
! }
! #----- itemtypes
! } elsif
($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
! my
$sth=$dbh->prepare("select itemtype,description from itemtypes");
! $sth->execute;
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my
($itemtype,$description) = $sth->fetchrow_array) {
! push
@authorised_values, $itemtype;
! }
! #---- "true" authorised value
! } else {
!
$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
! push
@authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
! while ((my $value) =
$authorised_values_sth->fetchrow_array) {
! push
@authorised_values, $value;
! }
}
$subfield_data{marc_value}=
CGI::scrolling_list(-name=>'field_value',
-values=> address@hidden,
+
-default=>"$value",
-size=>1,
-multiple=>0,
);
} elsif
($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=47
maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
! } elsif
($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
! my
$plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
! require $plugin;
! my $extended_param =
plugin_parameters($dbh,$record,$tagslib,$i,$tabloop);
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=47
maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
} else {
!
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=50
maxlength=255>>";
}
}
***************
*** 339,343 ****
}
$template->param(
! biblionumber =>
$oldbiblionumber,
bibid => $bibid);
}
--- 269,273 ----
}
$template->param(
! oldbiblionumber =>
$oldbiblionumber,
bibid => $bibid);
}
Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** additem.pl 13 Oct 2002 07:39:07 -0000 1.7
--- additem.pl 19 Nov 2002 12:32:23 -0000 1.8
***************
*** 22,313 ****
use CGI;
use strict;
- use C4::Catalogue;
- use C4::Biblio;
use C4::Output;
!
my $input = new CGI;
! my $biblionumber = $input->param('biblionumber');
! my $error = $input->param('error');
! my $maxbarcode;
! my $isbn;
! my $bibliocount;
! my @biblios;
! my $biblioitemcount;
! my @biblioitems;
! my $branchcount;
! my @branches;
! my %branchnames;
! my $itemcount;
! my @items;
! my $itemtypecount;
! my @itemtypes;
! my %itemtypedescriptions;
!
! if (! $biblionumber) {
! print $input->redirect('addbooks.pl');
! } else {
!
! ($bibliocount, @biblios) = &getbiblio($biblionumber);
!
! if (! $bibliocount) {
! print $input->redirect('addbooks.pl');
! } else {
!
! ($biblioitemcount, @biblioitems) =
&getbiblioitembybiblionumber($biblionumber);
! ($branchcount, @branches) = &branches;
! ($itemtypecount, @itemtypes) = &getitemtypes;
!
! for (my $i = 0; $i < $itemtypecount; $i++) {
! $itemtypedescriptions{$itemtypes[$i]->{'itemtype'}} =
$itemtypes[$i]->{'description'};
! } # for
!
! for (my $i = 0; $i < $branchcount; $i++) {
! $branchnames{$branches[$i]->{'branchcode'}} =
$branches[$i]->{'branchname'};
! } # for
!
! print $input->header;
! print startpage();
! print startmenu('acquisitions');
!
! print << "EOF";
! <font size="6"><em>$biblios[0]->{'title'}</em></font>
! <p>
! EOF
!
! if ($error eq "nobarcode") {
! print << "EOF";
! <font size="5" color="red">You must give the item a barcode</font>
! <p>
! EOF
! } elsif ($error eq "nobiblioitem") {
! print << "EOF";
! <font size="5" color="red">You must create a new group for your item to be
added to</font>
! <p>
! EOF
! } elsif ($error eq "barcodeinuse") {
! print << "EOF";
! <font size="5" color="red">Sorry, that barcode is already in use</font>
! <p>
! EOF
! } # elsif
! print << "EOF";
! <table align="left" cellpadding="5" cellspacing="0" border="1" width="220">
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif"><b>BIBLIO RECORD
$biblionumber</b></td>
! </tr>
! <tr valign="top">
! <td><b>Author:</b> $biblios[0]->{'author'}<br>
! <b>Copyright:</b> $biblios[0]->{'copyrightdate'}<br>
! <b>Series Title:</b> $biblios[0]->{'seriestitle'}<br>
! <b>Notes:</b> $biblios[0]->{'notes'}</td>
! </tr>
! EOF
!
! for (my $i = 0; $i < $biblioitemcount; $i++) {
! if ($biblioitems[$i]->{'itemtype'} eq "WEB") {
!
! print << "EOF";
! <tr valign="top" bgcolor="#CCCC99">
! <td
background="/images/background-mem.gif"><b>$biblioitems[$i]->{'biblioitemnumber'}
GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</b></td>
! </tr>
! <tr valign="top">
! <td><b>URL:</b> $biblioitems[$i]->{'url'}<br>
! <b>Date:</b> $biblioitems[$i]->{'publicationyear'}<br>
! <b>Notes:</b> $biblioitems[$i]->{'notes'}</td>
! </tr>
! EOF
!
! } else {
! $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
! $biblioitems[$i]->{'dewey'} = $1;
!
! print << "EOF";
! <tr valign="top" bgcolor="#CCCC99">
! <td
background="/images/background-mem.gif"><b>$biblioitems[$i]->{'biblioitemnumber'}
GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</b></td>
! </tr>
! <tr valign="top">
! <td><b>ISBN:</b> $biblioitems[$i]->{'isbn'}<br>
! <b>Dewey:</b> $biblioitems[$i]->{'dewey'}<br>
! <b>Publisher:</b> $biblioitems[$i]->{'publishercode'}<br>
! <b>Place:</b> $biblioitems[$i]->{'place'}<br>
! <b>Date:</b> $biblioitems[$i]->{'publicationyear'}</td>
! </tr>
! EOF
!
! ($itemcount, @items) =
&getitemsbybiblioitem($biblioitems[$i]->{'biblioitemnumber'});
!
! for (my $j = 0; $j < $itemcount; $j++) {
! print << "EOF";
! <tr valign="top" bgcolor="#FFFFCC">
! <td><b>Item:</b> $items[$j]->{'barcode'}<br>
! <b>Home Branch:</b> $branchnames{$items[$j]->{'homebranch'}}<br>
! <b>Notes:</b> $items[$j]->{'itemnotes'}</td>
! </tr>
! EOF
! } # for
! } # else
! } # for
!
! print << "EOF";
! </table>
! <img src="/images/holder.gif" width="16" height="650" align="left">
!
! <center>
!
! <form action="saveitem.pl" method="post">
! <input type="hidden" name="biblionumber" value="$biblionumber">
! <table border="1" cellspacing="0" cellpadding="5">
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif" colspan="2"><b>ADD NEW
ITEM:</b><br>
! <small><i>For a website add the group only</i></small></td>
! </tr>
! <tr valign="top">
! <td>Item Barcode:</td>
! <td><input type="text" name="barcode" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Branch:</td>
! <td><select name="homebranch">
! EOF
!
! for (my $i = 0; $i < $branchcount; $i++) {
! print << "EOF";
! <option
value="$branches[$i]->{'branchcode'}">$branches[$i]->{'branchname'}</option>
! EOF
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td>Replacement Price:</td>
! <td><input type="text" name="replacementprice" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Notes:</td>
! <td><textarea name="itemnotes" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top" bgcolor="#CCCC99">
! <td colspan="2" background="/images/background-mem.gif"><b>Add to existing
group:</b></td>
! </tr>
! <tr valign="top">
! <td>Group:</td>
! <td><select name="biblioitemnumber">
! EOF
!
! for (my $i = 0; $i < $biblioitemcount; $i++) {
! if ($biblioitems[$i]->{'itemtype'} ne "WEB") {
! print << "EOF";
! <option
value="$biblioitems[$i]->{'biblioitemnumber'}">$itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</option>
! EOF
! } # if
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td colspan="2" align="center"><input type="submit" name="existinggroup"
value="Add New Item to Existing Group"></td>
! </tr>
! <tr valign="top" bgcolor="#CCCC99">
! <td colspan="2" background="/images/background-mem.gif"><b>OR Add to a new
Group:</b></td>
! </tr>
! <tr valign="top">
! <td>Format:</td>
! <td><select name="itemtype">
! EOF
!
! for (my $i = 0; $i < $itemtypecount; $i++) {
! print << "EOF";
! <option
value="$itemtypes[$i]->{'itemtype'}">$itemtypes[$i]->{'description'}</option>
! EOF
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td>ISBN:</td>
! <td><input name="isbn" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Publisher:</td>
! <td><input name="publishercode" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Publication Year:</td>
! <td><input name="publicationyear" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Place of Publication:</td>
! <td><input name="place" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Illustrator:</td>
! <td><INPUT name="illus" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Additional Authors:<br><i>One Author per line</i></td>
! <td><textarea name="additionalauthors" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td>Subject Headings:<br><i>One Subject per line</i></td>
! <td><textarea name="subjectheadings" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td>Website URL:</td>
! <td><INPUT name="url" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Dewey:</td>
! <td><INPUT name="dewey" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Dewey Subclass:</td>
! <td><input name="subclass" size="40"></td>
! </tr>
! <tr valign="top">
! <td>ISSN:</td>
! <td><input name="issn" size="40"></td>
! </tr>
! <tr valign="top">
! <td>LCCN:</td>
! <td><input name="lccn" size="40"</td>
! </tr>
! <tr valign="top">
! <td>Volume:</td>
! <td><input name="volume" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Number:</td>
! <td><input name="number" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Volume Description:</td>
! <td><input name="volumeddesc" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Pages:</td>
! <td><input name="pages" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Size:</td>
! <td><input name="size" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Notes:</td>
! <td><textarea name="notes" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td colspan="2" align="center"><input type="submit" name="newgroup"
value="Add New Item to New Group"></td>
! </tr>
! </table>
!
! </form>
! </center>
! EOF
!
! print endmenu('acquisitions');
! print endpage();
! } # if
! } # if
--- 22,231 ----
use CGI;
use strict;
use C4::Output;
! use C4::Biblio;
! use C4::Context;
! use HTML::Template;
! use MARC::File::USMARC;
!
! sub find_value {
! my ($tagfield,$insubfield,$record) = @_;
! # warn "$tagfield / $insubfield // ";
! my $result;
! my $indicator;
! foreach my $field ($record->field($tagfield)) {
! my @subfields = $field->subfields();
! foreach my $subfield (@subfields) {
! if (@$subfield[0] eq $insubfield) {
! $result .= @$subfield[1];
! $indicator =
$field->indicator(1).$field->indicator(2);
! }
! }
! }
! return($indicator,$result);
! }
my $input = new CGI;
! my $error = $input->param('error');
! my $bibid = $input->param('bibid');
! my $op = $input->param('op');
! my $dbh = C4::Context->dbh;
! my $itemnum = $input->param('itemnum');
!
! my $tagslib = &MARCgettagslib($dbh,1);
! my $record = MARCgetbiblio($dbh,$bibid);
! my $itemrecord;
! my $nextop="additem";
!
#------------------------------------------------------------------------------------------------------------------------------
! if ($op eq "additem") {
!
#------------------------------------------------------------------------------------------------------------------------------
! # rebuild
! 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,address@hidden,address@hidden,address@hidden,%indicators);
! # MARC::Record builded => now, record in DB
! my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid);
! $nextop = "additem";
!
#------------------------------------------------------------------------------------------------------------------------------
! } elsif ($op eq "edititem") {
!
#------------------------------------------------------------------------------------------------------------------------------
! # retrieve item if exist => then, it's a modif
! $itemrecord = MARCgetitem($dbh,$bibid,$itemnum);
! $nextop="saveitem";
!
#------------------------------------------------------------------------------------------------------------------------------
! } elsif ($op eq "saveitem") {
!
#------------------------------------------------------------------------------------------------------------------------------
! # rebuild
! 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,address@hidden,address@hidden,address@hidden,%indicators);
! # MARC::Record builded => now, record in DB
! my ($bibid,$oldbibnum,$oldbibitemnum) =
NEWmoditem($dbh,$record,$bibid,$itemnum,0);
! $nextop="additem";
! }
!
! #
!
#------------------------------------------------------------------------------------------------------------------------------
! # build screen with existing items. and "new" one
!
#------------------------------------------------------------------------------------------------------------------------------
!
! my %indicators;
! $indicators{995}=' ';
! # now, build existiing item list
! my $temp = MARCgetbiblio($dbh,$bibid);
! my @fields = $temp->fields();
! my %witness; #---- stores the list of subfields used at least once, with the
"meaning" of the code
! my @big_array;
! #---- finds where items.itemnumber is stored
! my ($itemtagfield,$itemtagsubfield) =
&MARCfind_marc_from_kohafield($dbh,"items.itemnumber");
! my @itemnums; # array to store itemnums
! foreach my $field (@fields) {
! my @subf=$field->subfields;
! my %this_row;
! # loop through each subfield
! for my $i (0..$#subf) {
! next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne
10 && ($field->tag() ne $itemtagfield && $subf[$i][0] ne $itemtagsubfield));
! $witness{$subf[$i][0]} =
$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if
($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10);
! $this_row{$subf[$i][0]} =$subf[$i][1] if
($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10);
! push @itemnums,$this_row{$subf[$i][0]} =$subf[$i][1] if
($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield);
! }
! if (%this_row) {
! push(@big_array, \%this_row);
! }
! }
! #fill big_row with missing datas
! foreach my $subfield_code (keys(%witness)) {
! for (my $i=0;$i<=$#big_array;$i++) {
! $big_array[$i]{$subfield_code}=" " unless
($big_array[$i]{$subfield_code});
! }
! }
! # now, construct template !
! my @item_value_loop;
! my @header_value_loop;
! for (my $i=0;$i<=$#big_array; $i++) {
! my $items_data;
! foreach my $subfield_code (sort keys(%witness)) {
! $items_data .="<td>".$big_array[$i]{$subfield_code}."</td>";
! }
! my %row_data;
! $row_data{item_value} = $items_data;
! $row_data{itemnum} = $itemnums[$i];
! push(@item_value_loop,\%row_data);
! }
! foreach my $subfield_code (sort keys(%witness)) {
! my %header_value;
! $header_value{header_value} = $witness{$subfield_code};
! push(@header_value_loop, \%header_value);
! }
!
! # next item form
! my @loop_data =();
! my $i=0;
! my $authorised_values_sth = $dbh->prepare("select authorised_value from
authorised_values where category=?");
!
! foreach my $tag (sort keys %{$tagslib}) {
! my $previous_tag = '';
! # loop through each subfield
! foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
! next if ($subfield eq 'lib');
! next if ($subfield eq 'tab');
! next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
! my %subfield_data;
! $subfield_data{tag}=$tag;
! $subfield_data{subfield}=$subfield;
! $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
!
$subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
!
$subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
! my ($x,$value);
! ($x,$value) = find_value($tag,$subfield,$itemrecord) if
($itemrecord);
! if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
! my @authorised_values;
! # builds list, depending on authorised value...
! #---- branch
! if ($tagslib->{$tag}->{$subfield}->{'authorised_value'}
eq "branches" ) {
! my $sth=$dbh->prepare("select
branchcode,branchname from branches");
! $sth->execute;
! push @authorised_values, "" unless
($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my ($branchcode,$branchname) =
$sth->fetchrow_array) {
! push @authorised_values, $branchcode;
! }
! #----- itemtypes
! } elsif
($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
! my $sth=$dbh->prepare("select
itemtype,description from itemtypes");
! $sth->execute;
! push @authorised_values, "" unless
($tagslib->{$tag}->{$subfield}->{mandatory});
! while (my ($itemtype,$description) =
$sth->fetchrow_array) {
! push @authorised_values, $itemtype;
! }
! #---- "true" authorised value
! } else {
!
$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
! push @authorised_values, "" unless
($tagslib->{$tag}->{$subfield}->{mandatory});
! while ((my $value) =
$authorised_values_sth->fetchrow_array) {
! push @authorised_values, $value;
! }
! }
! $subfield_data{marc_value}=
CGI::scrolling_list(-name=>'field_value',
!
-values=>
address@hidden,
!
-default=>"$value",
!
-size=>1,
!
-multiple=>0,
!
);
! } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
! $subfield_data{marc_value}="<input type=\"text\"
name=\"field_value\" size=47 maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
! } elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
! my
$plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
! require $plugin;
! my $extended_param =
plugin_parameters($dbh,$record,$tagslib,$i,0);
! $subfield_data{marc_value}="<input type=\"text\"
name=\"field_value\" size=47 maxlength=255 DISABLE READONLY> <a
href=\"javascript:Dopop('../plugin_launcher.pl?plugin_name=$tagslib->{$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">...</a>";
! } else {
! $subfield_data{marc_value}="<input type=\"text\"
name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
! }
! # $subfield_data{marc_value}="<input type=\"text\"
name=\"field_value\">";
! push(@loop_data, \%subfield_data);
! $i++
! }
! }
! my $template = gettemplate("acqui.simple/additem.tmpl");
! # what's the next op ? it's what we are not in : an add if we're editing,
otherwise, and edit.
! $template->param(item_loop => address@hidden,
! item_header_loop =>
address@hidden,
! bibid => $bibid,
! item => address@hidden,
! itemnum => $itemnum,
! op => $nextop);
! print "Content-Type: text/html\n\n", $template->output;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.6,1.7 additem.pl,1.7,1.8,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha detail.pl,1.16,1.17 MARCdetail.pl,1.6,1.7 request.pl,1.17,1.18 search.pl,1.22,1.23
- Next by Date:
[Koha-cvs] CVS: koha/admin authorised_values.pl,1.1,1.2 marc_subfields_structure.pl,1.4,1.5
- Previous by thread:
[Koha-cvs] CVS: koha detail.pl,1.16,1.17 MARCdetail.pl,1.6,1.7 request.pl,1.17,1.18 search.pl,1.22,1.23
- Next by thread:
[Koha-cvs] CVS: koha/admin authorised_values.pl,1.1,1.2 marc_subfields_structure.pl,1.4,1.5
- Index(es):