[Koha-cvs] koha/acqui.simple addbiblio.pl additem.pl savei... [dev_week]

Joshua Ferraro jmf at kados.org
Sun Oct 1 18:10:28 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/10/01 16:10:28

Modified files:
	acqui.simple   : addbiblio.pl additem.pl saveitem.pl 

Log message:
	updating with the API changes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui.simple/addbiblio.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.52.2.40.2.4&r2=1.52.2.40.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/acqui.simple/additem.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.27.2.19.2.2&r2=1.27.2.19.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/acqui.simple/saveitem.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.11&r2=1.11.4.1

Patches:
Index: addbiblio.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/addbiblio.pl,v
retrieving revision 1.52.2.40.2.4
retrieving revision 1.52.2.40.2.5
diff -u -b -r1.52.2.40.2.4 -r1.52.2.40.2.5
--- addbiblio.pl	27 Jul 2006 17:58:48 -0000	1.52.2.40.2.4
+++ addbiblio.pl	1 Oct 2006 16:10:28 -0000	1.52.2.40.2.5
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.40.2.4 2006/07/27 17:58:48 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.40.2.5 2006/10/01 16:10:28 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -426,16 +426,17 @@
 my $op = $input->param('op');
 my $frameworkcode = $input->param('frameworkcode');
 my $dbh = C4::Context->dbh;
-my $bibid;
+my $biblionumber;
 
 
 if ($oldbiblionumber) {
-	$bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber);
+	$biblionumber = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber);
 	# find framework type
-	$frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode));
-}else {
-	$bibid = $input->param('bibid');
-	$frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode));
+	$frameworkcode = &MARCfind_frameworkcode($dbh,$biblionumber) if ($biblionumber and not ($frameworkcode));
+}
+else {
+	$biblionumber = $input->param('bibid');
+	$frameworkcode = &MARCfind_frameworkcode($dbh,$biblionumber) if ($biblionumber and not ($frameworkcode));
 }
 $frameworkcode='' if ($frameworkcode eq 'Default');
 my ($template, $loggedinuser, $cookie)
@@ -460,7 +461,8 @@
 	$select_fwk{$fwk} = $description;
 }
 $curfwk=$frameworkcode;
