[Koha-cvs] koha/serials receipt.pl statecollection.pl [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Tue Sep 26 15:27:41 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/09/26 13:27:41

Added files:
	serials        : receipt.pl statecollection.pl 

Log message:
	miising files added

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/serials/receipt.pl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/serials/statecollection.pl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.2.2.1

Patches:
Index: receipt.pl
===================================================================
RCS file: receipt.pl
diff -N receipt.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ receipt.pl	26 Sep 2006 13:27:41 -0000	1.1.2.1
@@ -0,0 +1,154 @@
+#!/usr/bin/perl
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+# $Id: receipt.pl,v 1.1.2.1 2006/09/26 13:27:41 toins Exp $
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+
+my $query = new CGI;
+
+my $op = $query->param('op');
+my $search = $query->param('titleorissn');
+my $startfrom=$query->param('startfrom');
+
+if ($op eq 'search')
+{
+    my $total;
+    my $results;
+    my $dbh = C4::Context->dbh;
+    my @marclist = $query->param('marclist');
+	my @and_or = $query->param('and_or');
+	my @excluding = $query->param('excluding');
+	my @operator = $query->param('operator');
+	my @value = $query->param('value');
+
+	my $resultsperpage= $query->param('resultsperpage');
+	$resultsperpage = 19 unless $resultsperpage;
+
+
+    my $sth = $dbh->prepare("select subscriptionid, biblionumber from subscription");
+    $sth->execute();
+    my @finalsolution;
+    while (my $first_step = $sth->fetchrow_hashref)
+    {
+	my $sth2 = $dbh->prepare("select b3.title from biblioitems b2, biblio b3 where b3.biblionumber = ? and b2.biblionumber = b3.biblionumber and (b2.issn = ? or b3.title like ?)");
+	$sth2->execute($first_step->{'biblionumber'},$search, "%$search%");
+	my @answear;
+	@answear = $sth2->fetchrow_array;
+	$total = scalar @answear;
+	if ($total >= 1)
+	{
+	    $first_step->{'serial'} = $answear[0];
+	    push @finalsolution ,$first_step;
+	}
+    }
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "serials/receipt-search-result.tmpl",
+				query => $query,
+				type => "intranet",
+				authnotrequired => 0,
+				flagsrequired => {catalogue => 1},
+				debug => 1,
+				});
+    $template->param(subtable => \@finalsolution, total => $total
+		,);
+
+	my $displaynext=0;
+	my $displayprev=$startfrom;
+	if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
+		$displaynext = 1;
+	}
+
+	my @field_data = ();
+
+
+	for(my $i = 0 ; $i <= $#marclist ; $i++)
+	{
+		push @field_data, { term => "marclist", val=>$marclist[$i] };
+		push @field_data, { term => "and_or", val=>$and_or[$i] };
+		push @field_data, { term => "excluding", val=>$excluding[$i] };
+		push @field_data, { term => "operator", val=>$operator[$i] };
+		push @field_data, { term => "value", val=>$value[$i] };
+	}
+
+	my @numbers = ();
+
+	if ($total>$resultsperpage)
+	{
+		for (my $i=1; $i<$total/$resultsperpage+1; $i++)
+		{
+			if ($i<16)
+			{
+	    		my $highlight=0;
+	    		($startfrom==($i-1)) && ($highlight=1);
+	    		push @numbers, { number => $i,
+					highlight => $highlight ,
+					searchdata=> \@field_data,
+					startfrom => ($i-1)};
+			}
+    	}
+	}
+
+	my $from = $startfrom*$resultsperpage+1;
+	my $to;
+
+ 	if($total < (($startfrom+1)*$resultsperpage))
+	{
+		$to = $total;
+	} else {
+		$to = (($startfrom+1)*$resultsperpage);
+	}
+    $results = \@finalsolution;
+	$template->param(result => $results) if $results;
+	$template->param(
+							startfrom=> $startfrom,
+							displaynext=> $displaynext,
+							displayprev=> $displayprev,
+							resultsperpage => $resultsperpage,
+							startfromnext => $startfrom+1,
+							startfromprev => $startfrom-1,
+							searchdata=>\@field_data,
+							total=>$total,
+							from=>$from,
+							to=>$to,
+							numbers=>\@numbers,
+							intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+		IntranetNav => C4::Context->preference("IntranetNav"),
+							);
+output_html_with_http_headers $query, $cookie, $template->output;
+
+}
+else{
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "serials/receipt.tmpl",
+				query => $query,
+				type => "intranet",
+				authnotrequired => 0,
+				flagsrequired => {catalogue => 1},
+				debug => 1,
+				});
+output_html_with_http_headers $query, $cookie, $template->output;
+}

