[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/admin biblio_framework.pl,NONE,1.1 auth_subfields_s
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/admin biblio_framework.pl,NONE,1.1 auth_subfields_structure.pl,1.1,1.2 authtypes.pl,1.1,1.2 marc_subfields_structure.pl,1.22,1.23 marctagstructure.pl,1.21,1.22 |
Date: |
Thu, 03 Jun 2004 03:01:32 -0700 |
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24569/admin
Modified Files:
auth_subfields_structure.pl authtypes.pl
marc_subfields_structure.pl marctagstructure.pl
Added Files:
biblio_framework.pl
Log Message:
* frameworks and itemtypes are independant
* bugfixes in authority types & framework management (mainly deletion)
--- NEW FILE ---
#!/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;
use HTML::Template;
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 biblio_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/biblio_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 =>
"parameters/biblio_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 biblio_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 biblio_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=biblio_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 ('marc_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 biblio_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 marc_tag_structure where
frameworkcode=?");
$sth->execute($frameworkcode);
$sth=$dbh->prepare("delete from marc_subfield_structure where
frameworkcode=?");
$sth->execute($frameworkcode);
$sth=$dbh->prepare("delete from biblio_framework where
frameworkcode=?");
$sth->execute($frameworkcode);
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=biblio_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: auth_subfields_structure.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/auth_subfields_structure.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** auth_subfields_structure.pl 28 May 2004 08:23:03 -0000 1.1
--- auth_subfields_structure.pl 3 Jun 2004 10:01:28 -0000 1.2
***************
*** 239,244 ****
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder
from auth_subfield_structure where tagfield=? and tagsubfield=? and
itemtype=?");
! $sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
--- 239,244 ----
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder
from auth_subfield_structure where tagfield=? and tagsubfield=? and
authtypecode=?");
! $sth->execute($tagfield,$tagsubfield,$authtypecode);
my $data=$sth->fetchrow_hashref;
$sth->finish;
***************
*** 258,261 ****
--- 258,262 ----
my $sth=$dbh->prepare("delete from auth_subfield_structure
where tagfield=? and tagsubfield=? and authtypecode=?");
$sth->execute($tagfield,$tagsubfield,$authtypecode);
+ warn "DEL : $tagfield,$tagsubfield,$authtypecode";
$sth->finish;
}
***************
*** 288,291 ****
--- 289,295 ----
$row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&authtypecode=$authtypecode";
$row_data{bgcolor} = $toggle;
+ if ($row_data{tab} eq -1) {
+ $row_data{subfield_ignored} = 1;
+ }
push(@loop_data, \%row_data);
}
Index: authtypes.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/authtypes.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** authtypes.pl 28 May 2004 08:23:03 -0000 1.1
--- authtypes.pl 3 Jun 2004 10:01:28 -0000 1.2
***************
*** 107,111 ****
my $dbh = C4::Context->dbh;
- # Check both categoryitem and biblioitems, see Bug 199
my $total = 0;
for my $table ('auth_tag_structure') {
--- 107,110 ----
***************
*** 116,120 ****
}
! my $sth=$dbh->prepare("select authtypecode,authtypetext from authtypes
where authtypecode=?");
$sth->execute($authtypecode);
my $data=$sth->fetchrow_hashref;
--- 115,119 ----
}
! my $sth=$dbh->prepare("select authtypecode,authtypetext from auth_types
where authtypecode=?");
$sth->execute($authtypecode);
my $data=$sth->fetchrow_hashref;
***************
*** 131,135 ****
my $dbh = C4::Context->dbh;
my $authtypecode=uc($input->param('authtypecode'));
! my $sth=$dbh->prepare("delete from auth_types where authtypecode=?");
$sth->execute($authtypecode);
$sth->finish;
--- 130,138 ----
my $dbh = C4::Context->dbh;
my $authtypecode=uc($input->param('authtypecode'));
! my $sth=$dbh->prepare("delete from auth_tag_structure where
authtypecode=?");
! $sth->execute($authtypecode);
! $sth=$dbh->prepare("delete from auth_subfield_structure where
authtypecode=?");
! $sth->execute($authtypecode);
! $sth=$dbh->prepare("delete from auth_types where authtypecode=?");
$sth->execute($authtypecode);
$sth->finish;
Index: marc_subfields_structure.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/marc_subfields_structure.pl,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** marc_subfields_structure.pl 28 May 2004 08:24:14 -0000 1.22
--- marc_subfields_structure.pl 3 Jun 2004 10:01:28 -0000 1.23
***************
*** 29,39 ****
sub StringSearch {
! my ($env,$searchstring,$itemtype)address@hidden;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my address@hidden;
! my $sth=$dbh->prepare("Select * from marc_subfield_structure where
(tagfield like ? and itemtype=?) order by tagfield");
! $sth->execute("$searchstring%",$itemtype);
my @results;
my $cnt=0;
--- 29,39 ----
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 marc_subfield_structure where
(tagfield like ? and frameworkcode=?) order by tagfield");
! $sth->execute("$searchstring%",$frameworkcode);
my @results;
my $cnt=0;
***************
*** 50,54 ****
my $tagfield=$input->param('tagfield');
my $tagsubfield=$input->param('tagsubfield');
! my $itemtype=$input->param('itemtype');
my $pkfield="tagfield";
my $offset=$input->param('offset');
--- 50,54 ----
my $tagfield=$input->param('tagfield');
my $tagsubfield=$input->param('tagsubfield');
! my $frameworkcode=$input->param('frameworkcode');
my $pkfield="tagfield";
my $offset=$input->param('offset');
***************
*** 70,79 ****
$template->param(script_name => $script_name,
tagfield =>$tagfield,
! itemtype => $itemtype,
$op => 1); # we
show only the TMPL_VAR names $op
} else {
$template->param(script_name => $script_name,
tagfield =>$tagfield,
! itemtype => $itemtype,
else => 1); # we
show only the TMPL_VAR names $op
}
--- 70,79 ----
$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
}
***************
*** 140,145 ****
# build values list
! my $sth=$dbh->prepare("select * from marc_subfield_structure where
tagfield=? and itemtype=?"); # and tagsubfield='$tagsubfield'");
! $sth->execute($tagfield,$itemtype);
my @loop_data = ();
my $toggle="white";
--- 140,145 ----
# build values list
! my $sth=$dbh->prepare("select * from marc_subfield_structure where
tagfield=? and frameworkcode=?"); # and tagsubfield='$tagsubfield'");
! $sth->execute($tagfield,$frameworkcode);
my @loop_data = ();
my $toggle="white";
***************
*** 254,258 ****
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
! my $sth=$dbh->prepare("replace marc_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,itemtype)
values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
--- 254,258 ----
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
! my $sth=$dbh->prepare("replace marc_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,frameworkcode)
values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
***************
*** 297,301 ****
$hidden,
$isurl,
!
$itemtype,
);
}
--- 297,301 ----
$hidden,
$isurl,
!
$frameworkcode,
);
}
***************
*** 303,307 ****
}
$sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=marc_subfields_structure.pl?tagfield=$tagfield&itemtype=$itemtype\"></html>";
exit;
--- 303,307 ----
}
$sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
***************
*** 311,315 ****
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select * from marc_subfield_structure where
tagfield=? and tagsubfield=? and itemtype=?");
$sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
--- 311,315 ----
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select * from marc_subfield_structure where
tagfield=? and tagsubfield=? and frameworkcode=?");
$sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
***************
*** 320,324 ****
tagfield
=>$tagfield,
tagsubfield =>
$tagsubfield,
! itemtype => $itemtype,
);
# END $OP eq DELETE_CONFIRM
--- 320,324 ----
tagfield
=>$tagfield,
tagsubfield =>
$tagsubfield,
! frameworkcode =>
$frameworkcode,
);
# END $OP eq DELETE_CONFIRM
***************
*** 328,336 ****
my $dbh = C4::Context->dbh;
unless (C4::Context->config('demo') eq 1) {
! my $sth=$dbh->prepare("delete from marc_subfield_structure
where tagfield=? and tagsubfield=? and itemtype=?");
! $sth->execute($tagfield,$tagsubfield,$itemtype);
$sth->finish;
}
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=marc_subfields_structure.pl?tagfield=$tagfield&itemtype=$itemtype\"></html>";
exit;
$template->param(tagfield => $tagfield);
--- 328,336 ----
my $dbh = C4::Context->dbh;
unless (C4::Context->config('demo') eq 1) {
! my $sth=$dbh->prepare("delete from marc_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=marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
$template->param(tagfield => $tagfield);
***************
*** 339,343 ****
} else { # DEFAULT
my $env;
! my ($count,$results)=StringSearch($env,$tagfield,$itemtype);
my $toggle="white";
my @loop_data = ();
--- 339,343 ----
} else { # DEFAULT
my $env;
! my ($count,$results)=StringSearch($env,$tagfield,$frameworkcode);
my $toggle="white";
my @loop_data = ();
***************
*** 362,366 ****
$row_data{hidden} = $results->[$i]{'hidden'};
$row_data{isurl} = $results->[$i]{'isurl'};
! $row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&itemtype=$itemtype";
$row_data{bgcolor} = $toggle;
if ($row_data{tab} eq -1) {
--- 362,366 ----
$row_data{hidden} = $results->[$i]{'hidden'};
$row_data{isurl} = $results->[$i]{'isurl'};
! $row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&frameworkcode=$frameworkcode";
$row_data{bgcolor} = $toggle;
if ($row_data{tab} eq -1) {
***************
*** 371,375 ****
}
$template->param(loop => address@hidden);
! $template->param(edit => "<a
href=\"$script_name?op=add_form&tagfield=$tagfield&itemtype=$itemtype\">");
if ($offset>0) {
my $prevpage = $offset-$pagesize;
--- 371,375 ----
}
$template->param(loop => address@hidden);
! $template->param(edit => "<a
href=\"$script_name?op=add_form&tagfield=$tagfield&frameworkcode=$frameworkcode\">");
if ($offset>0) {
my $prevpage = $offset-$pagesize;
Index: marctagstructure.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/marctagstructure.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** marctagstructure.pl 18 May 2004 15:22:45 -0000 1.21
--- marctagstructure.pl 3 Jun 2004 10:01:28 -0000 1.22
***************
*** 32,40 ****
# retrieve parameters
my $input = new CGI;
! my $itemtype = $input->param('itemtype'); # set to select framework
! $itemtype="" unless $itemtype;
! my $existingitemtype = $input->param('existingitemtype'); # set when we have
to create a new framework (in itemtype) by copying an old one (in
existingitemtype)
! $existingitemtype = "" unless $existingitemtype;
! my $itemtypeinfo = getitemtypeinfo($itemtype);
my $searchfield=$input->param('searchfield');
$searchfield=0 unless $searchfield;
--- 32,40 ----
# 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;
***************
*** 59,89 ****
});
! # get itemtype list
! my $itemtypes = getitemtypes;
! my @itemtypesloop;
! foreach my $thisitemtype (keys %$itemtypes) {
! my $selected = 1 if $thisitemtype eq $itemtype;
! my %row =(value => $thisitemtype,
selected => $selected,
! description =>
$itemtypes->{$thisitemtype}->{'description'},
);
! push @itemtypesloop, \%row;
}
! # check that itemtype framework is defined in marc_tag_structure
! my $sth=$dbh->prepare("select count(*) from marc_tag_structure where
itemtype=?");
! $sth->execute($itemtype);
! my ($itemtypeexist) = $sth->fetchrow;
! if ($itemtypeexist) {
} else {
! # if itemtype does not exists, then OP must be changed to "create
itemtype" if we are not on the way to create it
# (op = itemtyp_create_confirm)
! if ($op eq "itemtype_create_confirm") {
! duplicate_framework($itemtype, $existingitemtype);
} else {
! $op = "itemtype_create";
}
}
! $template->param(itemtypeloop => address@hidden);
if ($op) {
$template->param(script_name => $script_name,
--- 59,92 ----
});
! # 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 marc_tag_structure
! my $sth=$dbh->prepare("select count(*) from marc_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,
***************
*** 101,106 ****
my $data;
if ($searchfield) {
! $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
marc_tag_structure where tagfield=? and itemtype=?");
! $sth->execute($searchfield,$itemtype);
$data=$sth->fetchrow_hashref;
$sth->finish;
--- 104,109 ----
my $data;
if ($searchfield) {
! $sth=$dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
marc_tag_structure where tagfield=? and frameworkcode=?");
! $sth->execute($searchfield,$frameworkcode);
$data=$sth->fetchrow_hashref;
$sth->finish;
***************
*** 135,139 ****
mandatory =>
CGI::checkbox('mandatory',$data->{'mandatory'}?'checked':'',1,''),
authorised_value =>
$authorised_value,
! itemtype => $itemtype,
);
# END $OP eq ADD_FORM
--- 138,142 ----
mandatory =>
CGI::checkbox('mandatory',$data->{'mandatory'}?'checked':'',1,''),
authorised_value =>
$authorised_value,
! frameworkcode =>
$frameworkcode,
);
# END $OP eq ADD_FORM
***************
*** 141,145 ****
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
! $sth=$dbh->prepare("replace marc_tag_structure
(tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,itemtype)
values (?,?,?,?,?,?,?)");
my $tagfield =$input->param('tagfield');
my $liblibrarian = $input->param('liblibrarian');
--- 144,148 ----
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
! $sth=$dbh->prepare("replace marc_tag_structure
(tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode)
values (?,?,?,?,?,?,?)");
my $tagfield =$input->param('tagfield');
my $liblibrarian = $input->param('liblibrarian');
***************
*** 155,163 ****
$mandatory?1:0,
$authorised_value,
! $itemtype
);
}
$sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=marctagstructure.pl?tagfield=$tagfield&itemtype=$itemtype\"></html>";
exit;
# END $OP eq ADD_VALIDATE
--- 158,166 ----
$mandatory?1:0,
$authorised_value,
! $frameworkcode
);
}
$sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=marctagstructure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
exit;
# END $OP eq ADD_VALIDATE
***************
*** 165,174 ****
# 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
marc_tag_structure where tagfield=?");
! $sth->execute($searchfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
$template->param(liblibrarian => $data->{'liblibrarian'},
searchfield =>
$searchfield,
);
# END $OP eq DELETE_CONFIRM
--- 168,178 ----
# 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
marc_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
***************
*** 177,210 ****
} elsif ($op eq 'delete_confirmed') {
unless (C4::Context->config('demo') eq 1) {
! $dbh->do("delete from marc_tag_structure where
tagfield='$searchfield'");
! $dbh->do("delete from marc_subfield_structure where
tagfield='$searchfield'");
}
# END $OP eq DELETE_CONFIRMED
################## ITEMTYPE_CREATE ##################################
! # called automatically if an unexisting itemtype is selected
! } elsif ($op eq 'itemtype_create') {
! $sth = $dbh->prepare("select
count(*),marc_tag_structure.itemtype,description from
marc_tag_structure,itemtypes where
itemtypes.itemtype=marc_tag_structure.itemtype group by
marc_tag_structure.itemtype");
$sth->execute;
! my @existingitemtypeloop;
! while (my ($tot,$thisitemtype,$description) = $sth->fetchrow) {
if ($tot>0) {
! my %line = ( value => $thisitemtype,
! description => $description,
);
! push @existingitemtypeloop,\%line;
}
}
! $template->param(existingitemtypeloop => address@hidden,
! itemtype => $itemtype,
! ITdescription =>
$itemtypeinfo->{description},
);
################## DEFAULT ##################################
} else { # DEFAULT
! # here, $op can be unset or set to "itemtype_create_confirm".
if ($searchfield ne '') {
$template->param(searchfield => $searchfield);
}
my $env;
! my ($count,$results)=StringSearch($env,$searchfield,$itemtype);
my $toggle="white";
my @loop_data = ();
--- 181,214 ----
} elsif ($op eq 'delete_confirmed') {
unless (C4::Context->config('demo') eq 1) {
! $dbh->do("delete from marc_tag_structure where
tagfield='$searchfield' and frameworkcode='$frameworkcode'");
! $dbh->do("delete from marc_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(*),marc_tag_structure.frameworkcode,frameworktext from
marc_tag_structure,biblio_framework where
biblio_framework.frameworkcode=marc_tag_structure.frameworkcode group by
marc_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 $env;
! my ($count,$results)=StringSearch($env,$searchfield,$frameworkcode);
my $toggle="white";
my @loop_data = ();
***************
*** 221,227 ****
$row_data{mandatory} = $results->[$i]{'mandatory'};
$row_data{authorised_value} =
$results->[$i]{'authorised_value'};
! $row_data{subfield_link}
="marc_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&itemtype=".$itemtype;
! $row_data{edit} =
"$script_name?op=add_form&searchfield=".$results->[$i]{'tagfield'}."&itemtype=".$itemtype;
! $row_data{delete} =
"$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&itemtype=".$itemtype;
$row_data{bgcolor} = $toggle;
push(@loop_data, \%row_data);
--- 225,231 ----
$row_data{mandatory} = $results->[$i]{'mandatory'};
$row_data{authorised_value} =
$results->[$i]{'authorised_value'};
! $row_data{subfield_link}
="marc_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{bgcolor} = $toggle;
push(@loop_data, \%row_data);
***************
*** 234,238 ****
searchfield => $searchfield,
script_name => $script_name,
! itemtype => $itemtype,
);
}
--- 238,242 ----
searchfield => $searchfield,
script_name => $script_name,
! frameworkcode => $frameworkcode,
);
}
***************
*** 242,246 ****
searchfield => $searchfield,
script_name => $script_name,
! itemtype => $itemtype,
);
}
--- 246,250 ----
searchfield => $searchfield,
script_name => $script_name,
! frameworkcode => $frameworkcode,
);
}
***************
*** 255,265 ****
#
sub StringSearch {
! my ($env,$searchstring,$itemtype)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
marc_tag_structure where (tagfield >= ? and itemtype=?) order by tagfield");
! $sth->execute($data[0], $itemtype);
my @results;
while (my $data=$sth->fetchrow_hashref){
--- 259,269 ----
#
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
marc_tag_structure where (tagfield >= ? and frameworkcode=?) order by
tagfield");
! $sth->execute($data[0], $frameworkcode);
my @results;
while (my $data=$sth->fetchrow_hashref){
***************
*** 275,291 ****
#
sub duplicate_framework {
! my ($newitemtype,$olditemtype) = @_;
! my $sth = $dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
marc_tag_structure where itemtype=?");
! $sth->execute($olditemtype);
! my $sth_insert = $dbh->prepare("insert into marc_tag_structure
(tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value,
itemtype) values (?,?,?,?,?,?,?)");
while ( my
($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) =
$sth->fetchrow) {
!
$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newitemtype);
}
! $sth = $dbh->prepare("select
itemtype,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso
from marc_subfield_structure where itemtype=?");
! $sth->execute($olditemtype);
! $sth_insert = $dbh->prepare("insert into marc_subfield_structure
(itemtype,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso)
values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
! while ( my ($itemtype, $tagfield, $tagsubfield, $liblibrarian,
$libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso) = $sth->fetchrow) {
! $sth_insert->execute($newitemtype, $tagfield, $tagsubfield,
$liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab,
$authorised_value, $thesaurus_category, $value_builder, $seealso);
}
}
--- 279,295 ----
#
sub duplicate_framework {
! my ($newframeworkcode,$oldframeworkcode) = @_;
! my $sth = $dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
marc_tag_structure where frameworkcode=?");
! $sth->execute($oldframeworkcode);
! my $sth_insert = $dbh->prepare("insert into marc_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,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso
from marc_subfield_structure where frameworkcode=?");
! $sth->execute($oldframeworkcode);
! $sth_insert = $dbh->prepare("insert into marc_subfield_structure
(frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso)
values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
! while ( my ($frameworkcode, $tagfield, $tagsubfield, $liblibrarian,
$libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value,
$thesaurus_category, $value_builder, $seealso) = $sth->fetchrow) {
! $sth_insert->execute($newframeworkcode, $tagfield,
$tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield,
$tab, $authorised_value, $thesaurus_category, $value_builder, $seealso);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/admin biblio_framework.pl,NONE,1.1 auth_subfields_structure.pl,1.1,1.2 authtypes.pl,1.1,1.2 marc_subfields_structure.pl,1.22,1.23 marctagstructure.pl,1.21,1.22,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.37,1.38 addbooks.pl,1.20,1.21 additem.pl,1.24,1.25
- Next by Date:
[Koha-cvs] CVS: koha/C4 Output.pm,1.47,1.48
- Previous by thread:
[Koha-cvs] CVS: koha/acqui.simple addbiblio.pl,1.37,1.38 addbooks.pl,1.20,1.21 additem.pl,1.24,1.25
- Next by thread:
[Koha-cvs] CVS: koha/C4 Output.pm,1.47,1.48
- Index(es):