[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha acqui/select-late.pl admin/biblios_framewo...
From: |
paul poulain |
Subject: |
[Koha-cvs] koha acqui/select-late.pl admin/biblios_framewo... |
Date: |
Fri, 09 Mar 2007 14:44:21 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: paul poulain <tipaul> 07/03/09 14:44:21
Removed files:
acqui : select-late.pl
admin : biblios_framework.pl
biblios_subfields_structure.pl
bibliostagstructure.pl
holdings_subfields_structure.pl
holdingstagstructure.pl institutions-careers.pl
koha_attr.pl koha-electronic.pl koha-news.pl
stopwords.pl viewlog.pl
Log message:
rel_3_0 moved to HEAD
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/select-late.pl?cvsroot=koha&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/biblios_framework.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/biblios_subfields_structure.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/bibliostagstructure.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/holdings_subfields_structure.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/holdingstagstructure.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/institutions-careers.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/koha_attr.pl?cvsroot=koha&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/koha-electronic.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/koha-news.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/stopwords.pl?cvsroot=koha&r1=1.16&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/admin/viewlog.pl?cvsroot=koha&r1=1.4&r2=0
Patches:
Index: acqui/select-late.pl
===================================================================
RCS file: acqui/select-late.pl
diff -N acqui/select-late.pl
--- acqui/select-late.pl 20 Sep 2006 21:44:36 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,102 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: select-late.pl,v 1.4 2006/09/20 21:44:36 tgarip1957 Exp $
-
-#script to show suppliers and orders
-#written by address@hidden 23/2/2000
-
-
-# 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::Auth;
-use C4::Biblio;
-use CGI;
-use C4::Interface::CGI::Output;
-use C4::Context;
-use C4::Date;
-use C4::Acquisition;
-
-my $query=new CGI;
-my $dbh = C4::Context->dbh;
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "acqui/select-late.tmpl",
- query => $query,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {acquisition => 1},
- debug => 1,
- });
-
-my $supplier=$query->param('id');
-my @suppliers=GetBookSeller($supplier);
-my $count = scalar @suppliers;
-
-my $sth = $dbh->prepare("select s.serialseq from serial s, subscription u
where s.subscriptionid = u.subscriptionid and u.aqbooksellerid = ? and s.status
= 2");
-
-$sth->execute($supplier);
-my @final;
-while (my $sol = $sth->fetchrow_hashref)
-{
- push @final, $sol;
-}
-
-$template->param(@loop_sol => address@hidden);
-
-my $colour='#EEEEEE';
-my $toggle=0;
-my @loop_suppliers;
-for (my $i=0; $i<$count; $i++) {
- my $orders = GetPendingOrders($suppliers[$i]->{'id'});
- my $ordcount = scalar @$orders;
-
- my %line;
- if ($toggle==0){
- $line{color}='#EEEEEE';
- $toggle=1;
- } else {
- $line{color}='white';
- $toggle=0;
- }
- $line{id} =$suppliers[$i]->{'id'};
- $line{name} = $suppliers[$i]->{'name'};
- $line{active} = $suppliers[$i]->{'active'};
- $line{total} = $orders->[0]->{'count(*)'};
- $line{authorisedby} = $orders->[0]->{'authorisedby'};
- $line{entrydate} = $orders->[0]->{'entrydate'};
- my @loop_basket;
- for (my $i2=0;$i2<$ordcount;$i2++){
- my %inner_line;
- $inner_line{basketno} =$orders->[$i2]->{'basketno'};
- $inner_line{total} =$orders->[$i2]->{'count(*)'};
- $inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'};
- $inner_line{entrydate} =
format_date($orders->[$i2]->{'entrydate'});
- push @loop_basket, \%inner_line;
- }
- $line{loop_basket} = address@hidden;
- push @loop_suppliers, \%line;
-}
-$template->param(loop_suppliers => address@hidden,
- supplier => $supplier,
- count => $count,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-
-output_html_with_http_headers $query, $cookie, $template->output;
Index: admin/biblios_framework.pl
===================================================================
RCS file: admin/biblios_framework.pl
diff -N admin/biblios_framework.pl
--- admin/biblios_framework.pl 1 Sep 2006 22:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-#!/usr/bin/perl
-# NOTE: 4-character tabs
-
-#written 20/02/2002 by address@hidden
-# This software is placed under the gnu General Public License, v2
(http://www.gnu.org/licenses/gpl.html)
-
-# 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 CGI;
-use C4::Context;
-use C4::Output;
-use C4::Search;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-
-
-sub StringSearch {
- my ($env,$searchstring,$type)address@hidden;
- my $dbh = C4::Context->dbh;
- $searchstring=~ s/\'/\\\'/g;
- my @data=split(' ',$searchstring);
- my address@hidden;
- my $sth=$dbh->prepare("Select * from biblios_framework where
(frameworkcode like ?) order by frameworktext");
- $sth->execute("$data[0]%");
- my @results;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- }
- # $sth->execute;
- $sth->finish;
- return (scalar(@results),address@hidden);
-}
-
-my $input = new CGI;
-my $searchfield=$input->param('frameworkcode');
-my $offset=$input->param('offset');
-my $script_name="/cgi-bin/koha/admin/biblios_framework.pl";
-my $frameworkcode=$input->param('frameworkcode');
-my $pagesize=20;
-my $op = $input->param('op');
-$searchfield=~ s/\,//g;
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "admin/biblios_framework.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-if ($op) {
-$template->param(script_name => $script_name,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-
-
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- #start the page and read in includes
- #---- if primkey exists, it's a modify action, so read values to
modify...
- my $data;
- if ($frameworkcode) {
- my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select * from biblios_framework where
frameworkcode=?");
- $sth->execute($frameworkcode);
- $data=$sth->fetchrow_hashref;
- $sth->finish;
- }
- $template->param(frameworkcode => $frameworkcode,
- frameworktext =>
$data->{'frameworktext'},
- );
-;
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
- my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("replace biblios_framework
(frameworkcode,frameworktext) values (?,?)");
-
$sth->execute($input->param('frameworkcode'),$input->param('frameworktext'));
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=biblios_framework.pl\"></html>";
- exit;
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- #start the page and read in includes
- my $dbh = C4::Context->dbh;
-
- # Check both categoryitem and biblioitems, see Bug 199
- my $total = 0;
- for my $table ('biblios_tag_structure') {
- my $sth=$dbh->prepare("select count(*) as total from $table where
frameworkcode=?");
- $sth->execute($frameworkcode);
- $total += $sth->fetchrow_hashref->{total};
- $sth->finish;
- }
-
- my $sth=$dbh->prepare("select * from biblios_framework where
frameworkcode=?");
- $sth->execute($frameworkcode);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
-
- $template->param(frameworkcode => $frameworkcode,
- frameworktext =>
$data->{'frameworktext'},
- total => $total);
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
- #start the page and read in includes
- my $dbh = C4::Context->dbh;
- my $frameworkcode=uc($input->param('frameworkcode'));
- my $sth=$dbh->prepare("delete from biblios_tag_structure where
frameworkcode=?");
- $sth->execute($frameworkcode);
- $sth=$dbh->prepare("delete from biblios_subfield_structure where
frameworkcode=?");
- $sth->execute($frameworkcode);
- $sth=$dbh->prepare("delete from biblios_framework where
frameworkcode=?");
- $sth->execute($frameworkcode);
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=biblios_framework.pl\"></html>";
- exit;
-
# END $OP eq DELETE_CONFIRMED
-################## DEFAULT ##################################
-} else { # DEFAULT
- my $env;
- my ($count,$results)=StringSearch($env,$searchfield,'web');
- my $toggle="white";
- my @loop_data;
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- my %row_data;
- if ($toggle eq 'white'){
- $row_data{toggle}="#ffffcc";
- } else {
- $row_data{toggle}="white";
- }
- $row_data{frameworkcode} = $results->[$i]{'frameworkcode'};
- $row_data{frameworktext} = $results->[$i]{'frameworktext'};
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(previous => "$script_name?offset=".$prevpage);
- }
- if ($offset+$pagesize<$count) {
- my $nextpage =$offset+$pagesize;
- $template->param(next => "$script_name?offset=".$nextpage);
- }
-} #---- END $OP eq DEFAULT
-output_html_with_http_headers $input, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 4
-# End:
Index: admin/biblios_subfields_structure.pl
===================================================================
RCS file: admin/biblios_subfields_structure.pl
diff -N admin/biblios_subfields_structure.pl
--- admin/biblios_subfields_structure.pl 1 Sep 2006 22:03:00 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,467 +0,0 @@
-#!/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
-
-use strict;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Auth;
-use CGI;
-use C4::Search;
-use C4::Context;
-
-sub StringSearch {
- my ($env,$searchstring,$frameworkcode)address@hidden;
- my $dbh = C4::Context->dbh;
- $searchstring=~ s/\'/\\\'/g;
- my @data=split(' ',$searchstring);
- my address@hidden;
- my $sth=$dbh->prepare("Select * from biblios_subfield_structure where
(tagfield like ? and frameworkcode=?) order by tagfield");
- $sth->execute("$searchstring%",$frameworkcode);
- my @results;
- my $cnt=0;
- my $u=1;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- $cnt ++;
- $u++;
- }
- $sth->finish;
- $dbh->disconnect;
- return ($cnt,address@hidden);
-}
-
-my $input = new CGI;
-my $tagfield=$input->param('tagfield');
-my $tagsubfield=$input->param('tagsubfield');
-my $frameworkcode=$input->param('frameworkcode');
-my $pkfield="tagfield";
-my $offset=$input->param('offset');
-my $script_name="/cgi-bin/koha/admin/biblios_subfields_structure.pl";
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name =>
"admin/biblios_subfields_structure.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-my $pagesize=30;
-my $op = $input->param('op');
-$tagfield=~ s/\,//g;
-
-if ($op) {
-$template->param(script_name => $script_name,
- tagfield =>$tagfield,
- frameworkcode => $frameworkcode,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- tagfield =>$tagfield,
- frameworkcode => $frameworkcode,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- my $data;
- my $dbh = C4::Context->dbh;
- my $more_subfields = $input->param("more_subfields")+1;
-
-
- # build authorised value list
-
-my $sth2 = $dbh->prepare("select distinct category from
authorised_values");
- $sth2->execute;
- my @authorised_values;
- push @authorised_values,"";
- while ((my $category) = $sth2->fetchrow_array) {
- push @authorised_values, $category;
- }
- push (@authorised_values,"branches");
- push (@authorised_values,"itemtypes");
- # build thesaurus categories list
- $sth2->finish;
- $sth2 = $dbh->prepare("select authtypecode from auth_types");
- $sth2->execute;
- my @authtypes;
- push @authtypes,"";
- while ((my $authtypecode) = $sth2->fetchrow_array) {
- push @authtypes, $authtypecode;
- }
- # build value_builder list
- my @value_builder=('');
-
- # read value_builder directory.
- # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin
- # on a standard install, /cgi-bin need to be added.
- # test one, then the other
- my $cgidir = C4::Context->intranetdir ."/cgi-bin";
- unless (opendir(DIR, "$cgidir/value_builder")) {
- $cgidir = C4::Context->intranetdir;
- opendir(DIR, "$cgidir/value_builder") || die "can't opendir
$cgidir/value_builder: $!";
- }
- while (my $line = readdir(DIR)) {
- if ($line =~ /\.pl$/) {
- push (@value_builder,$line);
- }
- }
- closedir DIR;
-
- # build values list
- my $sth=$dbh->prepare("select * from biblios_subfield_structure where
tagfield=? and frameworkcode=?"); # and tagsubfield='$tagsubfield'");
- $sth->execute($tagfield,$frameworkcode);
- my @loop_data = ();
- my $toggle=1;
- my $i=0;
- while ($data =$sth->fetchrow_hashref) {
- my %row_data; # get a fresh hash for the row data
- if ($toggle eq 1){
- $toggle=0;
- } else {
- $toggle=1;
- }
- $row_data{tab} = CGI::scrolling_list(-name=>'tab',
- -id=>"tab$i",
-
-values=>['-1','0','1','2','3','4','5','6','7','8','9'],
- -labels => {'-1'
=>'ignore','0'=>'0','1'=>'1','2' =>'2','3'=>'3','4'=>'4',
- '5'
=>'5','6'=>'6','7'=>'7',
- '8'
=>'8','9'=>'9',},
- -default=>$data->{'tab'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
- -id=>"ohidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show',
- '2'
=>'Hide',
- },
- -default=>substr($data->{'hidden'},0,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
- -id=>"ihidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show',
- '2'
=>'Hide',
- },
- -default=>substr($data->{'hidden'},1,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
- -id=>"ehidden$i",
- -values=>['0','1','2'],
- -labels => {'0'=>'Show','1'=>'Show
Collapsed',
- '2'
=>'Hide',
- },
- -default=>substr($data->{'hidden'},2,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{tagsubfield} =$data->{'tagsubfield'}."<input
type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\"
id=\"tagsubfield\">";
- $row_data{liblibrarian} =
CGI::escapeHTML($data->{'liblibrarian'});
- $row_data{libopac} = CGI::escapeHTML($data->{'libopac'});
- $row_data{seealso} = CGI::escapeHTML($data->{'seealso'});
-
- $row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
- -id=>'authorised_value',
- -values=> address@hidden,
- -default=>$data->{'authorised_value'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{value_builder} =
CGI::scrolling_list(-name=>'value_builder',
- -id=>'value_builder',
- -values=> address@hidden,
- -default=>$data->{'value_builder'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{authtypes} =
CGI::scrolling_list(-name=>'authtypecode',
- -id=>'authtypecode',
- -values=> address@hidden,
- -default=>$data->{'authtypecode'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
- -checked => $data->{'repeatable'}?'checked':'',
- -value => 1,
- -label => '',
- -id => "repeatable$i");
- $row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
- -checked => $data->{'mandatory'}?'checked':'',
- -value => 1,
- -label => '',
- -id => "mandatory$i");
- $row_data{hidden} = CGI::escapeHTML($data->{hidden});
- $row_data{isurl} = CGI::checkbox( -name => "isurl$i",
- -id => "isurl$i",
- -checked => $data->{'isurl'}?'checked':'',
- -value => 1,
- -label => '');
- $row_data{row} = $i;
- $row_data{toggle} = $toggle;
- $row_data{link} = CGI::escapeHTML($data->{'link'});
- push(@loop_data, \%row_data);
- $i++;
- }
- # add more_subfields empty lines for add if needed
- for (my $i=1;$i<=$more_subfields;$i++) {
- my %row_data; # get a fresh hash for the row data
- $row_data{tab} = CGI::scrolling_list(-name=>'tab',
- -id => "tab$i",
-
-values=>['-1','0','1','2','3','4','5','6','7','8','9'],
- -labels => {'-1'
=>'ignore','0'=>'0','1'=>'1',
- '2'
=>'2','3'=>'3','4'=>'4',
- '5'
=>'5','6'=>'6','7'=>'7',
- '8'
=>'8','9'=>'9',
- },
- -default=>"",
- -size=>1,
- -multiple=>0,
- );
- $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
- -id=>"ohidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
-
- $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
- -id=>"ihidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
- $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
- -id=>"ehidden$i",
- -values=>['0','1','2'],
- -labels => {'0'=>'Show','1'=>'Show
Collapsed',
- '2'
=>'Hide',
- },
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
- $row_data{tagsubfield} = "<input type=\"text\"
name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\"
id=\"tagsubfield\" maxlength=\"1\">";
- $row_data{liblibrarian} = "";
- $row_data{libopac} = "";
- $row_data{seealso} = "";
- $row_data{hidden} = "000";
- $row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
- -id => "repeatable$i",
- -checked => '',
- -value => 1,
- -label => '');
- $row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
- -id => "mandatory$i",
- -checked => '',
- -value => 1,
- -label => '');
- $row_data{isurl} = CGI::checkbox(-name => 'isurl',
- -id => "isurl$i",
- -checked => '',
- -value => 1,
- -label => '');
-
- $row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
- -id => 'authorised_value',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- );
- $row_data{authtypes} =
CGI::scrolling_list(-name=>'authtypecode',
- -id => 'authtypecode',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- );
- $row_data{link} = CGI::escapeHTML($data->{'link'});
- $row_data{toggle} = $toggle;
- $row_data{row} = $i;
- push(@loop_data, \%row_data);
- }
- $template->param('use-heading-flags-p' => 1);
- $template->param('heading-edit-subfields-p' => 1);
- $template->param(action => "Edit subfields",
- tagfield => "<input
type=\"hidden\" name=\"tagfield\" value=\"$tagfield\">$tagfield",
- loop => address@hidden,
- more_subfields =>
$more_subfields,
- more_tag => $tagfield);
-
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
- my $dbh = C4::Context->dbh;
- $template->param(tagfield => "$input->param('tagfield')");
- my $sth=$dbh->prepare("replace biblios_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode,
link)
- values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- my @tagsubfield = $input->param('tagsubfield');
- my @liblibrarian = $input->param('liblibrarian');
- my @libopac = $input->param('libopac');
-
- my @tab = $input->param('tab');
- my @seealso = $input->param('seealso');
-# my @hidden = $input->param('hidden');
- my @hidden;
- my @ohidden = $input->param('ohidden');
- my @ihidden = $input->param('ihidden');
- my @ehidden = $input->param('ehidden');
- my @authorised_values = $input->param('authorised_value');
- my @authtypecodes = $input->param('authtypecode');
- my @value_builder =$input->param('value_builder');
- my @link =$input->param('link');
- for (my $i=0; $i<= $#tagsubfield ; $i++) {
- my $tagfield =$input->param('tagfield');
- my $tagsubfield =$tagsubfield[$i];
- $tagsubfield="@" unless $tagsubfield ne '';
- my $liblibrarian =$liblibrarian[$i];
- my $libopac =$libopac[$i];
- my $repeatable =$input->param("repeatable$i")?1:0;
- my $mandatory =$input->param("mandatory$i")?1:0;
-
- my $tab =$tab[$i];
- my $seealso =$seealso[$i];
- my $authorised_value =$authorised_values[$i];
- my $authtypecode =$authtypecodes[$i];
- my $value_builder=$value_builder[$i];
- my $hidden = $ohidden[$i].$ihidden[$i].$ehidden[$i]; #collate
from 3 hiddens;
- my $isurl = $input->param("isurl$i")?1:0;
- my $link = $link[$i];
- if ($liblibrarian) {
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute ($tagfield,
-
$tagsubfield,
-
$liblibrarian,
-
$libopac,
-
$repeatable,
-
$mandatory,
-
- $tab,
-
$seealso,
-
$authorised_value,
-
$authtypecode,
-
$value_builder,
- $hidden,
- $isurl,
-
$frameworkcode,
-
- $link,
- );
- }
- }
- }
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=biblios_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
-
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select * from biblios_subfield_structure where
tagfield=? and tagsubfield=? and frameworkcode=?");
- #FIXME : called with 2 bind variables when 3 are needed
- $sth->execute($tagfield,$tagsubfield);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- $template->param(liblibrarian => $data->{'liblibrarian'},
- tagsubfield =>
$data->{'tagsubfield'},
- delete_link =>
$script_name,
- tagfield
=>$tagfield,
- tagsubfield =>
$tagsubfield,
- frameworkcode =>
$frameworkcode,
- );
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
- my $dbh = C4::Context->dbh;
- unless (C4::Context->config('demo') eq 1) {
- my $sth=$dbh->prepare("delete from biblios_subfield_structure
where tagfield=? and tagsubfield=? and frameworkcode=?");
- $sth->execute($tagfield,$tagsubfield,$frameworkcode);
- $sth->finish;
- }
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=biblios_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
- $template->param(tagfield => $tagfield);
-
# END $OP eq DELETE_CONFIRMED
-################## DEFAULT ##################################
-} else { # DEFAULT
- my $env;
- my ($count,$results)=StringSearch($env,$tagfield,$frameworkcode);
- my $toggle=1;
- my @loop_data = ();
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 1){
- $toggle=0;
- } else {
- $toggle=1;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results->[$i]{'tagfield'};
- $row_data{tagsubfield} = $results->[$i]{'tagsubfield'};
- $row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
- $row_data{repeatable} = $results->[$i]{'repeatable'};
- $row_data{mandatory} = $results->[$i]{'mandatory'};
- $row_data{tab} = $results->[$i]{'tab'};
- $row_data{seealso} = $results->[$i]{'seealso'};
- $row_data{authorised_value} =
$results->[$i]{'authorised_value'};
- $row_data{authtypecode} = $results->[$i]{'authtypecode'};
- $row_data{value_builder} =
$results->[$i]{'value_builder'};
- $row_data{hidden} = $results->[$i]{'hidden'}
if($results->[$i]{'hidden'} gt "000") ;
- $row_data{isurl} = $results->[$i]{'isurl'};
- $row_data{link} = $results->[$i]{'link'};
- $row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&frameworkcode=$frameworkcode";
- $row_data{toggle} = $toggle;
- if ($row_data{tab} eq -1) {
- $row_data{subfield_ignored} = 1;
- }
-
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- $template->param(edit_tagfield => $tagfield,
- edit_frameworkcode => $frameworkcode);
-
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(prev =>"<a
href=\"$script_name?offset=$prevpage\">");
- }
- if ($offset+$pagesize<$count) {
- my $nextpage =$offset+$pagesize;
- $template->param(next => "<a
href=\"$script_name?offset=$nextpage\">");
- }
-} #---- END $OP eq DEFAULT
-$template->param(intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-output_html_with_http_headers $input, $cookie, $template->output;
Index: admin/bibliostagstructure.pl
===================================================================
RCS file: admin/bibliostagstructure.pl
diff -N admin/bibliostagstructure.pl
--- admin/bibliostagstructure.pl 1 Sep 2006 22:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,397 +0,0 @@
-#!/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
-
-use strict;
-use CGI;
-use C4::Auth;
-use C4::Koha;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Search;
-
-
-# retrieve parameters
-my $input = new CGI;
-my $frameworkcode = $input->param('frameworkcode'); # set to select framework
-$frameworkcode="" unless $frameworkcode;
-my $existingframeworkcode = $input->param('existingframeworkcode'); # set when
we have to create a new framework (in frameworkcode) by copying an old one (in
existingframeworkcode)
-$existingframeworkcode = "" unless $existingframeworkcode;
-my $frameworkinfo = getframeworkinfo($frameworkcode);
-my $searchfield=$input->param('searchfield');
-$searchfield=0 unless $searchfield;
-$searchfield=~ s/\,//g;
-
-my $offset=$input->param('offset');
-my $op = $input->param('op');
-my $dspchoice = $input->param('select_display');
-my $pagesize=20;
-
-my $script_name="/cgi-bin/koha/admin/bibliostagstructure.pl";
-
-my $dbh = C4::Context->dbh;
-
-# open template
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/bibliostagstructure.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-# get framework list
-my $frameworks = getframeworks();
-my @frameworkloop;
-foreach my $thisframeworkcode (keys %$frameworks) {
- my $selected = 1 if $thisframeworkcode eq $frameworkcode;
- my %row =(value => $thisframeworkcode,
- selected => $selected,
- frameworktext =>
$frameworks->{$thisframeworkcode}->{'frameworktext'},
- );
- push @frameworkloop, \%row;
-}
-
-# check that framework is defined in biblios_tag_structure
-my $sth=$dbh->prepare("select count(*) from biblios_tag_structure where
frameworkcode=?");
-$sth->execute($frameworkcode);
-my ($frameworkexist) = $sth->fetchrow;
-if ($frameworkexist) {
-} else {
- # if frameworkcode does not exists, then OP must be changed to "create
framework" if we are not on the way to create it
- # (op = itemtyp_create_confirm)
- if ($op eq "framework_create_confirm") {
- duplicate_framework($frameworkcode, $existingframeworkcode);
- $op=""; # unset $op to go back to framework list
- } else {
- $op = "framework_create";
- }
-}
-$template->param(frameworkloop => address@hidden,
- frameworkcode => $frameworkcode,
- frameworktext =>
$frameworkinfo->{frameworktext});
-if ($op) {
-$template->param(script_name => $script_name,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- #---- if primkey exists, it's a modify action, so read values to
modify...
- my $data;
- if ($searchfield) {
- $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
biblios_tag_structure where tagfield=? and frameworkcode=?");
- $sth->execute($searchfield,$frameworkcode);
- $data=$sth->fetchrow_hashref;
- $sth->finish;
- }
- my $sth = $dbh->prepare("select distinct category from
authorised_values");
- $sth->execute;
- my @authorised_values;
- push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $authorised_value = CGI::scrolling_list(-name=>'authorised_value',
- -values=> address@hidden,
- -size=>1,
- -id=>"authorised_value",
- -multiple=>0,
- -default => $data->{'authorised_value'},
- );
-
- if ($searchfield) {
- $template->param(action => "Modify tag",
- searchfield =>
"<input type=\"hidden\" name=\"tagfield\" value=\"$searchfield\"
/>$searchfield");
- $template->param('heading-modify-tag-p' => 1);
- } else {
- $template->param(action => "Add tag",
- searchfield =>
"<input type=\"text\" name=\"tagfield\" size=\"5\" maxlength=\"3\" />");
- $template->param('heading-add-tag-p' => 1);
- }
- $template->param('use-heading-flags-p' => 1);
- $template->param(liblibrarian => $data->{'liblibrarian'},
- libopac => $data->{'libopac'},
- repeatable => CGI::checkbox(-name=>'repeatable',
- -checked=>
$data->{'repeatable'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'repeatable'),
- mandatory => CGI::checkbox(-name => 'mandatory',
- -checked =>
$data->{'mandatory'}?'checked':'',
- -value => 1,
- -label => '',
- -id => 'mandatory'),
- authorised_value => $authorised_value,
- frameworkcode => $frameworkcode,
- );
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
- $sth=$dbh->prepare("replace biblios_tag_structure
(tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode)
values (?,?,?,?,?,?,?)");
- my $tagfield =$input->param('tagfield');
- my $liblibrarian = $input->param('liblibrarian');
- my $libopac =$input->param('libopac');
- my $repeatable =$input->param('repeatable');
- my $mandatory =$input->param('mandatory');
- my $authorised_value =$input->param('authorised_value');
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute($tagfield,
- $liblibrarian,
- $libopac,
- $repeatable?1:0,
- $mandatory?1:0,
- $authorised_value,
- $frameworkcode
- );
- }
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=bibliostagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
biblios_tag_structure where tagfield=? and frameworkcode=?");
- $sth->execute($searchfield,$frameworkcode);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- $template->param(liblibrarian => $data->{'liblibrarian'},
- searchfield =>
$searchfield,
- frameworkcode =>
$frameworkcode,
- );
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
- unless (C4::Context->config('demo') eq 1) {
- $dbh->do("delete from biblios_tag_structure where
tagfield='$searchfield' and frameworkcode='$frameworkcode'");
- $dbh->do("delete from biblios_subfield_structure where
tagfield='$searchfield' and frameworkcode='$frameworkcode'");
-
- }
-
# END $OP eq DELETE_CONFIRMED
-################## ITEMTYPE_CREATE ##################################
-# called automatically if an unexisting frameworkis selected
-} elsif ($op eq 'framework_create') {
- $sth = $dbh->prepare("select
count(*),biblios_tag_structure.frameworkcode,frameworktext from
biblios_tag_structure,biblios_framework where
biblios_framework.frameworkcode=biblios_tag_structure.frameworkcode group by
biblios_tag_structure.frameworkcode");
- $sth->execute;
- my @existingframeworkloop;
- while (my ($tot,$thisframeworkcode,$frameworktext) = $sth->fetchrow) {
- if ($tot>0) {
- my %line = ( value => $thisframeworkcode,
- frameworktext => $frameworktext,
- );
- push @existingframeworkloop,\%line;
- }
- }
- $template->param(existingframeworkloop => address@hidden,
- frameworkcode => $frameworkcode,
-# FRtext =>
$frameworkinfo->{frameworktext},
- );
-################## DEFAULT ##################################
-} else { # DEFAULT
- # here, $op can be unset or set to "framework_create_confirm".
- if ($searchfield ne '') {
- $template->param(searchfield => $searchfield);
- }
- my $cnt=0;
- if ($dspchoice) {
- #here, user only wants used tags/subfields displayed
- my $env;
- $searchfield=~ s/\'/\\\'/g;
- my @data=split(' ',$searchfield);
- my $sth=$dbh->prepare("Select biblios_tag_structure.tagfield as
mts_tagfield,biblios_tag_structure.liblibrarian as
mts_liblibrarian,biblios_tag_structure.libopac as
mts_libopac,biblios_tag_structure.repeatable as
mts_repeatable,biblios_tag_structure.mandatory as
mts_mandatory,biblios_tag_structure.authorised_value as
mts_authorized_value,biblios_subfield_structure.* from biblios_tag_structure
LEFT JOIN biblios_subfield_structure ON
(biblios_tag_structure.tagfield=biblios_subfield_structure.tagfield AND
biblios_tag_structure.frameworkcode=biblios_subfield_structure.frameworkcode)
where (biblios_tag_structure.tagfield >= ? and
biblios_tag_structure.frameworkcode=?) AND biblios_subfield_structure.tab>=0
order by
biblios_tag_structure.tagfield,biblios_subfield_structure.tagsubfield");
- #could be ordoned by tab
- $sth->execute($data[0], $frameworkcode);
- my @results = ();
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- $cnt++;
- }
- $sth->finish;
-
- my $toggle=0;
- my @loop_data = ();
- my $j=1;
- my $i=$offset;
- while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results[$i]->{'mts_tagfield'};
- $row_data{liblibrarian} =
$results[$i]->{'mts_liblibrarian'};
- $row_data{repeatable} =
$results[$i]->{'mts_repeatable'};
- $row_data{mandatory} = $results[$i]->{'mts_mandatory'};
- $row_data{authorised_value} =
$results[$i]->{'mts_authorised_value'};
- $row_data{subfield_link}
="biblios_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{toggle} = $toggle;
- $j=$i;
- my @internal_loop = ();
- while
(($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j<
($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) {
- if ($toggle eq 0) {
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %subfield_data;
- $subfield_data{tagsubfield} =
$results[$j]->{'tagsubfield'};
- $subfield_data{liblibrarian} =
$results[$j]->{'liblibrarian'};
- $subfield_data{repeatable} =
$results[$j]->{'repeatable'};
- $subfield_data{mandatory} =
$results[$j]->{'mandatory'};
- $subfield_data{tab} = $results[$j]->{'tab'};
- $subfield_data{seealso} =
$results[$j]->{'seealso'};
- $subfield_data{authorised_value} =
$results[$j]->{'authorised_value'};
- $subfield_data{authtypecode}=
$results[$j]->{'authtypecode'};
- $subfield_data{value_builder}=
$results[$j]->{'value_builder'};
- $subfield_data{toggle} = $toggle;
-# warn "tagfield :
".$results[$j]->{'tagfield'}." tagsubfield :".$results[$j]->{'tagsubfield'};
- push @internal_loop,\%subfield_data;
- $j++;
- }
- $row_data{'subfields'address@hidden;
- push(@loop_data, \%row_data);
-# undef @internal_loop;
- $i=$j;
- }
- $template->param(select_display => "True",
- loop => address@hidden);
- # $sth->execute;
- $sth->finish;
- } else {
- #here, normal old style : display every tags
- my $env;
- my
($count,$results)=StringSearch($env,$searchfield,$frameworkcode);
- $cnt = $count;
- my $toggle=0;
- my @loop_data = ();
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results->[$i]{'tagfield'};
- $row_data{liblibrarian} =
$results->[$i]{'liblibrarian'};
- $row_data{repeatable} = $results->[$i]{'repeatable'};
- $row_data{mandatory} = $results->[$i]{'mandatory'};
- $row_data{authorised_value} =
$results->[$i]{'authorised_value'};
- $row_data{subfield_link}
="biblios_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{toggle} = $toggle;
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- }
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(isprevpage => $offset,
- prevpage=> $prevpage,
- searchfield => $searchfield,
- script_name => $script_name,
- frameworkcode => $frameworkcode,
- );
- }
- if ($offset+$pagesize<$cnt) {
- my $nextpage =$offset+$pagesize;
- $template->param(nextpage =>$nextpage,
- searchfield => $searchfield,
- script_name => $script_name,
- frameworkcode => $frameworkcode,
- );
- }
-} #---- END $OP eq DEFAULT
-
-$template->param(loggeninuser => $loggedinuser,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-output_html_with_http_headers $input, $cookie, $template->output;
-
-
-#
-# the sub used for searches
-#
-sub StringSearch {
- my ($env,$searchstring,$frameworkcode)address@hidden;
- my $dbh = C4::Context->dbh;
- $searchstring=~ s/\'/\\\'/g;
- my @data=split(' ',$searchstring);
- my address@hidden;
- my $sth=$dbh->prepare("Select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
biblios_tag_structure where (tagfield >= ? and frameworkcode=?) order by
tagfield");
- $sth->execute($data[0], $frameworkcode);
- my @results;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- }
- # $sth->execute;
- $sth->finish;
- return (scalar(@results),address@hidden);
-}
-
-#
-# the sub used to duplicate a framework from an existing one in MARC
parameters tables.
-#
-sub duplicate_framework {
- my ($newframeworkcode,$oldframeworkcode) = @_;
- my $sth = $dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
biblios_tag_structure where frameworkcode=?");
- $sth->execute($oldframeworkcode);
- my $sth_insert = $dbh->prepare("insert into biblios_tag_structure
(tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value,
frameworkcode) values (?,?,?,?,?,?,?)");
- while ( my
($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) =
$sth->fetchrow) {
-
$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newframeworkcode);
- }
-
- $sth = $dbh->prepare("select
frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,authtypecode,value_builder,seealso
from biblios_subfield_structure where frameworkcode=?");
- $sth->execute($oldframeworkcode);
- $sth_insert = $dbh->prepare("insert into biblios_subfield_structure
(frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,authtypecode,value_builder,seealso)
values (?,?,?,?,?,?,?,?,?,?,?,?)");
- while ( my ($frameworkcode, $tagfield, $tagsubfield, $liblibrarian,
$libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso) = $sth->fetchrow) {
- $sth_insert->execute($newframeworkcode, $tagfield, $tagsubfield,
$liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso);
- }
-
-## now the same for holdings
- $sth = $dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
holdings_tag_structure where frameworkcode=?");
- $sth->execute($oldframeworkcode);
- my $sth_insert = $dbh->prepare("insert into holdings_tag_structure
(tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value,
frameworkcode) values (?,?,?,?,?,?,?)");
- while ( my
($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) =
$sth->fetchrow) {
-
$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newframeworkcode);
- }
-
- $sth = $dbh->prepare("select
frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,authtypecode,value_builder,seealso
from holdings_subfield_structure where frameworkcode=?");
- $sth->execute($oldframeworkcode);
- $sth_insert = $dbh->prepare("insert into holdings_subfield_structure
(frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,authtypecode,value_builder,seealso)
values (?,?,?,?,?,?,?,?,?,?,?,?)");
- while ( my ($frameworkcode, $tagfield, $tagsubfield, $liblibrarian,
$libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso) = $sth->fetchrow) {
- $sth_insert->execute($newframeworkcode, $tagfield, $tagsubfield,
$liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso);
- }
-}
-
Index: admin/holdings_subfields_structure.pl
===================================================================
RCS file: admin/holdings_subfields_structure.pl
diff -N admin/holdings_subfields_structure.pl
--- admin/holdings_subfields_structure.pl 1 Sep 2006 22:03:00 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,458 +0,0 @@
-#!/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
-
-use strict;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Auth;
-use CGI;
-use C4::Search;
-use C4::Context;
-
-
-sub StringSearch {
- my ($env,$searchstring,$frameworkcode)address@hidden;
- my $dbh = C4::Context->dbh;
- $searchstring=~ s/\'/\\\'/g;
- my @data=split(' ',$searchstring);
- my address@hidden;
- my $sth=$dbh->prepare("Select * from holdings_subfield_structure where
(tagfield like ? and frameworkcode=?) order by tagfield");
- $sth->execute("$searchstring%",$frameworkcode);
- my @results;
- my $cnt=0;
- my $u=1;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- $cnt ++;
- $u++;
- }
- $sth->finish;
- $dbh->disconnect;
- return ($cnt,address@hidden);
-}
-
-my $input = new CGI;
-my $tagfield=$input->param('tagfield');
-my $tagsubfield=$input->param('tagsubfield');
-my $frameworkcode=$input->param('frameworkcode');
-my $pkfield="tagfield";
-my $offset=$input->param('offset');
-my $script_name="/cgi-bin/koha/admin/holdings_subfields_structure.pl";
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name =>
"admin/holdings_subfields_structure.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-my $pagesize=30;
-my $op = $input->param('op');
-$tagfield=~ s/\,//g;
-
-if ($op) {
-$template->param(script_name => $script_name,
- tagfield =>$tagfield,
- frameworkcode => $frameworkcode,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- tagfield =>$tagfield,
- frameworkcode => $frameworkcode,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- my $data;
- my $dbh = C4::Context->dbh;
- my $more_subfields = $input->param("more_subfields")+1;
-
-
- # build authorised value list
-
-my $sth2 = $dbh->prepare("select distinct category from
authorised_values");
- $sth2->execute;
- my @authorised_values;
- push @authorised_values,"";
- while ((my $category) = $sth2->fetchrow_array) {
- push @authorised_values, $category;
- }
- push (@authorised_values,"branches");
- push (@authorised_values,"itemtypes");
- # build thesaurus categories list
- $sth2->finish;
- $sth2 = $dbh->prepare("select authtypecode from auth_types");
- $sth2->execute;
- my @authtypes;
- push @authtypes,"";
- while ((my $authtypecode) = $sth2->fetchrow_array) {
- push @authtypes, $authtypecode;
- }
- # build value_builder list
- my @value_builder=('');
-
- # read value_builder directory.
- # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin
- # on a standard install, /cgi-bin need to be added.
- # test one, then the other
- my $cgidir = C4::Context->intranetdir ."/cgi-bin";
- unless (opendir(DIR, "$cgidir/value_builder")) {
- $cgidir = C4::Context->intranetdir;
- opendir(DIR, "$cgidir/value_builder") || die "can't opendir
$cgidir/value_builder: $!";
- }
- while (my $line = readdir(DIR)) {
- if ($line =~ /\.pl$/) {
- push (@value_builder,$line);
- }
- }
- closedir DIR;
-
- # build values list
- my $sth=$dbh->prepare("select * from holdings_subfield_structure where
tagfield=? and frameworkcode=?"); # and tagsubfield='$tagsubfield'");
- $sth->execute($tagfield,$frameworkcode);
- my @loop_data = ();
- my $toggle=1;
- my $i=0;
- while ($data =$sth->fetchrow_hashref) {
- my %row_data; # get a fresh hash for the row data
- if ($toggle eq 1){
- $toggle=0;
- } else {
- $toggle=1;
- }
- $row_data{tab} = CGI::scrolling_list(-name=>'tab',
- -id=>"tab$i",
- -values=>['-1','10'],
- -labels => {'-1'
=>'ignore','10'=>'items (10)', },
- -default=>$data->{'tab'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
- -id=>"ohidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>substr($data->{'hidden'},0,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
- -id=>"ihidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>substr($data->{'hidden'},1,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
- -id=>"ehidden$i",
- -values=>['0','1','2'],
- -labels => {'0'=>'Show','1'=>'Show
Collapsed',
- '2'
=>'Hide',
- },
- -default=>substr($data->{'hidden'},2,1),
- -size=>1,
- -multiple=>0,
- );
- $row_data{tagsubfield} =$data->{'tagsubfield'}."<input
type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\"
id=\"tagsubfield\">";
- $row_data{liblibrarian} =
CGI::escapeHTML($data->{'liblibrarian'});
- $row_data{libopac} = CGI::escapeHTML($data->{'libopac'});
- $row_data{seealso} = CGI::escapeHTML($data->{'seealso'});
-
- $row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
- -id=>'authorised_value',
- -values=> address@hidden,
- -default=>$data->{'authorised_value'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{value_builder} =
CGI::scrolling_list(-name=>'value_builder',
- -id=>'value_builder',
- -values=> address@hidden,
- -default=>$data->{'value_builder'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{authtypes} =
CGI::scrolling_list(-name=>'authtypecode',
- -id=>'authtypecode',
- -values=> address@hidden,
- -default=>$data->{'authtypecode'},
- -size=>1,
- -multiple=>0,
- );
- $row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
- -checked => $data->{'repeatable'}?'checked':'',
- -value => 1,
- -label => '',
- -id => "repeatable$i");
- $row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
- -checked => $data->{'mandatory'}?'checked':'',
- -value => 1,
- -label => '',
- -id => "mandatory$i");
- $row_data{hidden} = CGI::escapeHTML($data->{hidden});
- $row_data{isurl} = CGI::checkbox( -name => "isurl$i",
- -id => "isurl$i",
- -checked => $data->{'isurl'}?'checked':'',
- -value => 1,
- -label => '');
- $row_data{row} = $i;
- $row_data{toggle} = $toggle;
- $row_data{link} = CGI::escapeHTML($data->{'link'});
- push(@loop_data, \%row_data);
- $i++;
- }
- # add more_subfields empty lines for add if needed
- for (my $i=1;$i<=$more_subfields;$i++) {
- my %row_data; # get a fresh hash for the row data
- $row_data{tab} = CGI::scrolling_list(-name=>'tab',
- -id => "tab$i",
- -values=>['-1','10'],
- -labels => {'-1'
=>'ignore','10'=>'items (10)',},
- -default=>"",
- -size=>1,
- -multiple=>0,
- );
- $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
- -id=>"ohidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
- $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
- -id=>"ihidden$i",
- -values=>['0','2'],
- -labels => {'0'=>'Show','2' =>'Hide',},
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
- $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
- -id=>"ehidden$i",
- -values=>['0','1','2'],
- -labels => {'0'=>'Show','1'=>'Show
Collapsed',
- '2'
=>'Hide',
- },
- -default=>"0",
- -size=>1,
- -multiple=>0,
- );
- $row_data{tagsubfield} = "<input type=\"text\"
name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\"
id=\"tagsubfield\" maxlength=\"1\">";
- $row_data{liblibrarian} = "";
- $row_data{libopac} = "";
- $row_data{seealso} = "";
- $row_data{hidden} = "000";
- $row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
- -id => "repeatable$i",
- -checked => '',
- -value => 1,
- -label => '');
- $row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
- -id => "mandatory$i",
- -checked => '',
- -value => 1,
- -label => '');
- $row_data{isurl} = CGI::checkbox(-name => 'isurl',
- -id => "isurl$i",
- -checked => '',
- -value => 1,
- -label => '');
-
- $row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
- -id => 'authorised_value',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- );
- $row_data{authtypes} =
CGI::scrolling_list(-name=>'authtypecode',
- -id => 'authtypecode',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- );
- $row_data{link} = CGI::escapeHTML($data->{'link'});
- $row_data{toggle} = $toggle;
- $row_data{row} = $i;
- push(@loop_data, \%row_data);
- }
- $template->param('use-heading-flags-p' => 1);
- $template->param('heading-edit-subfields-p' => 1);
- $template->param(action => "Edit subfields",
- tagfield => "<input
type=\"hidden\" name=\"tagfield\" value=\"$tagfield\">$tagfield",
- loop => address@hidden,
- more_subfields =>
$more_subfields,
- more_tag => $tagfield);
-
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
- my $dbh = C4::Context->dbh;
- $template->param(tagfield => "$input->param('tagfield')");
- my $sth=$dbh->prepare("replace holdings_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode,
link)
- values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- my @tagsubfield = $input->param('tagsubfield');
- my @liblibrarian = $input->param('liblibrarian');
- my @libopac = $input->param('libopac');
-
- my @tab = $input->param('tab');
- my @seealso = $input->param('seealso');
-# my @hidden = $input->param('hidden');
- my @hidden;
- my @ohidden = $input->param('ohidden');
- my @ihidden = $input->param('ihidden');
- my @ehidden = $input->param('ehidden');
- my @authorised_values = $input->param('authorised_value');
- my @authtypecodes = $input->param('authtypecode');
- my @value_builder =$input->param('value_builder');
- my @link =$input->param('link');
- for (my $i=0; $i<= $#tagsubfield ; $i++) {
- my $tagfield =$input->param('tagfield');
- my $tagsubfield =$tagsubfield[$i];
- $tagsubfield="@" unless $tagsubfield ne '';
- my $liblibrarian =$liblibrarian[$i];
- my $libopac =$libopac[$i];
- my $repeatable =$input->param("repeatable$i")?1:0;
- my $mandatory =$input->param("mandatory$i")?1:0;
-
- my $tab =$tab[$i];
- my $seealso =$seealso[$i];
- my $authorised_value =$authorised_values[$i];
- my $authtypecode =$authtypecodes[$i];
- my $value_builder=$value_builder[$i];
- my $hidden = $ohidden[$i].$ihidden[$i].$ehidden[$i]; #collate
from 3 hiddens;
- my $isurl = $input->param("isurl$i")?1:0;
- my $link = $link[$i];
- if ($liblibrarian) {
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute ($tagfield,
-
$tagsubfield,
-
$liblibrarian,
-
$libopac,
-
$repeatable,
-
$mandatory,
-
- $tab,
-
$seealso,
-
$authorised_value,
-
$authtypecode,
-
$value_builder,
- $hidden,
- $isurl,
-
$frameworkcode,
-
- $link,
- );
- }
- }
- }
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=holdings_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
-
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select * from holdings_subfield_structure where
tagfield=? and tagsubfield=? and frameworkcode=?");
- #FIXME : called with 2 bind variables when 3 are needed
- $sth->execute($tagfield,$tagsubfield);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- $template->param(liblibrarian => $data->{'liblibrarian'},
- tagsubfield =>
$data->{'tagsubfield'},
- delete_link =>
$script_name,
- tagfield
=>$tagfield,
- tagsubfield =>
$tagsubfield,
- frameworkcode =>
$frameworkcode,
- );
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
- my $dbh = C4::Context->dbh;
- unless (C4::Context->config('demo') eq 1) {
- my $sth=$dbh->prepare("delete from holdings_subfield_structure
where tagfield=? and tagsubfield=? and frameworkcode=?");
- $sth->execute($tagfield,$tagsubfield,$frameworkcode);
- $sth->finish;
- }
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=holdings_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
- $template->param(tagfield => $tagfield);
-
# END $OP eq DELETE_CONFIRMED
-################## DEFAULT ##################################
-} else { # DEFAULT
- my $env;
- my ($count,$results)=StringSearch($env,$tagfield,$frameworkcode);
- my $toggle=1;
- my @loop_data = ();
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 1){
- $toggle=0;
- } else {
- $toggle=1;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results->[$i]{'tagfield'};
- $row_data{tagsubfield} = $results->[$i]{'tagsubfield'};
- $row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
-
- $row_data{repeatable} = $results->[$i]{'repeatable'};
- $row_data{mandatory} = $results->[$i]{'mandatory'};
- $row_data{tab} = $results->[$i]{'tab'};
- $row_data{seealso} = $results->[$i]{'seealso'};
- $row_data{authorised_value} =
$results->[$i]{'authorised_value'};
- $row_data{authtypecode} = $results->[$i]{'authtypecode'};
- $row_data{value_builder} =
$results->[$i]{'value_builder'};
- $row_data{hidden} = $results->[$i]{'hidden'}
if($results->[$i]{'hidden'} gt "000") ;
- $row_data{isurl} = $results->[$i]{'isurl'};
- $row_data{link} = $results->[$i]{'link'};
- $row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&frameworkcode=$frameworkcode";
- $row_data{toggle} = $toggle;
- if ($row_data{tab} eq -1) {
- $row_data{subfield_ignored} = 1;
- }
-
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- $template->param(edit_tagfield => $tagfield,
- edit_frameworkcode => $frameworkcode);
-
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(prev =>"<a
href=\"$script_name?offset=$prevpage\">");
- }
- if ($offset+$pagesize<$count) {
- my $nextpage =$offset+$pagesize;
- $template->param(next => "<a
href=\"$script_name?offset=$nextpage\">");
- }
-} #---- END $OP eq DEFAULT
-$template->param(intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-output_html_with_http_headers $input, $cookie, $template->output;
Index: admin/holdingstagstructure.pl
===================================================================
RCS file: admin/holdingstagstructure.pl
diff -N admin/holdingstagstructure.pl
--- admin/holdingstagstructure.pl 1 Sep 2006 22:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,366 +0,0 @@
-#!/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
-
-use strict;
-use CGI;
-use C4::Auth;
-use C4::Koha;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Search;
-
-
-# retrieve parameters
-my $input = new CGI;
-my $frameworkcode = $input->param('frameworkcode'); # set to select framework
-$frameworkcode="" unless $frameworkcode;
-my $existingframeworkcode = $input->param('existingframeworkcode'); # set when
we have to create a new framework (in frameworkcode) by copying an old one (in
existingframeworkcode)
-$existingframeworkcode = "" unless $existingframeworkcode;
-my $frameworkinfo = getframeworkinfo($frameworkcode);
-my $searchfield=$input->param('searchfield');
-$searchfield=0 unless $searchfield;
-$searchfield=~ s/\,//g;
-
-my $offset=$input->param('offset');
-my $op = $input->param('op');
-my $dspchoice = $input->param('select_display');
-my $pagesize=20;
-
-my $script_name="/cgi-bin/koha/admin/holdingstagstructure.pl";
-
-my $dbh = C4::Context->dbh;
-
-# open template
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"admin/holdingstagstructure.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-# get framework list
-my $frameworks = getframeworks();
-my @frameworkloop;
-foreach my $thisframeworkcode (keys %$frameworks) {
- my $selected = 1 if $thisframeworkcode eq $frameworkcode;
- my %row =(value => $thisframeworkcode,
- selected => $selected,
- frameworktext =>
$frameworks->{$thisframeworkcode}->{'frameworktext'},
- );
- push @frameworkloop, \%row;
-}
-
-# check that framework is defined in holdings_tag_structure
-my $sth=$dbh->prepare("select count(*) from holdings_tag_structure where
frameworkcode=?");
-$sth->execute($frameworkcode);
-my ($frameworkexist) = $sth->fetchrow;
-if ($frameworkexist) {
-} else {
- # if frameworkcode does not exists, then OP must be changed to "create
framework" if we are not on the way to create it
- # (op = itemtyp_create_confirm)
- if ($op eq "framework_create_confirm") {
- duplicate_framework($frameworkcode, $existingframeworkcode);
- $op=""; # unset $op to go back to framework list
- } else {
- $op = "framework_create";
- }
-}
-$template->param(frameworkloop => address@hidden,
- frameworkcode => $frameworkcode,
- frameworktext =>
$frameworkinfo->{frameworktext});
-if ($op) {
-$template->param(script_name => $script_name,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- #---- if primkey exists, it's a modify action, so read values to
modify...
- my $data;
- if ($searchfield) {
- $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
holdings_tag_structure where tagfield=? and frameworkcode=?");
- $sth->execute($searchfield,$frameworkcode);
- $data=$sth->fetchrow_hashref;
- $sth->finish;
- }
- my $sth = $dbh->prepare("select distinct category from
authorised_values");
- $sth->execute;
- my @authorised_values;
- push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $authorised_value = CGI::scrolling_list(-name=>'authorised_value',
- -values=> address@hidden,
- -size=>1,
- -id=>"authorised_value",
- -multiple=>0,
- -default => $data->{'authorised_value'},
- );
-
- if ($searchfield) {
- $template->param(action => "Modify tag",
- searchfield =>
"<input type=\"hidden\" name=\"tagfield\" value=\"$searchfield\"
/>$searchfield");
- $template->param('heading-modify-tag-p' => 1);
- } else {
- $template->param(action => "Add tag",
- searchfield =>
"<input type=\"text\" name=\"tagfield\" size=\"5\" maxlength=\"3\" />");
- $template->param('heading-add-tag-p' => 1);
- }
- $template->param('use-heading-flags-p' => 1);
- $template->param(liblibrarian => $data->{'liblibrarian'},
- libopac => $data->{'libopac'},
- repeatable => CGI::checkbox(-name=>'repeatable',
- -checked=>
$data->{'repeatable'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'repeatable'),
- mandatory => CGI::checkbox(-name => 'mandatory',
- -checked =>
$data->{'mandatory'}?'checked':'',
- -value => 1,
- -label => '',
- -id => 'mandatory'),
- authorised_value => $authorised_value,
- frameworkcode => $frameworkcode,
- );
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
- $sth=$dbh->prepare("replace holdings_tag_structure
(tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode)
values (?,?,?,?,?,?,?)");
- my $tagfield =$input->param('tagfield');
- my $liblibrarian = $input->param('liblibrarian');
- my $libopac =$input->param('libopac');
- my $repeatable =$input->param('repeatable');
- my $mandatory =$input->param('mandatory');
- my $authorised_value =$input->param('authorised_value');
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute($tagfield,
- $liblibrarian,
- $libopac,
- $repeatable?1:0,
- $mandatory?1:0,
- $authorised_value,
- $frameworkcode
- );
- }
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=holdingstagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
- exit;
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
holdings_tag_structure where tagfield=? and frameworkcode=?");
- $sth->execute($searchfield,$frameworkcode);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- $template->param(liblibrarian => $data->{'liblibrarian'},
- searchfield =>
$searchfield,
- frameworkcode =>
$frameworkcode,
- );
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
- unless (C4::Context->config('demo') eq 1) {
- $dbh->do("delete from holdings_tag_structure where
tagfield='$searchfield' and frameworkcode='$frameworkcode'");
- $dbh->do("delete from holdings_subfield_structure where
tagfield='$searchfield' and frameworkcode='$frameworkcode'");
-
- }
-
# END $OP eq DELETE_CONFIRMED
-################## ITEMTYPE_CREATE ##################################
-# called automatically if an unexisting frameworkis selected
-} elsif ($op eq 'framework_create') {
- $sth = $dbh->prepare("select
count(*),holdings_tag_structure.frameworkcode,frameworktext from
holdings_tag_structure,biblio_framework where
biblio_framework.frameworkcode=holdings_tag_structure.frameworkcode group by
holdings_tag_structure.frameworkcode");
- $sth->execute;
- my @existingframeworkloop;
- while (my ($tot,$thisframeworkcode,$frameworktext) = $sth->fetchrow) {
- if ($tot>0) {
- my %line = ( value => $thisframeworkcode,
- frameworktext => $frameworktext,
- );
- push @existingframeworkloop,\%line;
- }
- }
- $template->param(existingframeworkloop => address@hidden,
- frameworkcode => $frameworkcode,
-# FRtext =>
$frameworkinfo->{frameworktext},
- );
-################## DEFAULT ##################################
-} else { # DEFAULT
- # here, $op can be unset or set to "framework_create_confirm".
- if ($searchfield ne '') {
- $template->param(searchfield => $searchfield);
- }
- my $cnt=0;
- if ($dspchoice) {
- #here, user only wants used tags/subfields displayed
- my $env;
- $searchfield=~ s/\'/\\\'/g;
- my @data=split(' ',$searchfield);
- my $sth=$dbh->prepare("Select holdings_tag_structure.tagfield
as mts_tagfield,holdings_tag_structure.liblibrarian as
mts_liblibrarian,holdings_tag_structure.libopac as
mts_libopac,holdings_tag_structure.repeatable as
mts_repeatable,holdings_tag_structure.mandatory as
mts_mandatory,holdings_tag_structure.authorised_value as
mts_authorized_value,holdings_subfield_structure.* from holdings_tag_structure
LEFT JOIN holdings_subfield_structure ON
(holdings_tag_structure.tagfield=holdings_subfield_structure.tagfield AND
holdings_tag_structure.frameworkcode=holdings_subfield_structure.frameworkcode)
where (holdings_tag_structure.tagfield >= ? and
holdings_tag_structure.frameworkcode=?) AND holdings_subfield_structure.tab>=0
order by
holdings_tag_structure.tagfield,holdings_subfield_structure.tagsubfield");
- #could be ordoned by tab
- $sth->execute($data[0], $frameworkcode);
- my @results = ();
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- $cnt++;
- }
- $sth->finish;
-
- my $toggle=0;
- my @loop_data = ();
- my $j=1;
- my $i=$offset;
- while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results[$i]->{'mts_tagfield'};
- $row_data{liblibrarian} =
$results[$i]->{'mts_liblibrarian'};
- $row_data{repeatable} =
$results[$i]->{'mts_repeatable'};
- $row_data{mandatory} = $results[$i]->{'mts_mandatory'};
- $row_data{authorised_value} =
$results[$i]->{'mts_authorised_value'};
- $row_data{subfield_link}
="holdings_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{toggle} = $toggle;
- $j=$i;
- my @internal_loop = ();
- while
(($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j<
($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) {
- if ($toggle eq 0) {
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %subfield_data;
- $subfield_data{tagsubfield} =
$results[$j]->{'tagsubfield'};
- $subfield_data{liblibrarian} =
$results[$j]->{'liblibrarian'};
-
- $subfield_data{repeatable} =
$results[$j]->{'repeatable'};
- $subfield_data{mandatory} =
$results[$j]->{'mandatory'};
- $subfield_data{tab} = $results[$j]->{'tab'};
- $subfield_data{seealso} =
$results[$j]->{'seealso'};
- $subfield_data{authorised_value} =
$results[$j]->{'authorised_value'};
- $subfield_data{authtypecode}=
$results[$j]->{'authtypecode'};
- $subfield_data{value_builder}=
$results[$j]->{'value_builder'};
- $subfield_data{toggle} = $toggle;
-# warn "tagfield :
".$results[$j]->{'tagfield'}." tagsubfield :".$results[$j]->{'tagsubfield'};
- push @internal_loop,\%subfield_data;
- $j++;
- }
- $row_data{'subfields'address@hidden;
- push(@loop_data, \%row_data);
-# undef @internal_loop;
- $i=$j;
- }
- $template->param(select_display => "True",
- loop => address@hidden);
- # $sth->execute;
- $sth->finish;
- } else {
- #here, normal old style : display every tags
- my $env;
- my
($count,$results)=StringSearch($env,$searchfield,$frameworkcode);
- $cnt = $count;
- my $toggle=0;
- my @loop_data = ();
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{tagfield} = $results->[$i]{'tagfield'};
- $row_data{liblibrarian} =
$results->[$i]{'liblibrarian'};
- $row_data{repeatable} = $results->[$i]{'repeatable'};
- $row_data{mandatory} = $results->[$i]{'mandatory'};
- $row_data{authorised_value} =
$results->[$i]{'authorised_value'};
- $row_data{subfield_link}
="holdings_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
- $row_data{toggle} = $toggle;
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- }
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(isprevpage => $offset,
- prevpage=> $prevpage,
- searchfield => $searchfield,
- script_name => $script_name,
- frameworkcode => $frameworkcode,
- );
- }
- if ($offset+$pagesize<$cnt) {
- my $nextpage =$offset+$pagesize;
- $template->param(nextpage =>$nextpage,
- searchfield => $searchfield,
- script_name => $script_name,
- frameworkcode => $frameworkcode,
- );
- }
-} #---- END $OP eq DEFAULT
-
-$template->param(loggeninuser => $loggedinuser,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-output_html_with_http_headers $input, $cookie, $template->output;
-
-
-#
-# the sub used for searches
-#
-sub StringSearch {
- my ($env,$searchstring,$frameworkcode)address@hidden;
- my $dbh = C4::Context->dbh;
- $searchstring=~ s/\'/\\\'/g;
- my @data=split(' ',$searchstring);
- my address@hidden;
- my $sth=$dbh->prepare("Select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
holdings_tag_structure where (tagfield >= ? and frameworkcode=?) order by
tagfield");
- $sth->execute($data[0], $frameworkcode);
- my @results;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- }
- # $sth->execute;
- $sth->finish;
- return (scalar(@results),address@hidden);
-}
-
-#
-
-
Index: admin/institutions-careers.pl
===================================================================
RCS file: admin/institutions-careers.pl
diff -N admin/institutions-careers.pl
--- admin/institutions-careers.pl 1 Sep 2006 22:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,74 +0,0 @@
-#!/usr/bin/perl
-
-# Script to manage the educational institutions and its careers.
-# written 12/04
-# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP Argentina
-
-# 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 CGI;
-
-use C4::Auth;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::AcademicInfo;
-
-my $cgi = new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name =>
"admin/institutions-careers.tmpl",
- query => $cgi,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {editcatalogue => 1},
- debug => 1,
- });
-
-my $op = $cgi->param('op');
-my $id_institution = $cgi->param('id_institution');
-my $institution_name = $cgi->param('institution_name');
-
-if ($op eq 'add_form') {
- $template->param(add_form => 1);
-
- if ($id_institution) {
- my $info = get_educational_institution($id_institution);
- $template->param(op => 'edit');
- $template->param(institution_name =>
$info->{'institution_name'});
- $template->param(id_institution => $id_institution);
- } else {
- $template->param(op => 'add');
- }
-
-} elsif ($op eq 'add') {
- add_educational_institution($institution_name);
- print $cgi->redirect('/cgi-bin/koha/admin/institutions-careers.pl');
-} elsif ($op eq 'edit') {
- update_educational_institution($id_institution, $institution_name);
- print $cgi->redirect('/cgi-bin/koha/admin/institutions-careers.pl');
-} elsif ($op eq 'del') {
- del_educational_institution($id_institution);
- print $cgi->redirect('/cgi-bin/koha/admin/institutions-careers.pl');
-} else {
- my @educ_institutions = &get_careers_by_institution();
- $template->param(institutions => address@hidden);
-}
-
-output_html_with_http_headers $cgi, $cookie, $template->output;
Index: admin/koha_attr.pl
===================================================================
RCS file: admin/koha_attr.pl
diff -N admin/koha_attr.pl
--- admin/koha_attr.pl 15 Nov 2006 01:41:51 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,321 +0,0 @@
-#!/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
-
-use strict;
-use CGI;
-use C4::Auth;
-use C4::Koha;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Search;
-
-
-# retrieve parameters
-my $input = new CGI;
-
-my $searchfield=$input->param('searchfield');
-$searchfield="" unless $searchfield;
-my $id=$input->param('id');
-my $offset=$input->param('offset');
-$offset=0 unless $offset;
-my $op = $input->param('op');
-my $dspchoice = $input->param('select_display');
-my $pagesize=20;
-my @results = ();
-my $script_name="/cgi-bin/koha/admin/koha_attr.pl";
-
-my $dbh = C4::Context->dbh;
-my $sth;
-# open template
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/koha_attr.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-
-if ($op) {
-$template->param(script_name => $script_name,
- $op => 1); # we
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
- else => 1); # we
show only the TMPL_VAR names $op
-}
-
-
-################## ADD_FORM ##################################
-# called by default. Used to create form to add or modify a record
-if ($op eq 'add_form') {
- #---- if primkey exists, it's a modify action, so read values to
modify...
- my $data;
- if ($id) {
- $sth=$dbh->prepare("select
id,kohafield,attr,label,sorts,recordtype,tagfield,tagsubfield,opacshow,intrashow
from koha_attr where id=? ");
- $sth->execute($id);
- $data=$sth->fetchrow_hashref;
- $sth->finish;
- }
- my $sth = $dbh->prepare("select authorised_value from authorised_values
where category='recordtype'");
- $sth->execute;
- my @authorised_values;
- #push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $recordlist = CGI::scrolling_list(-name=>'recordtype',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- -default => $data->{'recordtype'},
- );
- my $sth = $dbh->prepare("select authorised_value from authorised_values
where category='mfield' order by lib");
- $sth->execute;
- my @authorised_values;
- #push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $taglist = CGI::scrolling_list(-name=>'tagfield',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- -default => $data->{'tagfield'},
- );
- my $sth = $dbh->prepare("select authorised_value from authorised_values
where category='subfield' order by lib ");
- $sth->execute;
- my @authorised_values;
- #push @authorised_values,"";
- while ((my $category) = $sth->fetchrow_array) {
- push @authorised_values, $category;
- }
- my $tagsublist = CGI::scrolling_list(-name=>'tagsubfield',
- -values=> address@hidden,
- -size=>1,
- -multiple=>0,
- -default => $data->{'tagsubfield'},
- );
-
- if ($searchfield) {
- $template->param(action => "Modify tag",id=>$id ,searchfield =>
"<input type=\"hidden\" name=\"kohafield\" value=\"$searchfield\"
/>$searchfield");
- $template->param('heading-modify-tag-p' => 1);
- } else {
- $template->param(action => "Add tag",
- searchfield =>
"<input type=\"text\" name=\"kohafield\" size=\"40\" maxlength=\"80\" />");
- $template->param('heading-add-tag-p' => 1);
- }
- $template->param('use-heading-flags-p' => 1);
- $template->param(label => $data->{'label'},
- attr=> $data->{'attr'},
- recordtype=>$recordlist,
- tagfield=>$taglist,
- tagsubfield=>$tagsublist,
- sorts => CGI::checkbox(-name=>'sorts',
- -checked=>
$data->{'sorts'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'sorts'),
- opacshow => CGI::checkbox(-name=>'opacshow',
- -checked=>
$data->{'opacshow'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'opacshow'),
- intrashow => CGI::checkbox(-name=>'intrashow',
- -checked=>
$data->{'intrashow'}?'checked':'',
- -value=> 1,
- -label => '',
- -id=> 'intrashow'),
-
-
- );
-
# END $OP eq ADD_FORM
-################## ADD_VALIDATE ##################################
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
-my $id =$input->param('id');
-
- $sth=$dbh->prepare("replace koha_attr set
id=?,kohafield=?,attr=?,label=?,sorts=?,recordtype=?,tagfield=?,tagsubfield=?
,opacshow=?,intrashow=? ");
-
-
- my $kohafield =$input->param('kohafield');
- my $attr =$input->param('attr');
- my $label = $input->param('label');
- my $sorts =$input->param('sorts');
- my $opacshow =$input->param('opacshow');
- my $intrashow =$input->param('intrashow');
- my $recordtype =$input->param('recordtype');
- my $tagfield =$input->param('tagfield');
- my $tagsubfield =$input->param('tagsubfield');
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute(
$id,$kohafield,$attr,$label,$sorts?1:0,$recordtype,$tagfield,$tagsubfield,$opacshow?1:0,$intrashow?1:0);
- }
- $sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=koha_attr.pl?searchfield=$kohafield\"></html>";
-
- exit;
-
# END $OP eq ADD_VALIDATE
-################## DELETE_CONFIRM ##################################
-# called by default form, used to confirm deletion of data in DB
-} elsif ($op eq 'delete_confirm') {
- $sth=$dbh->prepare("select id,kohafield,label,recordtype from koha_attr
where id=? ");
- $sth->execute($id);
- my $data=$sth->fetchrow_hashref;
- $sth->finish;
- $template->param(label => $data->{'label'}."/".
$data->{'recordtype'},id=>$data->{'id'},
- searchfield =>
$searchfield,
- );
-
# END $OP eq DELETE_CONFIRM
-################## DELETE_CONFIRMED ##################################
-# called by delete_confirm, used to effectively confirm deletion of data in DB
-} elsif ($op eq 'delete_confirmed') {
-
- unless (C4::Context->config('demo') eq 1) {
- $dbh->do("delete from koha_attr where id=$id ");
- }
-
# END $OP eq DELETE_CONFIRMED
-
-################## DEFAULT ##################################
-} else { # DEFAULT
- # here, $op can be unset or set
- if ($searchfield ne '') {
- $template->param(searchfield => $searchfield);
- }
- my $cnt=0;
- if ($dspchoice) {
- #here, user only wants used tags/subfields displayed
- my $sth=$dbh->prepare("Select * from koha_attr where tagfield
<>'' and kohafield >= ? ");
- #could be ordoned by tab
- $sth->execute($searchfield);
-
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
- $cnt++;
- }
-
- $sth->finish;
-
- my $toggle=0;
- my @loop_data = ();
- my $j=1;
- my $i=$offset;
- while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{id} = $results[$i]->{'id'};
- $row_data{kohafield} = $results[$i]->{'kohafield'};
- $row_data{label} = $results[$i]->{'label'};
- $row_data{sorts} = $results[$i]->{'sorts'};
- $row_data{attr} = $results[$i]->{'attr'};
- $row_data{recordtype} = $results[$i]->{'recordtype'};
- $row_data{tagfield} = $results[$i]->{'tagfield'};
- $row_data{tagsubfield} = $results[$i]->{'tagsubfield'};
- $row_data{opacshow} = $results[$i]->{'opacshow'};
- $row_data{intrashow} = $results[$i]->{'intrashow'};
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
- $row_data{toggle} = $toggle;
- push(@loop_data, \%row_data);
- $i++;
- }
- $template->param(select_display => "True",
- loop => address@hidden);
- $sth->finish;
- } else {
- #here, normal old style : display every tags
- my ($count,@results)=StringSearch($dbh,$searchfield);
- $cnt = $count;
- my $toggle=0;
- my @loop_data = ();
- for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 0){
- $toggle=1;
- } else {
- $toggle=0;
- }
- my %row_data; # get a fresh hash for the row data
- $row_data{id} = $results[$i]->{'id'};
- $row_data{kohafield} = $results[$i]->{'kohafield'};
- $row_data{label} = $results[$i]->{'label'};
- $row_data{sorts} = $results[$i]->{'sorts'};
- $row_data{attr} = $results[$i]->{'attr'};
- $row_data{recordtype} = $results[$i]->{'recordtype'};
- $row_data{tagfield} = $results[$i]->{'tagfield'};
- $row_data{tagsubfield} = $results[$i]->{'tagsubfield'};
- $row_data{opacshow} = $results[$i]->{'opacshow'};
- $row_data{intrashow} = $results[$i]->{'intrashow'};
- $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
- $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
- $row_data{toggle} = $toggle;
- push(@loop_data, \%row_data);
- }
- $template->param(loop => address@hidden);
- }
- if ($offset>0) {
- my $prevpage = $offset-$pagesize;
- $template->param(isprevpage => $offset,
- prevpage=> $prevpage,
- searchfield => $searchfield,
- script_name => $script_name,
-
- );
- }
- if ($offset+$pagesize<$cnt) {
- my $nextpage =$offset+$pagesize;
- $template->param(nextpage =>$nextpage,
- searchfield => $searchfield,
- script_name => $script_name,
-
- );
- }
-} #---- END $OP eq DEFAULT
-
-$template->param(loggeninuser => $loggedinuser,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
-output_html_with_http_headers $input, $cookie, $template->output;
-
-
-#
-# the sub used for searches
-#
-sub StringSearch {
- my ($dbh,$searchstring)address@hidden;
- my $sth=$dbh->prepare("Select * from koha_attr where kohafield >=?
order by kohafield");
- $sth->execute($searchstring);
- my @dataresults;
- while (my $data=$sth->fetchrow_hashref){
- push(@dataresults,$data);
-
- }
-
- $sth->finish;
- return (scalar(@dataresults),@dataresults);
-}
-
-
-
Index: admin/koha-electronic.pl
===================================================================
RCS file: admin/koha-electronic.pl
diff -N admin/koha-electronic.pl
--- admin/koha-electronic.pl 27 Sep 2006 21:19:21 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,102 +0,0 @@
-#!/usr/bin/perl
-
-# Script to manage the opac news.
-# written 11/04
-# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP Argentina
-
-# 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 CGI;
-
-use C4::Auth;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::NewsChannels;
-
-
-my $cgi = new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "admin/koha-electronic.tmpl",
- query => $cgi,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-my $op = $cgi->param('op');
-
-if ($op eq 'add_form') {
- $template->param(add_form => 1);
- my $id = $cgi->param("id");
- my $edata;
-# warn "add_form";
- if ($id) {
- $template->param(op => 'edit');
- $edata = get_opac_electronic($id);
- $template->param($edata);
- $template->param(id => $edata->{'idelectronic'});
- } else {
- $template->param(op => 'add');
- }
-
-} elsif ($op eq 'add') {
-# warn "add";
- my $title = $cgi->param('title');
- my $edata = $cgi->param('edata');
- my $lang = $cgi->param('lang');
- my $image = $cgi->param('image');
- my $href = $cgi->param('href');
- my $section = $cgi->param('section');
- add_opac_electronic($title, $edata, $lang,$image, $href,$section);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
-
-} elsif ($op eq 'edit') {
-# warn "edit";
- my $id = $cgi->param('id');
- my $title = $cgi->param('title');
- my $edata = $cgi->param('edata');
- my $lang = $cgi->param('lang');
- my $image = $cgi->param('image');
- my $href = $cgi->param('href');
- my $section = $cgi->param('section');
- upd_opac_electronic($id, $title, $edata, $lang,$image,$href,$section);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
-
-} elsif ($op eq 'del') {
-# warn "del";
- my @ids = $cgi->param('ids');
- del_opac_electronic(join ",", @ids);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-electronic.pl');
-
-} else {
-# warn "else";
-
- my $lang = $cgi->param('lang');
-
- my ($opac_electronic_count, $opac_electronic) =
&get_opac_electronics(undef, $lang);
- $template->param($lang => 1);
- $template->param(opac_electronic => $opac_electronic);
- $template->param(opac_electronic_count => $opac_electronic_count);
-
-}
-
-output_html_with_http_headers $cgi, $cookie, $template->output;
Index: admin/koha-news.pl
===================================================================
RCS file: admin/koha-news.pl
diff -N admin/koha-news.pl
--- admin/koha-news.pl 1 Sep 2006 22:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,95 +0,0 @@
-#!/usr/bin/perl
-
-# Script to manage the opac news.
-# written 11/04
-# Castañeda, Carlos Sebastian - address@hidden - Physics Library UNLP Argentina
-
-# 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 CGI;
-
-use C4::Auth;
-use C4::Context;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::NewsChannels;
-
-
-my $cgi = new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "admin/koha-news.tmpl",
- query => $cgi,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {management => 1},
- debug => 1,
- });
-
-my $op = $cgi->param('op');
-
-if ($op eq 'add_form') {
- $template->param(add_form => 1);
- my $id = $cgi->param("id");
- my $new;
-
- if ($id) {
- $template->param(op => 'edit');
- $new = get_opac_new($id);
- $template->param($new);
- $template->param(id => $new->{'idnew'});
- } else {
- $template->param(op => 'add');
- }
-
-} elsif ($op eq 'add') {
-
- my $title = $cgi->param('title');
- my $new = $cgi->param('new');
- my $lang = $cgi->param('lang');
-
- add_opac_new($title, $new, $lang);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
-
-} elsif ($op eq 'edit') {
-
- my $id = $cgi->param('id');
- my $title = $cgi->param('title');
- my $new = $cgi->param('new');
- my $lang = $cgi->param('lang');
-
- upd_opac_new($id, $title, $new, $lang);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
-
-} elsif ($op eq 'del') {
- my @ids = $cgi->param('ids');
- del_opac_new(join ",", @ids);
- print $cgi->redirect('/cgi-bin/koha/admin/koha-news.pl');
-
-} else {
-
- my $lang = $cgi->param('lang');
- my ($opac_news_count, $opac_news) = &get_opac_news(undef, $lang);
- $template->param($lang => 1);
- $template->param(opac_news => $opac_news);
- $template->param(opac_news_count => $opac_news_count);
-
-}
-
-output_html_with_http_headers $cgi, $cookie, $template->output;
Index: admin/stopwords.pl
===================================================================
RCS file: admin/stopwords.pl
diff -N admin/stopwords.pl
--- admin/stopwords.pl 7 Apr 2006 08:24:36 -0000 1.16
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,171 +0,0 @@
-#!/usr/bin/perl
-
-# 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
-#
-###
-#
-# script to administer the stopwords table
-#
-# - written on 2002/02/20 by address@hidden
-#
-# - experimentaly rewrittten on 2006/04/06 by Pierrick LE GALL (INEO media
-# system)
-#
-
-use strict;
-use CGI;
-use List::Util qw/min/;
-
-use C4::Koha;
-use C4::Context;
-use C4::Output;
-use C4::Search;
-use HTML::Template;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-
-sub StringSearch {
- my ($searchstring) = @_;
-
- my $dbh = C4::Context->dbh;
- $searchstring =~ s/\'/\\\'/g;
- my @tokens = split(' ',$searchstring);
-
- my $query = '
-SELECT word
- FROM stopwords
- WHERE (word like ?)
- ORDER BY word
-';
- my $sth = $dbh->prepare($query);
- $sth->execute($tokens[0].'%');
- my @results;
- while (my $row = $sth->fetchrow_hashref) {
- push(@results, $row->{word});
- }
- $sth->finish;
-
- return @results;
-}
-
-my $dbh = C4::Context->dbh;
-my $sth;
-my $query;
-my $input = new CGI;
-my $searchfield = $input->param('searchfield');
-my $script_name="/cgi-bin/koha/admin/stopwords.pl";
-
-my $pagesize = 40;
-my $op = $input->param('op');
-$searchfield=~ s/\,//g;
-
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/stopwords.tmpl",
- query => $input,
- type => "intranet",
- flagsrequired => {parameters => 1, management => 1},
- authnotrequired => 0,
- debug => 1,
- });
-
-$template->param(script_name => $script_name,
- searchfield => $searchfield);
-
-if ($input->param('add')) {
- if ($input->param('word')) {
- my @words = split / |,/, $input->param('word');
-
- $query = '
-DELETE
- FROM stopwords
- WHERE word IN (?'.(',?' x scalar @words - 1).')
-';
- $sth = $dbh->prepare($query);
- $sth->execute(@words);
- $sth->finish;
-
- $query = '
-INSERT
- INTO stopwords
- (word)
- VALUES
- (?)'.(',(?)' x scalar @words - 1).'
-';
- $sth = $dbh->prepare($query);
- $sth->execute(@words);
- $sth->finish;
-
- $template->param(stopword_added => 1);
- }
-}
-elsif ($input->param('deleteSelected')) {
- if ($input->param('stopwords[]')) {
- my @stopwords_loop = ();
-
- foreach my $word ($input->param('stopwords[]')) {
- push @stopwords_loop, {word => $word};
- }
-
- $template->param(
- delete_confirm => 1,
- stopwords_to_delete => address@hidden,
- );
- }
-}
-elsif ($input->param('confirmDeletion')) {
- my @words = $input->param('confirmed_stopwords[]');
-
- $query = '
-DELETE
- FROM stopwords
- WHERE word IN (?'.(',?' x scalar @words - 1).')
-';
- $sth = $dbh->prepare($query);
- $sth->execute(@words);
- $sth->finish;
-
- $template->param(delete_confirmed => 1);
-}
-
-my $page = $input->param('page') || 1;
-
-my @results = StringSearch($searchfield);
-my @loop;
-
-my $first = ($page - 1) * $pagesize;
-
-# if we are on the last page, the number of the last word to display must
-# not exceed the length of the results array
-my $last = min(
- $first + $pagesize - 1,
- scalar(@results) - 1,
-);
-
-foreach my $word (@results[$first .. $last]) {
- push @loop, {word => $word};
-}
-
-$template->param(
- loop => address@hidden,
- pagination_bar => pagination_bar(
- $script_name,
- getnbpages(scalar @results, $pagesize),
- $page,
- 'page'
- )
-);
-
-output_html_with_http_headers $input, $cookie, $template->output;
Index: admin/viewlog.pl
===================================================================
RCS file: admin/viewlog.pl
diff -N admin/viewlog.pl
--- admin/viewlog.pl 11 Sep 2006 17:41:54 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,148 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: viewlog.pl,v 1.4 2006/09/11 17:41:54 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::Auth;
-use CGI;
-use C4::Context;
-use C4::Koha;
-use C4::Interface::CGI::Output;
-use C4::Log;
-use Date::Manip;
-
-=head1 NAME
-
-plugin that shows a stats on catalogers
-
-=head1 DESCRIPTION
-
-
-=over2
-
-=cut
-
-my $input = new CGI;
-my $do_it=$input->param('do_it');
-my $fullreportname = "parameters/viewlog.tmpl";
-my $modulename = $input->param("module");
-my $userfilter = $input->param("user");
-my $actionfilter = $input->param("action");
-my $fromfilter = $input->param("from");
-my $tofilter = $input->param("to");
-my $basename = $input->param("basename");
-my $mime = $input->param("MIME");
-my $del = $input->param("sep");
-my $output = $input->param("output");
-
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => $fullreportname,
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {editcatalogue => 1},
- debug => 1,
- });
-$template->param(do_it => $do_it);
-if ($do_it) {
-# Displaying results
- #building filters
- my @filters;
- push @filters, {name=> 'user', value=> $userfilter} if ($userfilter);
- push @filters, {name=> 'action', value=> $actionfilter} if
($actionfilter);
- push @filters, {name=> 'from', value=> $fromfilter} if ($fromfilter);
- push @filters, {name=> 'to', value=> $tofilter} if ($tofilter);
- if ($modulename eq "catalogue"){
- my $titlefilter = $input->param("title");
- my $authorfilter = $input->param("author");
- my $publisherfilter = $input->param("publisher");
- my $callnumberfilter = $input->param("itemcallnumber");
-
- push @filters, {name=> 'title', value=> $titlefilter} if
($titlefilter);
- push @filters, {name=> 'author', value=> $authorfilter} if
($authorfilter);
- push @filters, {name=> 'publisher', value=> $publisherfilter}
if ($publisherfilter);
- push @filters, {name=> 'callnumber', value=> $callnumberfilter}
if ($callnumberfilter);
- }
-
- my ($count, $results) = displaylog( $modulename, @filters);
- if ($output eq "screen"){
-# Printing results to screen
- $template->param(modulename =>$modulename, $modulename => 1,
looprow => $results,counter=>$count);
- output_html_with_http_headers $input, $cookie,
$template->output;
- exit(1);
- } else {
-# Printing to a csv file
- print $input->header(-type => 'application/vnd.sun.xml.calc',
- -attachment=>"$basename.csv",
- -filename=>"$basename.csv" );
- my $sep;
- $sep =C4::Context->preference("delimiter");
-# header top-right
-# Other header
-# Table
- foreach my $line ( @$results ) {
- if ($modulename eq "catalogue"){
- print $line->{timestamp}.$sep;
- print $line->{firstname}.$sep;
- print $line->{surname}.$sep;
- print $line->{action}.$sep;
- print $line->{info}.$sep;
- print $line->{title}.$sep;
- print $line->{author}.$sep;
- }
- print "\n";
- }
-# footer
- exit(1);
- }
-} else {
- my $dbh = C4::Context->dbh;
- my @values;
- my %labels;
- my %select;
- my $req;
-
- my @mime = ( C4::Context->preference("MIME") );
-# foreach my $mime (@mime){
-# warn "".$mime;
-# }
-
- my $CGIextChoice=CGI::scrolling_list(
- -name => 'MIME',
- -id => 'MIME',
- -values => address@hidden,
- -size => 1,
- -multiple => 0 );
-
- my @dels = ( C4::Context->preference("delimiter") );
- my $CGIsepChoice=CGI::scrolling_list(
- -name => 'sep',
- -id => 'sep',
- -values => address@hidden,
- -size => 1,
- -multiple => 0 );
-
- $template->param(
- CGIextChoice => $CGIextChoice,
- CGIsepChoice => $CGIsepChoice
- );
-output_html_with_http_headers $input, $cookie, $template->output;
-}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha acqui/select-late.pl admin/biblios_framewo...,
paul poulain <=