Index: statecollection.pl
===================================================================
RCS file: statecollection.pl
diff -N statecollection.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ statecollection.pl	26 Sep 2006 13:27:41 -0000	1.2.2.1
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Date;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use C4::Bull;
+use HTML::Template;
+
+my $query = new CGI;
+my $op = $query->param('op');
+my $dbh = C4::Context->dbh;
+my $subscriptionid = $query->param('subscriptionid');
+my $auser = $query->param('user');
+my $histstartdate = format_date_in_iso($query->param('histstartdate'));
+my $enddate = format_date_in_iso($query->param('enddate'));
+my $recievedlist = $query->param('recievedlist');
+my $missinglist = $query->param('missinglist');
+my $opacnote = $query->param('opacnote');
+my $librariannote = $query->param('librariannote');
+my @serialids = $query->param('serialid');
+my @serialseqs = $query->param('serialseq');
+my @planneddates = $query->param('planneddate');
+my @notes = $query->param('notes');
+my @status = $query->param('status');
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "serials/statecollection.tmpl",
+				query => $query,
+				type => "intranet",
+				authnotrequired => 0,
+				flagsrequired => {catalogue => 1},
+				debug => 1,
+				});
+
+my $hassubscriptionexpired = hassubscriptionexpired($subscriptionid);
+my $subscription=getsubscription($subscriptionid);
+if ($op eq 'modsubscriptionhistory') {
+	modsubscriptionhistory($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
+}
+# change status except, if subscription has expired, for the "waited" issue.
+if ($op eq 'serialchangestatus') {
+	my $sth = $dbh->prepare("select status from serial where serialid=?");
+	for (my $i=0;$i<=$#serialids;$i++) {
+		$sth->execute($serialids[$i]);
+		my ($oldstatus) = $sth->fetchrow;
+		if ($serialids[$i]) {
+			serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i],$notes[$i]) unless ($hassubscriptionexpired && $oldstatus == 1);
+		} else {
+			# add a special issue
+			if ($serialseqs[$i]) {
+				my $subscription=getsubscription($subscriptionid);
+				newissue($serialseqs[$i],$subscriptionid,$subscription->{biblionumber},$status[$i], format_date_in_iso($planneddates[$i]));
+			}
+		}
+	}
+}
+my $subs = &getsubscription($subscriptionid);
+my ($totalissues, at serialslist) = getserials($subscriptionid,10);
+
+my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?");
+$sth->execute($subscriptionid);
+my $solhistory = $sth->fetchrow_hashref;
+
+	$template->param(
+			serialslist => \@serialslist,
+			biblionumber => $subscription->{biblionumber},
+			histstartdate => format_date($solhistory->{'histstartdate'}),
+			enddate => format_date($solhistory->{'enddate'}),
+			recievedlist => $solhistory->{'recievedlist'},
+			missinglist => $solhistory->{'missinglist'},
+			opacnote => $solhistory->{'opacnote'},
+			librariannote => $solhistory->{'librariannote'},
+			subscriptionid => $subscriptionid,
+			bibliotitle => $subs->{bibliotitle},
+			biblionumber => $subs->{biblionumber},
+			hassubscriptionexpired =>$hassubscriptionexpired,
+		);
+output_html_with_http_headers $query, $cookie, $template->output;





More information about the Koha-cvs mailing list