[Koha-cvs] koha bull/statecollection.pl C4/Bull.pm koha-tm... [rel_2_2]

Henri-Damien LAURENT laurenthdl at alinto.com
Wed Feb 8 10:20:11 CET 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Henri-Damien LAURENT <hdl at savannah.gnu.org>	06/02/08 09:20:11

Modified files:
	bull           : statecollection.pl 
	C4             : Bull.pm 
	koha-tmpl/intranet-tmpl/default/en/bull: statecollection.tmpl 

Log message:
	Bug fixing statecollection itemization :
	status and itemcallnumbers were not taken into account.
	re writing some code in order to have only a few blocks for serialadditems.
	changing status to itemstatus in template wherever it was necessary for script to work -- itemstatus(notforloan) is not status(arrived missing)--.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/bull/statecollection.pl.diff?only_with_tag=rel_2_2&tr1=1.3.2.12&tr2=1.3.2.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Bull.pm.diff?only_with_tag=rel_2_2&tr1=1.6.2.20&tr2=1.6.2.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl.diff?only_with_tag=rel_2_2&tr1=1.4.2.7&tr2=1.4.2.8&r1=text&r2=text

Patches:
Index: koha/C4/Bull.pm
diff -u koha/C4/Bull.pm:1.6.2.20 koha/C4/Bull.pm:1.6.2.21
--- koha/C4/Bull.pm:1.6.2.20	Tue Feb  7 15:33:35 2006
+++ koha/C4/Bull.pm	Wed Feb  8 09:20:11 2006
@@ -474,7 +474,7 @@
 		unless ($exists){
 			my $marcrecord = MARC::Record->new();
 			my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.barcode",$fwk);
-			warn "items.barcode : $tag , $subfield";
+# 			warn "items.barcode : $tag , $subfield";
 			my $newField = MARC::Field->new(
 				"$tag",'','',
 				"$subfield" => $info->{barcode}
@@ -482,7 +482,7 @@
 			$marcrecord->insert_fields_ordered($newField);
 			if ($info->{branch}){
 				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.homebranch",$fwk);
-				warn "items.homebranch : $tag , $subfield";
+# 				warn "items.homebranch : $tag , $subfield";
 				if ($marcrecord->field($tag)) {
 					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch})
 				}else {
@@ -493,6 +493,7 @@
 					$marcrecord->insert_fields_ordered($newField);
 				}
 				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$fwk);
+# 				warn "items.holdingbranch : $tag , $subfield";
 				if ($marcrecord->field($tag)) {
 					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch})
 				}else {
@@ -503,8 +504,22 @@
 					$marcrecord->insert_fields_ordered($newField);
 				}
 			}
