[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/acqui.simple additem.pl [rel_2_2]
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] koha/acqui.simple additem.pl [rel_2_2] |
Date: |
Mon, 16 Jul 2007 15:27:14 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Henri-Damien LAURENT <hdl> 07/07/16 15:27:14
Modified files:
acqui.simple : additem.pl
Log message:
additem
multiple subfield allowed.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui.simple/additem.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.27.2.26&r2=1.27.2.27
Patches:
Index: additem.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/additem.pl,v
retrieving revision 1.27.2.26
retrieving revision 1.27.2.27
diff -u -b -r1.27.2.26 -r1.27.2.27
--- additem.pl 14 Apr 2007 18:59:00 -0000 1.27.2.26
+++ additem.pl 16 Jul 2007 15:27:14 -0000 1.27.2.27
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: additem.pl,v 1.27.2.26 2007/04/14 18:59:00 kados Exp $
+# $Id: additem.pl,v 1.27.2.27 2007/07/16 15:27:14 hdl Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -131,6 +131,35 @@
$nextop="additem";
}
#------------------------------------------------------------------------------------------------------------------------------
+} elsif ($op eq "addfield") {
+#------------------------------------------------------------------------------------------------------------------------------
+ my $addedfield = $input->param('addfield_field');
+ my $cntrepeatfield=$input->param('repeat_field');
+ $cntrepeatfield=1 unless ($cntrepeatfield);
+ my $tagaddfield_subfield = $input->param('addfield_subfield');
+ 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 $xml =
MARChtml2xml(address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
+ my $record;
+ if (C4::Context->preference('marcflavour') eq "UNIMARC") {
+ my %indicators;
+ for (my $i=0;$i<=$#ind_tag;$i++) {
+ $indicators{$ind_tag[$i]} = $indicator[$i];
+ }
+ $record =
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
+ } else {
+ my $xml =
MARChtml2xml(address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
+
$record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
+ }
+ for (my $i=1;$i<=$cntrepeatfield;$i++){
+ my $field =
MARC::Field->new("$addedfield",'','',"$tagaddfield_subfield" => "");
+ $record->append_fields($field);
+ }
+#------------------------------------------------------------------------------------------------------------------------------
} elsif ($op eq "saveitem") {
#------------------------------------------------------------------------------------------------------------------------------
# rebuild
@@ -252,7 +281,7 @@
my @loop_data =();
my $i=0;
my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from
authorised_values where category=? order by lib");
-
+my $index=0;
foreach my $tag (sort keys %{$tagslib}) {
my $previous_tag = '';
# loop through each subfield
@@ -267,6 +296,7 @@
$subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
$subfield_data{hidden}= "display:none" if
$tagslib->{$tag}->{$subfield}->{hidden};
+ $subfield_data{index}= $index++;
my ($x,$value);
($x,$value) = find_value($tag,$subfield,$itemrecord) if
($itemrecord);
$value =~ s/"/"/g;
@@ -352,6 +382,7 @@
}
# $subfield_data{marc_value}="<input type=\"text\"
name=\"field_value\">";
push(@loop_data, \%subfield_data);
+# use Data::Dumper;warn Dumper(@loop_data);
$i++
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/acqui.simple additem.pl [rel_2_2],
Henri-Damien LAURENT <=