koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/intranet/cgi-bin/bookshelves add-biblios-t... [rel_TG]


From: Tumer Garip
Subject: [Koha-cvs] koha/intranet/cgi-bin/bookshelves add-biblios-t... [rel_TG]
Date: Sat, 10 Mar 2007 01:13:51 +0000

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

Added files:
        intranet/cgi-bin/bookshelves: add-biblios-to-shelves.pl 
                                      addbookbybiblionumber.pl 
                                      quicksearch.pl shelf-requests.pl 
                                      shelves.pl 

Log message:
        fresh files for rel_TG

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/bookshelves/add-biblios-to-shelves.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/bookshelves/addbookbybiblionumber.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/bookshelves/quicksearch.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/bookshelves/shelf-requests.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/bookshelves/shelves.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1

Patches:
Index: add-biblios-to-shelves.pl
===================================================================
RCS file: add-biblios-to-shelves.pl
diff -N add-biblios-to-shelves.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ add-biblios-to-shelves.pl   10 Mar 2007 01:13:51 -0000      1.1.2.1
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+#virtual shelves management, add a set of biblionumber to a set of shelves
+# written 06/05
+# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP 
Argentina and
+#
+# 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::BookShelves;
+use C4::Circulation::Circ2;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+use C4::AcademicInfo;
+use C4::Koha;
+
+my $cgi = new CGI;
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "bookshelves/shelves.tmpl",
+                                                       query => $cgi,
+                                                       type => "intranet",
+                                                       authnotrequired => 0,
+                                                       flagsrequired => 
{cataloging => 1},
+                                               });
+
+my @shelfnumber = $cgi->param('shelfnumber');
+my @biblios            = split /,/, $cgi->param('biblios');
+
+foreach my $shelfnum (@shelfnumber) {
+       foreach my $bibnum (@biblios) {
+               my $data = &GetShelfInfo($shelfnum, $loggedinuser);     
+               if (!$data->{'canmanage'}) {
+                       show_error($cgi, "intra");
+                       exit;
+               }
+               AddToShelfExt($bibnum, $shelfnum);
+       }
+}
+       
+print $cgi->redirect($cgi->param('return_url'));
+

Index: addbookbybiblionumber.pl
===================================================================
RCS file: addbookbybiblionumber.pl
diff -N addbookbybiblionumber.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ addbookbybiblionumber.pl    10 Mar 2007 01:13:51 -0000      1.1.2.1
@@ -0,0 +1,126 @@
+#!/usr/bin/perl
+#script to provide bookshelf management
+# WARNING: This file uses 4-character tabs!
+#
+# $Header: 
/sources/koha/koha/intranet/cgi-bin/bookshelves/Attic/addbookbybiblionumber.pl,v
 1.1.2.1 2007/03/10 01:13:51 tgarip1957 Exp $
