[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.61,1.62 additem-nomarc.pl,1.7,1.8 additem.pl,1.34,1.35
Paul POULAIN
tipaul at users.sourceforge.net
Wed Oct 26 11:11:36 CEST 2005
- Previous message: [Koha-cvs] CVS: koha/acqui acqui-home.pl,1.5,1.6 histsearch.pl,1.4,1.5 newbiblio.pl,1.27,1.28
- Next message: [Koha-cvs] CVS: koha/admin aqbookfund.pl,1.23,1.24 aqbudget.pl,1.17,1.18 branches.pl,1.29,1.30 systempreferences.pl,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28490/acqui.simple
Modified Files:
addbiblio.pl additem-nomarc.pl additem.pl
Log Message:
big commit, still breaking things...
* synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
* code cleaning (cleaning warnings from perl -w) continued
Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbiblio.pl,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -r1.61 -r1.62
*** addbiblio.pl 10 Aug 2005 10:21:14 -0000 1.61
--- addbiblio.pl 26 Oct 2005 09:11:34 -0000 1.62
***************
*** 174,177 ****
--- 174,178 ----
$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
$subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{kohafield};
+ $subfield_data{index} = $i;
# it's an authorised field
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
***************
*** 278,282 ****
}
# If there is more than 1 field, add an empty hidden field as separator.
! if ($#fields >1) {
my @subfields_data;
my %tag_data;
--- 279,283 ----
}
# If there is more than 1 field, add an empty hidden field as separator.
! if ($#fields >=1 && $#loop_data >=0 && $loop_data[$#loop_data]->{'tag'} eq $tag) {
my @subfields_data;
my %tag_data;
***************
*** 354,357 ****
--- 355,359 ----
my $frameworkcode = $input->param('frameworkcode');
my $dbh = C4::Context->dbh;
+ my $bibid;
***************
*** 431,437 ****
# MARC::Record built => now, record in DB
if ($is_a_modif) {
! NEWmodbiblioframework($dbh,$biblionumber,$frameworkcode);
! NEWmodbiblio($dbh,$record,$biblionumber,$frameworkcode);
! logaction($loggedinuser,"acqui.simple","modify",$biblionumber,"record : ".$record->as_formatted) if (C4::Context->preference("Activate_Log"));
} else {
my $biblioitemnumber;
--- 433,438 ----
# MARC::Record built => now, record in DB
if ($is_a_modif) {
! NEWmodbiblioframework($dbh,$bibid,$frameworkcode);
! NEWmodbiblio($dbh,$record,$bibid,$frameworkcode);
} else {
my $biblioitemnumber;
***************
*** 515,519 ****
$template->param(
frameworkcode => $frameworkcode,
! itemtype => $frameworkcode # HINT: if the library has itemtype = framework, itemtype is auto filled !
);
output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file
--- 516,521 ----
$template->param(
frameworkcode => $frameworkcode,
! itemtype => $frameworkcode, # HINT: if the library has itemtype = framework, itemtype is auto filled !
! hide_marc => C4::Context->preference('hide_marc'),
);
output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file
Index: additem-nomarc.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem-nomarc.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** additem-nomarc.pl 2 Sep 2005 14:46:40 -0000 1.7
--- additem-nomarc.pl 26 Oct 2005 09:11:34 -0000 1.8
***************
*** 21,30 ****
# $Log$
! # Revision 1.7 2005/09/02 14:46:40 tipaul
! # * road to zebra for MARC=OFF
! # * removing Acquisitions/branches.pm call, as it's now in Koha.pm
#
! # Revision 1.6 2005/08/04 12:12:13 tipaul
! # synch'ing 2.2 and head
#
# Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
--- 21,29 ----
# $Log$
! # Revision 1.8 2005/10/26 09:11:34 tipaul
! # big commit, still breaking things...
#
! # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
! # * code cleaning (cleaning warnings from perl -w) continued
#
# Revision 1.4.2.1 2005/03/25 12:52:44 tipaul
***************
*** 134,138 ****
itemtypeloop => \@itemtypeloop,
! );
output_html_with_http_headers $input, $cookie, $template->output;
--- 133,206 ----
itemtypeloop => \@itemtypeloop,
! ( $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');
! my $input = new CGI;
! my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
! {
! template_name => "acqui.simple/additem-nomarc.tmpl",
! query => $input,
! type => "intranet",
! authnotrequired => 0,
! flagsrequired => { editcatalogue => 1 },
! debug => 1,
! }
! );
!
! if ( $error eq "nobarcode" ) {
! $template->param( NOBARCODE => 1 );
! }
! elsif ( $error eq "nobiblioitem" ) {
! $template->param( NOBIBLIOITEM => 1 );
! }
! elsif ( $error eq "barcodeinuse" ) {
! $template->param( BARCODEINUSE => 1 );
! } # elsif
!
! for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) {
! if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) {
! $biblioitems[$i]->{'WEB'} = 1;
!
! }
! $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
! $biblioitems[$i]->{'dewey'} = $1;
! ( $itemcount, @items ) =
! &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} );
! $biblioitems[$i]->{'items'} = \@items;
! } # for
! $template->param(
! BIBNUM => $biblionumber,
! AUTHOR => $biblios[0]->{'author'},
! TITLE => $biblios[0]->{'title'},
! COPYRIGHT => $biblios[0]->{'copyrightdate'},
! SERIES => $biblios[0]->{'seriestitle'},
! NOTES => $biblios[0]->{'notes'},
! BIBITEMS => \@biblioitems,
! BRANCHES => \@branches,
! ITEMTYPES => \@itemtypes,
!
! );
output_html_with_http_headers $input, $cookie, $template->output;
Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** additem.pl 22 Sep 2005 10:01:45 -0000 1.34
--- additem.pl 26 Oct 2005 09:11:34 -0000 1.35
***************
*** 59,63 ****
my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
!
my $itemrecord;
my $nextop="additem";
--- 59,65 ----
my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
! my $record = MARCgetbiblio($dbh,$bibid);
! # warn "==>".$record->as_formatted;
! my $oldrecord = MARCmarc2koha($dbh,$record);
my $itemrecord;
my $nextop="additem";
***************
*** 77,81 ****
$indicators{$ind_tag[$i]} = $indicator[$i];
}
! my $addeditem = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
# check for item barcode # being unique
my $addedolditem = MARCmarc2koha($dbh,$addeditem);
--- 79,98 ----
$indicators{$ind_tag[$i]} = $indicator[$i];
}
! my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
! # if autoBarcode is ON, calculate barcode...
! if (C4::Context->preference('autoBarcode')) {
! my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.barcode");
! unless ($record->field($tagfield)->subfield($tagsubfield)) {
! my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
! $sth_barcode->execute;
! my ($newbarcode) = $sth_barcode->fetchrow;
! $newbarcode++;
! # OK, we have the new barcode, now create the entry in MARC record
! my $fieldItem = $record->field($tagfield);
! $record->delete_field($fieldItem);
! $fieldItem->add_subfields($tagsubfield => $newbarcode);
! $record->insert_fields_ordered($fieldItem);
! }
! }
# check for item barcode # being unique
my $addedolditem = MARCmarc2koha($dbh,$addeditem);
***************
*** 114,120 ****
my $itemrecord = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
# MARC::Record builded => now, record in DB
! # warn "ITEM TO MODIFY : ".$itemrecord->as_formatted;
! NEWmoditem($dbh, $itemrecord, $biblionumber, $biblioitemnumber, $itemnumber,0);
! $itemnumber="";
$nextop="additem";
}
--- 131,137 ----
my $itemrecord = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
# MARC::Record builded => now, record in DB
! # warn "R: ".$record->as_formatted;
! my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0);
! $itemnum="";
$nextop="additem";
}
***************
*** 133,146 ****
});
- # load the biblio to have the title, the biblioitemnumber & any other useful field
- my $record = MARCgetbiblio($dbh,$biblionumber);
- # warn $record ->as_formatted;
- # warn "REC ".$record->as_formatted;
- my $oldrecord = MARCmarc2koha($dbh,$record);
-
my %indicators;
$indicators{995}=' ';
# now, build existiing item list
! my @fields = $record->fields();
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
my @big_array;
--- 150,159 ----
});
my %indicators;
$indicators{995}=' ';
# now, build existiing item list
! my $temp = MARCgetbiblio($dbh,$bibid);
! my @fields = $temp->fields();
! #my @fields = $record->fields();
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
my @big_array;
***************
*** 148,152 ****
my ($itemtagfield,$itemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$itemtype);
my ($branchtagfield,$branchtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.homebranch",$itemtype);
! my @itemnums; # array to store itemnums
foreach my $field (@fields) {
next if ($field->tag()<10);
--- 161,165 ----
my ($itemtagfield,$itemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$itemtype);
my ($branchtagfield,$branchtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.homebranch",$itemtype);
!
foreach my $field (@fields) {
next if ($field->tag()<10);
***************
*** 161,172 ****
#verifying rights
my $userenv = C4::Context->userenv;
! unless ($userenv->{'flags'} == 1){
! if (not ($userenv->{'branch'} eq $subf[$i][1])) {
$this_row{'nomod'}=1;
- warn "nomod"
- }
}
}
! push @itemnums,$this_row{$subf[$i][0]} =$subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield);
}
if (%this_row) {
--- 174,182 ----
#verifying rights
my $userenv = C4::Context->userenv;
! unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subf[$i][1]))){
$this_row{'nomod'}=1;
}
}
! $this_row{itemnum} = $subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield);
}
if (%this_row) {
***************
*** 180,183 ****
--- 190,196 ----
}
}
+ my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$itemtype);
+ @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
+
# now, construct template !
my @item_value_loop;
***************
*** 190,194 ****
my %row_data;
$row_data{item_value} = $items_data;
! $row_data{itemnumber} = $itemnums[$i];
#reporting this_row values
$row_data{'nomod'} = $big_array[$i]{'nomod'};
--- 203,207 ----
my %row_data;
$row_data{item_value} = $items_data;
! $row_data{itemnum} = $big_array[$i]->{itemnum};
#reporting this_row values
$row_data{'nomod'} = $big_array[$i]{'nomod'};
***************
*** 221,231 ****
my ($x,$value);
($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord);
-
#testing branch value if IndependantBranches.
my $test = (C4::Context->preference("IndependantBranches")) &&
! ($tag==$branchtagfield) && ($subfield==$branchtagsubfield) &&
! (C4::Context->userenv->{flags} != 1) && ($value != C4::Context->userenv->{branch}) ;
! print $input->redirect("additem.pl?biblionumber=$biblionumber") if ($test);
!
# search for itemcallnumber if applicable
if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
--- 234,242 ----
my ($x,$value);
($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord);
#testing branch value if IndependantBranches.
my $test = (C4::Context->preference("IndependantBranches")) &&
! ($tag eq $branchtagfield) && ($subfield eq $branchtagsubfield) &&
! (C4::Context->userenv->{flags} != 1) && ($value) && ($value ne C4::Context->userenv->{branch}) ;
! # print $input->redirect(".pl?bibid=$bibid") if ($test);
# search for itemcallnumber if applicable
if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
***************
*** 302,319 ****
}
}
- my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "acqui.simple/additem.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {editcatalogue => 1},
- debug => 1,
- });
# 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 => \@item_value_loop,
item_header_loop => \@header_value_loop,
! biblionumber =>$biblionumber,
! biblioitemnumber => $oldrecord->{biblioitemnumber},
title => $oldrecord->{title},
author => $oldrecord->{author},
--- 313,322 ----
}
}
# 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 => \@item_value_loop,
item_header_loop => \@header_value_loop,
! bibid => $bibid,
! biblionumber =>$oldbiblionumber,
title => $oldrecord->{title},
author => $oldrecord->{author},
- Previous message: [Koha-cvs] CVS: koha/acqui acqui-home.pl,1.5,1.6 histsearch.pl,1.4,1.5 newbiblio.pl,1.27,1.28
- Next message: [Koha-cvs] CVS: koha/admin aqbookfund.pl,1.23,1.24 aqbudget.pl,1.17,1.18 branches.pl,1.29,1.30 systempreferences.pl,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Koha-cvs
mailing list