[Koha-cvs] koha/intranet/cgi-bin/reserve modrequest.pl pla... [rel_TG]

Tumer Garip tgarip at neu.edu.tr
Sat Mar 10 02:20:35 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_TG
Changes by:	Tumer Garip <tgarip1957>	07/03/10 01:20:35

Added files:
	intranet/cgi-bin/reserve: modrequest.pl placerequest.pl 
	                          request.pl 

Log message:
	fresh files for rel_TG

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/reserve/modrequest.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/reserve/placerequest.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/reserve/request.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1

Patches:
Index: modrequest.pl
===================================================================
RCS file: modrequest.pl
diff -N modrequest.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modrequest.pl	10 Mar 2007 01:20:35 -0000	1.1.2.1
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+#script to modify reserves/requests
+#written 2/1/00 by chris at katipo.oc.nz
+#last update 27/1/2000 by chris at katipo.co.nz
+
+
+# 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
+
+use strict;
+use C4::Search;
+use CGI;
+use C4::Output;
+use C4::Reserves2;
+use C4::Members;
+my $input = new CGI;
+
+my @rank=$input->param('rank-request');
+my @biblionumber=$input->param('biblionumber');
+my @borrower=$input->param('borrowernumber');
+my @branch=$input->param('pickup');
+my $count=@rank;
+my $cataloger=$input->param('loggedinuser');
+# goes through and manually changes the reserves record....
+# no attempt is made to check consistency.
+for (my $i=0;$i<$count;$i++){
+    UpdateReserves($rank[$i],$biblionumber[$i],$borrower[$i],$branch[$i],$cataloger); #from C4::Reserves2
+}
+
+my $from=$input->param('from');
+if ($from eq 'borrower'){
+  print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$borrower[0]");
+ } else {
+   print $input->redirect("/cgi-bin/koha/reserve/request.pl?biblionumber=$biblionumber[0]");
+}

Index: placerequest.pl
===================================================================
RCS file: placerequest.pl
diff -N placerequest.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ placerequest.pl	10 Mar 2007 01:20:35 -0000	1.1.2.1
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+#script to place reserves/requests
+#writen 2/1/00 by chris at katipo.oc.nz
+
+
+# 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
+
+use strict;
+use C4::Search;
+use CGI;
+use C4::Output;
+use C4::Reserves2;
+use C4::Members;
+my $input = new CGI;
+my $itemnumber=$input->param('itemnumber');
+my @bibitems=$input->param('biblioitem');
+my @reqbib=$input->param('reqbib');
+my $biblionumber=$input->param('biblionumber');
+my $borrower=$input->param('member');
+my $notes=$input->param('notes');
+my $branch=$input->param('pickup');
+my @rank=$input->param('rank-request');
+my $type=$input->param('type');
+my $title=$input->param('title');
+my $bornum=borrdata($borrower,'');
+my $cataloger=$input->param('loggedinuser');
+
+if ($type eq 'str8' && $bornum ne ''){
+    my $count=@bibitems;
+    @bibitems=sort @bibitems;
+    my $i2=1;
+    my @realbi;
+    $realbi[0]=$bibitems[0];
+for (my $i=1;$i<$count;$i++){
+    my $i3=$i2-1;
+    if ($realbi[$i3] ne $bibitems[$i]){
+	$realbi[$i2]=$bibitems[$i];
+	$i2++;
+    }
+}
+
+my $env;
+
+my $const;
+
+
+for (my $i=0; $i<@reqbib; $i++){
+if ($reqbib[$i] ne ''){
+  $const='o';
+  CreateReserve(\$env,$bornum->{'borrowernumber'},$cataloger,$biblionumber,'','',$branch,$const,$rank[0],$notes,$title,"",$reqbib[$i]);
+}
+}
+
+print $input->redirect("request.pl?biblionumber=$biblionumber");
+} elsif ($bornum eq ''){
+  print $input->header();
+  print "Invalid card number please try again";
+  print $input->Dump;
+}