+			if ($info->{itemcallnumber}){
+				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemcallnumber",$fwk);
+# 				warn "items.itemcallnumber : $tag , $subfield";
+				if ($marcrecord->field($tag)) {
+					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{itemcallnumber})
+				}else {
+					my $newField = MARC::Field->new(
+						"$tag",'','',
+						"$subfield" => $info->{itemcallnumber}
+					);
+					$marcrecord->insert_fields_ordered($newField);
+				}
+			}
 			if ($info->{notes}){
 				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemnotes",$fwk);
+# 				warn "items.itemnotes : $tag , $subfield";
 				if ($marcrecord->field($tag)) {
 					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{notes})
 				}else {
@@ -517,6 +532,7 @@
 			}
 			if ($info->{location}){
 				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.location",$fwk);
+# 				warn "items.location : $tag , $subfield";
 				if ($marcrecord->field($tag)) {
 					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{location})
 				}else {
@@ -529,6 +545,7 @@
 			}
 			if ($info->{status}){
 				my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.notforloan",$fwk);
+# 				warn "items.notforloan : $tag , $subfield";
 				if ($marcrecord->field($tag)) {
 					$marcrecord->field($tag)->add_subfields("$subfield" => $info->{status})
 				}else {
Index: koha/bull/statecollection.pl
diff -u koha/bull/statecollection.pl:1.3.2.12 koha/bull/statecollection.pl:1.3.2.13
--- koha/bull/statecollection.pl:1.3.2.12	Tue Feb  7 16:21:32 2006
+++ koha/bull/statecollection.pl	Wed Feb  8 09:20:11 2006
@@ -89,47 +89,43 @@
 
 my $subs = &getsubscription($subscriptionid);
 my ($totalissues, at serialslist) = getserials($subscriptionid);
-my $branches = getbranches;
-my @branchloop;
-foreach my $thisbranch (keys %$branches) {
-	my %row =(value => $thisbranch,
-				branchname => $branches->{$thisbranch}->{'branchname'},
-			);
-	push @branchloop, \%row;
-}
-
-my $itemstatushash = getitemstatus;
-my @itemstatusloop;
-foreach my $thisitemstatus (keys %$itemstatushash) {
-	my %row =(itemval => $thisitemstatus,
-				itemlib => $itemstatushash->{$thisitemstatus},
-			);
-	warn "".$row{'itemval'}.", ". $row{"itemlib"};
-	push @itemstatusloop, \%row;
-}
-
-my $itemlocationhash = getitemlocation;
-my @itemlocationloop;
-foreach my $thisitemlocation (keys %$itemlocationhash) {
-	my %row =(value => $thisitemlocation,
-				itemlocationname => $itemlocationhash->{$thisitemlocation},
-			);
-	push @itemlocationloop, \%row;
-}
 
 if (C4::Context->preference("serialsadditems")){
+	my $bibid=MARCfind_MARCbibid_from_oldbiblionumber($dbh,$subscription->{biblionumber});
+	my $fwk=MARCfind_frameworkcode($dbh,$bibid);
+
+	my $branches = getbranches;
+	my @branchloop;
+	foreach my $thisbranch (keys %$branches) {
+		my %row =(value => $thisbranch,
+					branchname => $branches->{$thisbranch}->{'branchname'},
+				);
+		push @branchloop, \%row;
+	}
+	
+	my $itemstatushash = getitemstatus($fwk);
+	my @itemstatusloop;
+	foreach my $thisitemstatus (keys %$itemstatushash) {
+		my %row =(itemval => $thisitemstatus,
+					itemlib => $itemstatushash->{$thisitemstatus},
+				);
+		warn "".$row{'itemval'}.", ". $row{"itemlib"};
+		push @itemstatusloop, \%row;
+	}
+	
+	my $itemlocationhash = getitemlocation($fwk);
+	my @itemlocationloop;
+	foreach my $thisitemlocation (keys %$itemlocationhash) {
+		my %row =(value => $thisitemlocation,
+					itemlocationname => $itemlocationhash->{$thisitemlocation},
+				);
+		push @itemlocationloop, \%row;
+	}
 	foreach my $data (@serialslist){
 		$data->{"itemstatusloop"}=\@itemstatusloop if (scalar(@itemstatusloop));
 		$data->{"itemlocationloop"}=\@itemlocationloop if (scalar(@itemlocationloop));
 		$data->{"branchloop"}=\@branchloop ;
 	}
-}
-	
-my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?");
-$sth->execute($subscriptionid);
-my $solhistory = $sth->fetchrow_hashref;
-
-if (C4::Context->preference("serialsadditems")){
 	$template->param(serialadditems =>C4::Context->preference("serialsadditems"),
 					branchloop => \@branchloop,
 					) ;
@@ -139,6 +135,11 @@
 	$template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ;
 }
 	
+my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?");
+$sth->execute($subscriptionid);
+my $solhistory = $sth->fetchrow_hashref;
+
+	
 $template->param(
 			serialslist => \@serialslist,
 			biblionumber => $subscription->{biblionumber},
Index: koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl:1.4.2.7 koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl:1.4.2.8
--- koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl:1.4.2.7	Tue Feb  7 15:33:35 2006
+++ koha/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl	Wed Feb  8 09:20:11 2006
@@ -90,7 +90,7 @@
 			</td>
 			<td>
 				<!--TMPL_IF Name="itemstatus"-->
-					<select name="status" size="1">
+					<select name="itemstatus" size="1">
 						<option value="">Item Status</option>
 						<!-- TMPL_LOOP name="itemstatusloop" -->
 							<option value="<!-- TMPL_VAR name="itemval" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="itemlib" --></option>
@@ -148,7 +148,7 @@
 			</td>
 			<td>
 				<!-- TMPL_IF Name="itemstatus"-->
-					<select name="status" size="1">
+					<select name="itemstatus" size="1">
 						<option value="">Item Status</option>
 						<!-- TMPL_LOOP name="itemstatusloop" -->
 							<option value="<!-- TMPL_VAR name="itemval" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="itemlib" --></option>





More information about the Koha-cvs mailing list