[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.48,1.49
Paul POULAIN
tipaul at users.sourceforge.net
Tue Nov 2 17:44:48 CET 2004
Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8389/acqui.simple
Modified Files:
addbiblio.pl
Log Message:
new feature : checking for duplicate biblio.
For instance, it's only done on ISBN only. Will be improved soon.
When a duplicate is detected, the biblio is not saved, but the user is asked for a confirmations.
Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbiblio.pl,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** addbiblio.pl 4 Oct 2004 20:02:36 -0000 1.48
--- addbiblio.pl 2 Nov 2004 16:44:45 -0000 1.49
***************
*** 382,396 ****
}
my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
! # MARC::Record built => now, record in DB
! my $oldbibnum;
! my $oldbibitemnum;
! if ($is_a_modif) {
! NEWmodbiblio($dbh,$record,$bibid,$frameworkcode);
} else {
! ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record,$frameworkcode);
}
- # now, redirect to additem page
- print $input->redirect("additem.pl?bibid=$bibid&frameworkcode=$frameworkcode");
- exit;
#------------------------------------------------------------------------------------------------------------------------------
} elsif ($op eq "addfield") {
--- 382,418 ----
}
my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
! # check for a duplicate
! my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);
! my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
! # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
! if (!$duplicatebiblionumber or $confirm_not_duplicate) {
! # MARC::Record built => now, record in DB
! my $oldbibnum;
! my $oldbibitemnum;
! if ($is_a_modif) {
! NEWmodbiblio($dbh,$record,$bibid,$frameworkcode);
! } else {
! ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record,$frameworkcode);
! }
! # now, redirect to additem page
! print $input->redirect("additem.pl?bibid=$bibid&frameworkcode=$frameworkcode");
! exit;
} else {
! # it may be a duplicate, warn the user and do nothing
! build_tabs ($template, $record, $dbh,$encoding);
! build_hidden_data;
! $template->param(
! oldbiblionumber => $oldbiblionumber,
! bibid => $bibid,
! oldbiblionumtagfield => $oldbiblionumtagfield,
! oldbiblionumtagsubfield => $oldbiblionumtagsubfield,
! oldbiblioitemnumtagfield => $oldbiblioitemnumtagfield,
! oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
! oldbiblioitemnumber => $oldbiblioitemnumber,
! duplicatebiblionumber => $duplicatebiblionumber,
! duplicatebibid => $duplicatebibid,
! duplicatetitle => $duplicatetitle,
! );
}
#------------------------------------------------------------------------------------------------------------------------------
} elsif ($op eq "addfield") {
***************
*** 420,424 ****
last if ($end>0 && $tags[$i] ne $addedfield);
}
- warn "ST : $addedfield => $start / $end";
# add an empty line in all arrays. This forces a new field in MARC::Record.
splice(@tags,$end+1,0,'');
--- 442,445 ----
***************
*** 439,443 ****
}
my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
- warn "R=>".$record->as_formatted;
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
--- 460,463 ----
***************
*** 468,472 ****
oldbiblioitemnumtagfield => $oldbiblioitemnumtagfield,
oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
! oldbiblioitemnumber => $oldbiblioitemnumber );
}
$template->param(
--- 488,493 ----
oldbiblioitemnumtagfield => $oldbiblioitemnumtagfield,
oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
! oldbiblioitemnumber => $oldbiblioitemnumber,
! );
}
$template->param(
More information about the Koha-cvs
mailing list