Index: request.pl
===================================================================
RCS file: request.pl
diff -N request.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ request.pl	10 Mar 2007 01:20:35 -0000	1.1.2.1
@@ -0,0 +1,203 @@
+#!/usr/bin/perl
+
+# $Id: request.pl,v 1.1.2.1 2007/03/10 01:20:35 tgarip1957 Exp $
+
+#script to place reserves/requests
+#writen 2/1/00 by chris at katipo.oc.nz
+
+
+# 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
+
+use strict;
+use C4::Search;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Reserves2;
+use C4::Biblio;
+use C4::Koha;
+use C4::Circulation::Circ2;
+use C4::Acquisition;
+use CGI;
+use C4::Date;
+
+my $input = new CGI;
+my $dbh=C4::Context->dbh;
+# get biblio information....
+my $biblionumber = $input->param('biblionumber');
+my ($record) = XMLgetbiblio($dbh,$biblionumber);
+$record=XML_xml2hash_onerecord($record);
+my $dat=XMLmarc2koha_onerecord($dbh,$record,"biblios");
+# get existing reserves .....
+my ($count,$reserves) = FindReserves($biblionumber);
+my $totalcount = $count;
+foreach my $res (@$reserves) {
+    if ($res->{'found'} eq 'W') {
+	$count--;
+    }
+}
+
+# make priorities options
+my $num = $count + 1;
+
+#priorityoptions building
+my @optionloop;
+for (my $i=1; $i<=$num; $i++){
+	my %option;
+	$option{num}=$i;
+	$option{selected}=($i==$num);
+	push(@optionloop, \%option);
+}
+
+# todays date
+
+my $date=format_date(get_today());
+my $time=localtime(time);
+my @bibitemloop;
+
+	my %abibitem;
+	my @barcodeloop;
+    my @barcodes = barcodes($biblionumber);
+#warn @barcodes;
+    foreach my $num (@barcodes) {
+		my %barcode;
+		$barcode{'date_due'}=$num->{'date_due'} if $num->{'date_due'} gt "0000-00-00" ;
+		$barcode{'barcode'}=$num->{'barcode'};
+		$barcode{'itemnumber'}=$num->{'itemnumber'};
+		$barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" :
+	  	$num->{'itemlost'} == 2 ? "(long overdue)" : "";
+		$barcode{'class'}=$num->{'itemcallnumber'};
+		$abibitem{'itemlost'}=(($num->{'notforloan'})|| ($num->{'itemlost'} == 1)) ;
+		$abibitem{'itemlost'}=($num->{'wthdrawn'}) ;
+		push(@barcodeloop, \%barcode);
+    }
+#	
+    	$abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
+	$abibitem{'biblionumber'}=$dat->{'biblionumber'};
+	$abibitem{'description'}=$dat->{'itemtype'};
+	$abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
+	$abibitem{'publicationyear'}=$dat->{'publicationyear'};
+
+	$abibitem{'barcodeloop'}=\@barcodeloop;
+	push(@bibitemloop,\%abibitem);
+
+
+
+
+#existingreserves building
+my @reserveloop;
+my $branches = GetBranches();
+
+foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
+	my %reserve;
+if ($res->{'priority'}>$totalcount){$totalcount=$res->{'priority'};}
+#    my $prioropt = priorityoptions($totalcount, $res->{'priority'});
+	my @optionloop;
+	for (my $i=1; $i<=$totalcount; $i++){
+		my %option;
+		$option{num}=$i;
+		$option{selected}=($i==$res->{'priority'});
+		push(@optionloop, \%option);
+	}
+	my @branchloop;
+
+	foreach my $br (keys %$branches) {
+
+
+
+		(next) unless $branches->{$br}->{'IS'};
+
+				# Only branches with the 'IS' branchrelation
+				# can issue books
+		my %abranch;
+		$abranch{'selected'}=($br eq $res->{'branchcode'});
+		$abranch{'branch'}=$br;
+		$abranch{'branchname'}=$branches->{$br}->{'branchname'};
+		push(@branchloop,\%abranch);
+	}
+my %env;
+#		my $item = $res->{'itemnumber'};
+#		$item = getiteminformation(\%env,$item);
+
+    if ($res->{'found'} eq 'W') {
+		
+		$reserve{'holdingbranch'}=$res->{'holdingbranch'};
+		$reserve{'barcode'}=$res->{'barcode'};
+		$reserve{'biblionumber'}=$res->{'biblionumber'};
+		$reserve{'wbrcode'} = $res->{'branchcode'};
+		$reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
+		if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
+			$reserve{'atdestination'} = 1;
+		}
+    }
+	$reserve{'barcode'}=$res->{'barcode'};
+  	$reserve{'date'} = format_date($res->{'reservedate'});
+	$reserve{'borrowernumber'}=$res->{'borrowernumber'};
+	$reserve{'biblionumber'}=$res->{'biblionumber'};
+	$reserve{'bornum'}=$res->{'borrowernumber'};
+	$reserve{'firstname'}=$res->{'firstname'};
+	$reserve{'surname'}=$res->{'surname'};
+	$reserve{'bornum'}=$res->{'borrowernumber'};
+	$reserve{'notes'}=$res->{'reservenotes'};
+	$reserve{'wait'}=($res->{'found'} eq 'W');
+	$reserve{'constrainttypea'}=($res->{'constrainttype'} eq 'a');
+	$reserve{'constrainttypeo'}=($res->{'constrainttype'} eq 'o');
+	$reserve{'voldesc'}=$res->{'volumeddesc'};
+	$reserve{'itemtype'}=$res->{'ctype'};
+	$reserve{'branchloop'}=\@branchloop;
+	$reserve{'optionloop'}=\@optionloop;
+	push(@reserveloop,\%reserve);
+}
+
+my @branches;
+my @select_branch;
+my %select_branches;
+my $branches=GetBranches;
+#my $count2=scalar(@branches);
+foreach my $br (keys %$branches) {
+
+	push @select_branch, $br;
+	$select_branches{$br}= $branches->{$br}->{'branchname'};
+}
+my $CGIbranch=CGI::scrolling_list( -name     => 'pickup',
+			-values   => \@select_branch,
+			-labels   => \%select_branches,
+			-size     => 1,
+			-multiple => 0 );
+
+#get the time for the form name...
+my $time = time();
+
+#setup colours
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "reserve/request.tmpl",
+							query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {borrowers => 1},
+                         });
+$template->param(	optionloop =>\@optionloop,
+								CGIbranch => $CGIbranch,
+								reserveloop => \@reserveloop,
+								'time' => $time,
+								bibitemloop => \@bibitemloop,
+								date => $date,
+								biblionumber => $biblionumber,
+								title =>$dat->{title});
+# printout the page
+output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file





More information about the Koha-cvs mailing list