-my $framework=CGI::scrolling_list( -name     => 'Frameworks',
+my $framework=CGI::scrolling_list( 
+			-name     => 'Frameworks',
 			-id => 'Frameworks',
 			-default => $curfwk,
 			-OnChange => 'Changefwk(this);',
@@ -473,13 +475,13 @@
 $tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
 my $record=-1;
 my $encoding="";
-$record = MARCgetbiblio($dbh,$bibid) if ($bibid);
+$record = MARCgetbiblio($dbh,$biblionumber) if ($biblionumber);
 ($record,$encoding) = MARCfindbreeding($dbh,$breedingid) if ($breedingid);
 
 $is_a_modif=0;
 my ($oldbiblionumtagfield,$oldbiblionumtagsubfield);
 my ($oldbiblioitemnumtagfield,$oldbiblioitemnumtagsubfield,$bibitem,$oldbiblioitemnumber);
-if ($bibid) {
+if ($biblionumber) {
 	$is_a_modif=1;
 	# if it's a modif, retrieve old biblio and bibitem numbers for the future modification of old-DB.
 	($oldbiblionumtagfield,$oldbiblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber",$frameworkcode);
@@ -516,21 +518,23 @@
 		my $oldbibnum;
 		my $oldbibitemnum;
 		if ($is_a_modif) {
-			NEWmodbiblioframework($dbh,$bibid,$frameworkcode);
-			NEWmodbiblio($dbh,$record,$bibid,$frameworkcode);
-		} else {
-			($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record,$frameworkcode);
+			ModBiblioframework($dbh,$biblionumber,$frameworkcode);
+			ModBiblio($dbh,$record,$biblionumber,$frameworkcode);
+		} 
+		else {
+			($biblionumber,$oldbibnum,$oldbibitemnum) = AddBiblio($dbh,$record,$frameworkcode);
 		}
 	# now, redirect to additem page
-		print $input->redirect("additem.pl?bibid=$bibid&frameworkcode=$frameworkcode");
+		print $input->redirect("additem.pl?bibid=$biblionumber&frameworkcode=$frameworkcode");
 		exit;
-	} else {
+	} 
+	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,
+			bibid                       => $biblionumber,
 			oldbiblionumtagfield        => $oldbiblionumtagfield,
 			oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
 			oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
@@ -561,16 +565,22 @@
 	build_hidden_data;
 	$template->param(
 		oldbiblionumber             => $oldbiblionumber,
-		bibid                       => $bibid,
+		bibid                       => $biblionumber,
 		oldbiblionumtagfield        => $oldbiblionumtagfield,
 		oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
 		oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
 		oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
 		oldbiblioitemnumber         => $oldbiblioitemnumber );
+
 } elsif ($op eq "delete") {
 #------------------------------------------------------------------------------------------------------------------------------
-	&NEWdelbiblio($dbh,$bibid);
+	my $error = &DelBiblio($dbh,$biblionumber);
+	if ($error) {
+		print "Content-Type: text/html\n\n$error";
+	}
+	else {
 	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=/cgi-bin/koha/search.marc/search.pl?type=intranet\"></html>";
+	}
 	exit;
 #------------------------------------------------------------------------------------------------------------------------------
 #------------------------------------------------------------------------------------------------------------------------------
@@ -578,16 +588,15 @@
 #------------------------------------------------------------------------------------------------------------------------------
 	# If we're in a duplication case, we have to set to "" the bibid and biblionumber
 	# as we'll save the biblio as a new one.
-	if ($op eq "duplicate")
-	{
-		$bibid = "";
+	if ($op eq "duplicate") {
+		$biblionumber = "";
 		$oldbiblionumber= "";
 	}
 	build_tabs ($template, $record, $dbh,$encoding);
 	build_hidden_data;
 	$template->param(
 		oldbiblionumber             => $oldbiblionumber,
-		bibid                       => $bibid,
+		bibid                       => $biblionumber,
 		oldbiblionumtagfield        => $oldbiblionumtagfield,
 		oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
 		oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
@@ -595,6 +604,7 @@
 		oldbiblioitemnumber         => $oldbiblioitemnumber,
 		);
 }
+
 $template->param(
 		frameworkcode => $frameworkcode,
 		itemtype => $frameworkcode, # HINT: if the library has itemtype = framework, itemtype is auto filled !

Index: additem.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/additem.pl,v
retrieving revision 1.27.2.19.2.2
retrieving revision 1.27.2.19.2.3
diff -u -b -r1.27.2.19.2.2 -r1.27.2.19.2.3
--- additem.pl	27 Jul 2006 15:41:16 -0000	1.27.2.19.2.2
+++ additem.pl	1 Oct 2006 16:10:28 -0000	1.27.2.19.2.3
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.27.2.19.2.2 2006/07/27 15:41:16 kados Exp $
+# $Id: additem.pl,v 1.27.2.19.2.3 2006/10/01 16:10:28 kados Exp $
 #
 # Copyright 2000-2002 Katipo Communications
 #
@@ -50,7 +50,7 @@
 my $dbh = C4::Context->dbh;
 my $error = $input->param('error');
 my $bibid = $input->param('bibid');
-my $oldbiblionumber = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid);
+my $oldbiblionumber = $bibid; 
 
 my $op = $input->param('op');
 my $itemnum = $input->param('itemnum');
@@ -110,7 +110,7 @@
 	push @errors,"barcode_not_unique" if($exists);
 # MARC::Record builded => now, record in DB
 	# if barcode exists, don't create, but report The problem.
-	my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid) unless ($exists);
+	my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItem($dbh,$record,$bibid) unless ($exists);
 	if ($exists) {
 		$nextop = "additem";
 		$itemrecord = $record;
@@ -134,7 +134,7 @@
 	if ($onloan){
 	$nextop = "additem";
 	}else{
-		&NEWdelitem($dbh,$bibid,$itemnum);
+		&DelItem($dbh,$bibid,$itemnum);
 		$nextop="additem";
 	}
 #------------------------------------------------------------------------------------------------------------------------------
@@ -162,7 +162,7 @@
 	#my $record = 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);
+	my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = ModItem($dbh,$record,$bibid,$itemnum,0);
 	$itemnum="";
 	$nextop="additem";
 }

Index: saveitem.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/saveitem.pl,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -u -b -r1.11 -r1.11.4.1
--- saveitem.pl	19 Nov 2004 16:41:49 -0000	1.11
+++ saveitem.pl	1 Oct 2006 16:10:28 -0000	1.11.4.1
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: saveitem.pl,v 1.11 2004/11/19 16:41:49 tipaul Exp $
+# $Id: saveitem.pl,v 1.11.4.1 2006/10/01 16:10:28 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #





More information about the Koha-cvs mailing list