+#
+# 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::Biblio;
+use CGI;
+use C4::BookShelves;
+use C4::Circulation::Circ2;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Context;
+my $dbh=C4::Context->dbh;
+my $env;
+my $query = new CGI;
+my $biblionumber = $query->param('biblionumber');
+my $shelfnumber = $query->param('shelfnumber');
+my $newbookshelf = $query->param('newbookshelf');
+my $category = $query->param('category');
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => 
"bookshelves/addbookbybiblionumber.tmpl",
+                                                       query => $query,
+                                                       type => "intranet",
+                                                       authnotrequired => 0,
+                                                       flagsrequired => 
{catalogue => 1},
+                                               });
+
+my $x; # for trash
+($x,$x,$shelfnumber) = AddShelf('',$newbookshelf,$loggedinuser,$category) if 
$newbookshelf;
+
+if ($shelfnumber) {
+       &AddToShelfFromBiblio($env, $biblionumber, $shelfnumber);
+       print "Content-Type: text/html\n\n<html><body 
onload=\"window.close()\"></body></html>";
+       exit;
+} else {
+
+       my  (  $bibliohash )  = XMLgetbibliohash($dbh,$biblionumber);
+       my $biblios=XMLmarc2koha_onerecord($dbh,$bibliohash,"biblios");
+       my ($shelflist) = GetShelfList($loggedinuser,3);
+       my @shelvesloop;
+       my %shelvesloop;
+       foreach my $element (sort keys %$shelflist) {
+                       push (@shelvesloop, $element);
+                       $shelvesloop{$element} = 
$shelflist->{$element}->{'shelfname'};
+       }
+
+       my $CGIbookshelves=CGI::scrolling_list( -name     => 'shelfnumber',
+                               -values   => address@hidden,
+                               -labels   => \%shelvesloop,
+                               -size     => 1,
+                               -tabindex=>'',
+                               -multiple => 0 );
+
+       $template->param(biblionumber => $biblionumber,
+                                               title => $biblios->{'title'},
+                                               author => $biblios->{'author'},
+                                               CGIbookshelves => 
$CGIbookshelves,
+                                               intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+               intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
+               IntranetNav => C4::Context->preference("IntranetNav"),
+                                               );
+
+       output_html_with_http_headers $query, $cookie, $template->output;
+}
+# $Log: addbookbybiblionumber.pl,v $
+# Revision 1.1.2.1  2007/03/10 01:13:51  tgarip1957
+# fresh files for rel_TG
+#
+# Revision 1.5  2006/09/27 21:19:21  tgarip1957
+# Finalized XML version for intranet
+#
+# Revision 1.4  2006/07/04 14:36:51  toins
+# Head & rel_2_2 merged
+#
+# Revision 1.3.2.4  2006/06/20 16:21:42  oleonard
+# Adding "tabindex=''" to CGI:scrolling_lists to prevent incorrect tabbing. 
See Bug 1098
+#
+# Revision 1.3.2.3  2006/02/05 21:59:21  kados
+# Adds script support for IntranetNav ... see mail to koha-devel for
+# details
+#
+# Revision 1.3.2.2  2006/02/05 21:45:25  kados
+# Adds support for intranetstylesheet system pref in Koha scripts
+#
+# Revision 1.3.2.1  2006/02/04 21:26:47  kados
+# Adds support for intranetcolorstylesheet
+#
+# Revision 1.3  2004/12/15 17:28:22  tipaul
+# adding bookshelf features :
+# * create bookshelf on the fly
+# * modify a bookshelf (this being not finished, will commit the rest soon)
+#
+# Revision 1.2  2004/11/19 16:31:30  tipaul
+# bugfix for bookshelves not in official CVS
+#
+# Revision 1.1.2.2  2004/03/10 15:08:18  tipaul
+# modifying shelves : introducing category of shelf : private, public, free 
for all
+#
+# Revision 1.1.2.1  2004/02/19 10:14:36  tipaul
+# new feature : adding book to bookshelf from biblio detail screen.
+#
+
+# Local Variables:
+# tab-width: 4
+# End:

Index: quicksearch.pl
===================================================================
RCS file: quicksearch.pl
diff -N quicksearch.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ quicksearch.pl      10 Mar 2007 01:13:51 -0000      1.1.2.1
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+use strict;
+require Exporter;
+use CGI;
+
+use C4::Search;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+use C4::Biblio;
+use C4::Koha;
+use C4::Members;
+use POSIX qw(ceil floor);
+
+my $cgi = new CGI;
+my $dbh = C4::Context->dbh;
+my $op = $cgi->param('op'); #show the search form or execute the search
+
+my ($template, $borrowernumber, $cookie)
+               = get_template_and_user({template_name => 
"bookshelves/quicksearch.tmpl",
+                                        query => $cgi,
+                                        type => "intranet",
+                                        authnotrequired => 1,
+                                });
+
+# get all the common search variables, 
+my @fields = ('keyword', 'isbn', 'itemnumber', 'field_name1', 'field_value1', 
'ttype1', 'search_type', 'class');
+
+# collect all the fields ...
+my %search;
+my @forminputs;
+$search{'avoidquerylog'} = 1;
+foreach my $field (@fields) {
+       $search{$field} = $cgi->param($field);
+       push @forminputs, {field => $field, value => $search{$field}} if 
($search{$field}); 
+}
+$template->param(forminputs => address@hidden);
+
+#Check the param to know if there is to do the search or to show the search 
form. 
+if ($op eq "do_search") {
+       
+       # Get the actual branch, in case the user logged is KohaAdmin use the 
syspreference defaultBranch
+       my $data = borrdata('',$borrowernumber);
+       if ($data->{'branchcode'}) {
+               $search{'branch'} = $data->{'branchcode'};      
+       } else {
+               $search{'branch'} = C4::Context->preference("defaultBranch");
+       }
+
+       my $startfrom = $cgi->param('startfrom');
+       unless ($startfrom) { $startfrom = 0;} 
+
+       my $countshow = 10;
+
+       # do the searchs ....
+       my ($count, @results) = catalogsearch3(\%search, $countshow, 
$startfrom);
+
+       #process the results and find the items for each biblionumber
+       my $number = $startfrom + 1;
+       my $color = 1;
+       foreach my $biblio (@results) {
+               my @items = &ItemInfo(undef, $biblio->{'biblionumber'});
+               $biblio->{"items"} = address@hidden;
+               $biblio->{"color"} = $color = not $color;
+               $biblio->{"number"} = $number++;
+       }
+
+       $template->param(dosearch => 1);
+       $template->param(result_count => $count, results => address@hidden);
+       
+       #calculate if is necessary show the arrows to navigate throgth the 
results
+       if ($startfrom + $countshow < $count ) {
+               $template->param(displaynext => 1, nextstartfrom => $startfrom 
+ $countshow);
+       } 
+       if ($startfrom > $countshow - 1) {
+               $template->param(displayprev => 1, prevstartfrom => $startfrom 
- $countshow);
+       }
+
+} else {
+       
+       #show the item types
+       my ($itemtypecount,@itemtypes)= C4::Biblio::getitemtypes();
+       $template->param(itemtype => address@hidden);
+
+}
+
+output_html_with_http_headers $cgi, $cookie, $template->output;

Index: shelf-requests.pl
===================================================================
RCS file: shelf-requests.pl
diff -N shelf-requests.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ shelf-requests.pl   10 Mar 2007 01:13:51 -0000      1.1.2.1
@@ -0,0 +1,134 @@
+#!/usr/bin/perl
+#virtual shelves
+# written 09/04
+# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP 
Argentina and
+#
+# 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::BookShelves;
+use C4::Circulation::Circ2;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+
+
+use Mail::Sendmail;
+use MIME::QuotedPrint;
+use MIME::Base64;
+use Mail::RFC822::Address;
+
+my $cgi = new CGI;
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => 
"bookshelves/shelf-requests.tmpl",
+                                                       query => $cgi,
+                                                       type => "intranet",
+                                                       authnotrequired => 0,
+                                                       flagsrequired => 
{superlibrarian => 1},
+                                               });
+
+
+my $op = $cgi->param('op'); 
+
+#links the file or link with a biblionumber 
+if ($op eq "link_request") {
+
+       my $idRequest           = $cgi->param('idRequest');
+       my $shelfnumber         = $cgi->param('shelfnumber');
+       my $biblionumber        = $cgi->param('biblionumber');
+
+       my $bibdata = &bibdata($biblionumber);
+       
+       #print "content-type: text/plain \n\n " . $biblionumber . 
$bibdata->{'biblionumber'} . " ****" . $bibdata->{'title'};
+       
+       if ($bibdata->{'title'}) {
+               CatalogueShelfRequest($idRequest, $shelfnumber, $biblionumber);
+               print 
$cgi->redirect('/cgi-bin/koha/bookshelves/shelf-requests.pl');
+       } else {
+               print 
$cgi->redirect('/cgi-bin/koha/bookshelves/shelf-requests.pl?unknown_barcode=1');
  
+       }
+
+#rejects a pending file or link
+} elsif ($op eq "reject_request") {
+
+       my $idRequest = $cgi->param('idRequest');
+       RejectShelfRequest($idRequest);
+
+       my $bordata = &GetShelfRequestOwner($idRequest);
+       my $reqdata = &GetShelfRequest($idRequest);
+
+       #build and send email
+       if ($bordata->{'emailaddress'}) {
+               
+               my $from = C4::Context->preference('TechnicalServicesMail');
+               my %mail;
+               $mail{'to'} =  $bordata->{'emailaddress'};
+               $mail{'from'} = $from;
+
+               my $template = 
gettemplate("bookshelves/mail_request_REJECTED.tmpl","intranet");
+
+               $template->param(request_name   => $reqdata->{'request_name'});
+               $template->param(shelfname              => 
$reqdata->{'shelfname'});
+
+               # Getting template result
+               my $template_res = $template->output();
+
+               # Analysing information and getting mail properties
+               if ($template_res =~ /§SUBJECT§\n(.*)\n§END_SUBJECT§/s) { 
+                       $mail{'subject'} = $1; 
+               }
+
+               my $email_header = "";
+               if ($template_res =~ /§HEADER§\n(.*)\n§END_HEADER§/s) { 
+                       $email_header = $1; 
+               }
+
+               if ($template_res =~ /§MESSAGE§\n(.*)\n§END_MESSAGE§/s) { 
$mail{'body'} = $1; }
+
+               $mail{'content-type'} = "text/plain";
+               $mail{'charset'} = "iso-8859-1n";
+               $mail{'Content-Transfer-Encoding'} = "quoted-printable";
+
+               $email_header = encode_qp($email_header);
+
+               # Writing mail
+               $mail{'body'} = "$email_header \n$mail{'body'}";
+               sendmail(%mail);
+
+       }
+
+       print $cgi->redirect('/cgi-bin/koha/bookshelves/shelf-requests.pl');
+
+#shows all links and files in an specific state 
+} else {
+
+       my $status = $cgi->param('status');
+       my $request_type = $cgi->param('request_type');
+       $status = "PENDING" if (!$status);
+       my $requests = &GetShelfRequests(undef, $status, $request_type);
+       $template->param(requests => $requests); 
+       $template->param(explore => 1); 
+       $template->param($status => 1); 
+       $template->param($request_type => 1);   
+       $template->param(unknown_barcode => $cgi->param('unknown_barcode'));
+}
+
+output_html_with_http_headers $cgi, $cookie, $template->output;

Index: shelves.pl
===================================================================
RCS file: shelves.pl
diff -N shelves.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ shelves.pl  10 Mar 2007 01:13:51 -0000      1.1.2.1
@@ -0,0 +1,189 @@
+#!/usr/bin/perl
+
+#virtual shelves -modified by TG 22/09/05
+# written 09/04
+# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP 
Argentina and
+#
+# 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::BookShelves;
+use C4::Circulation::Circ2;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+use C4::AcademicInfo;
+use C4::Members;
+my $cgi = new CGI;
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "bookshelves/shelves.tmpl",
+                                                       query => $cgi,
+                                                       type => "intranet",
+                                                       authnotrequired => 0,
+                                                       flagsrequired => 
{catalogue => 1},
+                                               });
+
+#Collect the params into a hash
+my %params;
+foreach my $paramname ($cgi->param) {
+       $params{$paramname} = $cgi->param($paramname); 
+}
+
+#Gets all educational institutions
+my @institutions = &get_educational_institutions();
+foreach my $row (@institutions) {
+       if ($params{'id_institution'} == $row->{'id_institution'}) {
+               $row->{'selected'} = 1;
+       }
+}
+$template->param(institutions => address@hidden);
+
+#get the faculty description for each educational institution, and select the 
current if there is one
+       my @institutions_c = &get_careers_by_institution();
+       foreach my $row (@institutions_c) {
+               if ($row->{'id_institution'} == $params{'id_institution'}) {
+                       $row->{'selected'} = 1;
+               }
+       }
+$template->param(institutions_c => address@hidden);
+
+#get the shelf information
+if ($params{'shelfnumber'}) {
+       my $data = &GetShelfInfo($params{'shelfnumber'}, $loggedinuser);
+       $params{'canmanage'} = $data->{'canmanage'};
+       if ($data->{'category'} == 1) {$params{'private'} = 1;} else 
{$params{'public'} = 1;}
+       #get the information about the careers with the shelf is associated 
+       my @actuals_careers;
+       foreach my $id_career (@{$data->{'careers'}}) {
+               my $info = &get_career($id_career);
+               push @actuals_careers, $info;
+       }
+       $template->param(actual_careers => address@hidden);
+       $template->param(shelfname => $data->{'shelfname'});
+}
+
+my @messages;
+#check the param op to know what operation the user request
+if ($params{'op'} eq 'add_form') {
+
+       $template->param($params{'op'} => 1);
+
+       #is a modification
+       if ($params{'shelfnumber'}) {
+               $params{'op'} = 'edit';
+       #is a new shelf
+       } else {
+               $params{'op'} = 'add';
+       }
+
+       #get the user information and determine if her/him can make public shelf
+       my $data = borrdata(undef, $loggedinuser);
+       my $borrcat = getborrowercategoryinfo($data->{'categorycode'});
+       $params{'make_public_shelves'} = $borrcat->{'canmakepublicshelves'};
+if ($params{'make_public_shelves'}){
+$params{'canmanage'}=1;
+}
+
+#try to add a new shelf or edit one
+} elsif ( ($params{'op'} eq 'add') ||  ($params{'op'} eq 'edit') )  {
+
+       my @careers = $cgi->param('careers');
+       my $shelfnumber;
+       
+       if ($params{'op'} eq 'add') {
+               $shelfnumber = AddShelfExt($params{'shelfname'},$loggedinuser, 
$params{'category'},address@hidden);
+       } else {
+               $shelfnumber = EditShelfExt($params{'shelfnumber'}, 
$params{'shelfname'}, $params{'category'},address@hidden);
+       }
+
+       if ($shelfnumber) {
+               print 
$cgi->redirect("/cgi-bin/koha/bookshelves/shelves.pl?id_institution=$params{'id_institution'}");
+       } else {
+               $template->param(add_form => 1);
+               my %msg;
+               $msg{'duplicated_name'} = 1;
+               push @messages, \%msg;
+               $template->param(messages => address@hidden);
+       }
+
+#delete shelfs
+} elsif ($params{'op'} eq 'del') {
+
+       my @shelfnumber = $cgi->param('shelfnumber');
+       foreach my $num (@shelfnumber) {
+               RemoveShelfExt($num);   
+       }
+       print 
$cgi->redirect("/cgi-bin/koha/bookshelves/shelves.pl?id_institution=$params{'id_institution'}");
+
+} elsif ($params{'op'} eq 'viewcontent') {
+
+       $params{'viewshelfcontent'} = 1;        
+       my $content = GetShelfContentsExt($params{'shelfnumber'});
+       $template->param(content => $content);
+
+} elsif ($params{'op'} eq 'del_items') {
+
+       my @biblionumber = $cgi->param('biblionumber');
+       foreach my $bibnum (@biblionumber) {
+               RemoveFromShelfExt($bibnum, $params{'shelfnumber'});
+       }
+       print 
$cgi->redirect("/cgi-bin/koha/bookshelves/shelves.pl?op=viewcontent&shelfnumber=$params{'shelfnumber'}&id_institution=$params{'id_institution'}");
+
+} elsif ($params{'op'} eq 'add_biblio') {
+
+       my $biblionumber        = $cgi->param('biblionumber');
+       my $bibdata = &bibdata($biblionumber);
+
+       if ($bibdata->{'title'}) {
+               my $shelfnumber = $cgi->param('shelfnumber');
+               AddToShelfExt($params{'biblionumber'}, $shelfnumber);
+               print 
$cgi->redirect("/cgi-bin/koha/bookshelves/shelves.pl?op=viewcontent&shelfnumber=$params{'shelfnumber'}");
         
+       } else {
+               print 
$cgi->redirect("/cgi-bin/koha/bookshelves/shelves.pl?op=viewcontent&shelfnumber=$params{'shelfnumber'}&unknown_biblio=1");
                
+       }
+
+} else {
+
+       $params{'viewshelfs'} = 1;      
+
+       my @inst = &get_educational_institutions();
+       my @filtered_inst;
+       foreach my $row (@inst) {
+               my ($total_shelves, $careers_shelves) = 
GetShelfListExt($loggedinuser, 2, $row->{'id_institution'}, 1);
+               $row->{'careers_shelves'} = $careers_shelves;
+               $row->{'total_shelves'} = $total_shelves;
+               if ($row->{'id_institution'} == $params{'id_institution'} ) {
+                       $row->{'selected'} = 1;
+               }
+               if ($total_shelves != 0) {
+                       push @filtered_inst, $row;
+               }
+       }
+
+       $template->param(institutions => address@hidden);
+       $template->param(biblionumber => $params{'biblionumber'});
+
+
+}
+
+$template->param(%params);
+
+output_html_with_http_headers $cgi, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]