This is an unusual commit. The main purpose is a working model of Zebra on a modified rel2_2.

Any questions regarding these commits should be asked to Joshua Ferraro unless you are Joshua whom I'll report to
This commit is contained in:
tgarip1957 2006-05-28 18:49:12 +00:00
parent 4f60cc1754
commit 738ea6504e
26 changed files with 3079 additions and 2618 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,10 +34,10 @@ use C4::Context;
use C4::Stats;
use C4::Reserves2;
use C4::Koha;
use C4::Biblio;
use C4::Accounts;
use Date::Manip;
#use Date::Manip;
use C4::Biblio;
use C4::Calendar::Calendar;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
@ -86,12 +86,26 @@ sub itemseen {
$sth->execute($itemnum);
return;
}
sub itemseenbarcode {
my ($env,$itemnum) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("update items set itemlost=0, datelastseen = now() where items.barcode = ?");
$sth->execute($itemnum);
return;
}
sub listitemsforinventory {
my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_;
my $sth;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("select itemnumber,barcode,itemcallnumber,title,author from items,biblio where items.biblionumber=biblio.biblionumber and itemcallnumber>= ? and itemcallnumber <=? and (datelastseen< ? or datelastseen is null) order by itemcallnumber,title");
$sth->execute($minlocation,$maxlocation,$datelastseen);
if ($datelastseen){
$sth = $dbh->prepare("select itemnumber,items.biblionumber,items.biblioitemnumber,barcode,itemcallnumber,title,author from items,biblio,biblioitems where items.biblionumber=biblio.biblionumber and biblioitems.biblionumber=biblio.biblionumber and itemcallnumber>= '$minlocation' and itemcallnumber <='$maxlocation' and (datelastseen< '$datelastseen' or datelastseen is null) order by lcsort,Cutterextra");
}else{
$sth = $dbh->prepare("select itemnumber,items.biblionumber,items.biblioitemnumber,barcode,itemcallnumber,title,author from items,biblio,biblioitems where items.biblionumber=biblio.biblionumber and biblioitems.biblionumber=biblio.biblionumber and itemcallnumber>= '$minlocation' and itemcallnumber <='$maxlocation' order by lcsort,Cutterextra");
}
$sth->execute();
my @results;
while (my $row = $sth->fetchrow_hashref) {
$offset-- if ($offset);
@ -236,12 +250,6 @@ sub getpatroninformation {
$sth->finish;
$borrower->{'flags'}=$flags;
$borrower->{'authflags'} = $accessflagshash;
# find out how long the membership lasts
my $sth=$dbh->prepare("select enrolmentperiod from categories where categorycode = ?");
$sth->execute($borrower->{'categorycode'});
my $enrolment = $sth->fetchrow;
$borrower->{'enrolmentperiod'} = $enrolment;
return ($borrower); #, $flags, $accessflagshash);
}
@ -441,7 +449,7 @@ The item was eligible to be transferred. Barring problems communicating with the
# Perl, though).
sub transferbook {
# transfer book code....
my ($tbr, $barcode, $ignoreRs) = @_;
my ($tbr, $barcode, $ignoreRs,$user) = @_;
my $messages;
my %env;
my $dotransfer = 1;
@ -482,15 +490,7 @@ sub transferbook {
}
#actually do the transfer....
if ($dotransfer) {
dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr);
my $dbh= C4::Context->dbh;
my ($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"items.holdingbranch");
my $bibid = MARCfind_MARCbibid_from_oldbiblionumber( $dbh, $iteminformation->{'biblionumber'} );
my $marcitem = MARCgetitem($dbh, $bibid, $iteminformation->{'itemnumber'});
if ($marcitem->field($tagfield)){
$marcitem->field($tagfield)->update($tagsubfield=> $tbr);
MARCmoditem($dbh,$marcitem,$bibid,$iteminformation->{'itemnumber'});
}
dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr,$user);
$messages->{'WasTransfered'} = 1;
}
return ($dotransfer, $messages, $iteminformation);
@ -500,20 +500,33 @@ sub transferbook {
# FIXME - This is only used in &transferbook. Why bother making it a
# separate function?
sub dotransfer {
my ($itm, $fbr, $tbr) = @_;
my ($itm, $fbr, $tbr,$user) = @_;
my $dbh = C4::Context->dbh;
$itm = $dbh->quote($itm);
$fbr = $dbh->quote($fbr);
$tbr = $dbh->quote($tbr);
$user = $dbh->quote($user);
#new entry in branchtransfers....
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch)
VALUES ($itm, $fbr, now(), $tbr)");
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch,comments) VALUES ($itm, $fbr, now(), $tbr,$user)");
#update holdingbranch in items .....
$dbh->do("UPDATE items set holdingbranch = $tbr WHERE items.itemnumber = $itm");
&itemseen($itm);
&domarctransfer($dbh,$itm);
return;
}
##New sub to dotransfer in marc tables as well. Not exported -TG 01/10/2005
sub domarctransfer{
my ($dbh,$itemnumber) = @_;
my $sth=$dbh->prepare("select biblionumber,holdingbranch from items where itemnumber=$itemnumber");
$sth->execute();
my ($biblionumber,$holdingbranch)=$sth->fetchrow;
$itemnumber=~s /\'//g;
&MARCmoditemonefield($dbh,$biblionumber,$itemnumber,'items.holdingbranch',$holdingbranch);
}
=head2 canbookbeissued
Check if a book can be issued.
@ -611,14 +624,123 @@ sub TooMany ($$){
my $cat_borrower = $borrower->{'categorycode'};
my $branch_borrower = $borrower->{'branchcode'};
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
$sth->execute($iteminformation->{'biblionumber'});
my $type = $sth->fetchrow;
$sth->finish;
$sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?');
my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s, items it where i.borrowernumber = ? and i.returndate is null and i.itemnumber = it.itemnumber and it.biblioitemnumber = s.biblioitemnumber and s.itemtype like ?");
my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null');
my $alreadyissued;
# check the 3 parameters
#print "content-type: text/plain \n\n";
#print "$cat_borrower, $type, $branch_borrower";
$sth->execute($cat_borrower, $type, $branch_borrower);
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
# print "content-type: text/plain \n\n";
#print "$cat_borrower, $type, $branch_borrower";
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
# print "***" . $alreadyissued;
#print "----". $result->{'maxissueqty'};
if (defined($result->{'maxissueqty'})) {
return ($alreadyissued,($result->{'maxissueqty'}+0),$cat_borrower, $type, $branch_borrower, $result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
# check for branch=*
$sth->execute($cat_borrower, $type, "");
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),$cat_borrower, $type, "",$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
# check for itemtype=*
$sth->execute($cat_borrower, "*", $branch_borrower);
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
my $alreadyissued = $sth3->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),$cat_borrower, "*", $branch_borrower,$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
#check for borrowertype=*
$sth->execute("*", $type, $branch_borrower);
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),"*", $type, $branch_borrower,$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
#check for borrowertype=*;itemtype=*
$sth->execute("*", "*", $branch_borrower);
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
my $alreadyissued = $sth3->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),"*", "*", $branch_borrower,$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
#check for borrowertype=*;branch=""
$sth->execute("*", $type, "");
my $result = $sth->fetchrow_hashref;
if (defined($result) && $result->{maxissueqty}>=0) {
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),"*", $type, "",$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
$sth->execute($cat_borrower, "*", "");
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),$cat_borrower, "*", "",$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
$sth->execute("*", "*", "");
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
my $alreadyissued = $sth3->fetchrow;
if (defined($result->{maxissueqty})) {
return ($alreadyissued,($result->{maxissueqty}+0),"*", "*", "",$result->{'issuelength'}) if ($result->{'maxissueqty'} <= $alreadyissued);
}
}
return (undef, undef, undef, undef, undef, undef);
}
sub TooMany2 ($$){
my $borrower = shift;
my $iteminformation = shift;
my $cat_borrower = $borrower->{'categorycode'};
my $branch_borrower = $borrower->{'branchcode'};
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
$sth->execute($iteminformation->{'biblionumber'});
my $type = $sth->fetchrow;
$sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?');
# my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?");
my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s1, items s2 where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s2.itemnumber and s1.itemtype like ? and s1.biblioitemnumber = s2.biblioitemnumber");
my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?");
my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null');
my $alreadyissued;
# check the 3 parameters
@ -644,7 +766,7 @@ sub TooMany ($$){
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
my ($alreadyissued) = $sth3->fetchrow;
warn "HERE : $alreadyissued / ($result->{maxissueqty} for $borrower->{'borrowernumber'}";
# warn "HERE : $alreadyissued / ($result->{maxissueqty} for $borrower->{'borrowernumber'}";
return ("c $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
}
#check for borrowertype=*
@ -715,7 +837,7 @@ sub canbookbeissued {
if ($borrower->{flags}->{'DBARRED'}) {
$issuingimpossible{DEBARRED} = 1;
}
if (&Date_Cmp(&ParseDate($borrower->{expiry}),&ParseDate("today"))<0) {
if (DATE_diff($borrower->{expiry},'CURRENT_DATE')<0) {
$issuingimpossible{EXPIRED} = 1;
}
#
@ -732,8 +854,20 @@ sub canbookbeissued {
#
# JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
#
my $toomany = TooMany($borrower, $iteminformation);
$needsconfirmation{TOO_MANY} = $toomany if $toomany;
# my $toomany = TooMany($borrower, $iteminformation);
# $needsconfirmation{TOO_MANY} = $toomany if $toomany;
my ($already_issues,
$max_issues,
$categorycode_rule,
$itemtype_rule,
$branchcode_rule,
$issue_lenght) = TooMany($borrower, $iteminformation);
$needsconfirmation{TOO_MANY} = $already_issues." / ".$max_issues if defined($already_issues);
$needsconfirmation{TOO_MANY_CATEGORYCODE} = $categorycode_rule if defined($already_issues);
$needsconfirmation{TOO_MANY_ITEMTYPE} = $itemtype_rule if defined($already_issues);
$needsconfirmation{TOO_MANY_BRANCHCODE} = $branchcode_rule if defined($already_issues);
#
# ITEM CHECKING
@ -753,16 +887,11 @@ sub canbookbeissued {
if ($iteminformation->{'restricted'} == 1) {
$issuingimpossible{RESTRICTED} = 1;
}
if (C4::Context->preference("IndependantBranches")){
my $userenv = C4::Context->userenv;
if (($userenv)&&($userenv->{flags} != 1)){
$issuingimpossible{NOTSAMEBRANCH} = 1 if ($iteminformation->{'holdingbranch'} ne $userenv->{branch} ) ;
}
if ($iteminformation->{'stack'} eq 'Res') {
$issuingimpossible{IN_RESERVE} = 1;
}
#
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
#
@ -774,7 +903,10 @@ sub canbookbeissued {
if ($renewstatus == 0) { # no more renewals allowed
$issuingimpossible{NO_MORE_RENEWALS} = 1;
} else {
$needsconfirmation{RENEW_ISSUE} = 1;
}
} elsif ($currentborrower) {
# issued to someone else
@ -782,7 +914,7 @@ sub canbookbeissued {
# warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
$needsconfirmation{ISSUED_TO_ANOTHER} = "$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
}
# See if the item is on reserve.
# See if the item is on RESERVE
my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
if ($restype) {
my $resbor = $res->{'borrowernumber'};
@ -793,7 +925,7 @@ sub canbookbeissued {
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
$needsconfirmation{RESERVE_WAITING} = "$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)";
# CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'}); Doesn't belong in a checking subroutine.
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
} elsif ($restype eq "Reserved") {
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
@ -828,7 +960,9 @@ C<$date> contains the max date of return. calculated if empty.
#
sub issuebook {
my ($env,$borrower,$barcode,$date,$cancelreserve) = @_;
my $dbh = C4::Context->dbh;
my $dbh = C4::Context->dbh;
#warn "tring to issue";
my $error;
# my ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, 0);
my $iteminformation = getiteminformation($env, 0, $barcode);
# warn "B : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
@ -843,7 +977,11 @@ sub issuebook {
$iteminformation->{'charge'} = $charge;
}
&UpdateStats($env,$env->{'branchcode'},'renew',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'itemtype'},$borrower->{'borrowernumber'});
renewbook($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
$error=renewstatus($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
renewbook($env, $borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}) if ($error>1);
#warn "renew : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
} else {
#
# NOT a renewal
@ -852,27 +990,28 @@ sub issuebook {
# This book is currently on loan, but not to the person
# who wants to borrow it now. mark it returned before issuing to the new borrower
returnbook($iteminformation->{'barcode'}, $env->{'branchcode'});
#warn "return : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
}
# See if the item is on reserve.
my ($restype, $res) = CheckReserves($iteminformation->{'itemnumber'});
#warn "$restype,$res";
if ($restype) {
my $resbor = $res->{'borrowernumber'};
if ($resbor eq $borrower->{'borrowernumber'}) {
# The item is on reserve to the current patron
FillReserve($res);
warn "FillReserve";
# warn "FillReserve";
} elsif ($restype eq "Waiting") {
warn "Waiting";
# warn "Waiting";
# The item is on reserve and waiting, but has been
# reserved by some other patron.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
if ($cancelreserve){
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
}
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
} elsif ($restype eq "Reserved") {
warn "Reserved";
# warn "Reserved";
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
@ -881,37 +1020,46 @@ sub issuebook {
# cancel reserves on this item
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
# also cancel reserve on biblio related to this item
#my $st_Fbiblio = $dbh->prepare("select biblionumber from items where itemnumber=?");
#$st_Fbiblio->execute($res->{'itemnumber'});
#my $biblionumber = $st_Fbiblio->fetchrow;
#CancelReserve($biblionumber,0,$res->{'borrowernumber'});
#warn "CancelReserve $res->{'itemnumber'}, $res->{'borrowernumber'}";
my $st_Fbiblio = $dbh->prepare("select biblionumber from items where itemnumber=?");
$st_Fbiblio->execute($res->{'itemnumber'});
my $biblionumber = $st_Fbiblio->fetchrow;
CancelReserve($biblionumber,0,$res->{'borrowernumber'});
# warn "CancelReserve $res->{'itemnumber'}, $res->{'borrowernumber'}";
} else {
# my $tobrcd = ReserveWaiting($res->{'itemnumber'}, $res->{'borrowernumber'});
# transferbook($tobrcd,$barcode, 1);
warn "transferbook";
# warn "transferbook";
}
}
}
# Record in the database the fact that the book was issued.
my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode) values (?,?,?,?)");
my $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
my $datedue=time+($loanlength)*86400;
my @datearr = localtime($datedue);
my $dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode,issue_date) values (?,?,?,?,NOW())");
my @datearr = localtime();
# my $dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
my @datearr;
my $dateduef;
my $daysMode = C4::Context->preference('useDaysMode');
@datearr = localtime();
$dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $calendar = C4::Calendar::Calendar->new(branchcode => $borrower->{'branchcode'});
my ($yeardue, $monthdue, $daydue) = split /-/, $dateduef;
($daydue, $monthdue, $yeardue) = $calendar->addDate($daydue, $monthdue, $yeardue, $loanlength);
$dateduef = "$yeardue-".sprintf ("%0.2d", $monthdue)."-". sprintf("%0.2d",$daydue);
#warn "issue : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
if ($date) {
$dateduef=$date;
}
# if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate
if (C4::Context->preference('ReturnBeforeExpiry') && $dateduef gt $borrower->{expiry}) {
$dateduef=$borrower->{expiry};
}
$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef, $env->{'branchcode'});
$sth->finish;
$iteminformation->{'issues'}++;
$sth=$dbh->prepare("update items set issues=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth=$dbh->prepare("update items set issues=?, onloan=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$dateduef,$iteminformation->{'itemnumber'});
$sth->finish;
&MARCmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'items.onloan',$dateduef);
&itemseen($iteminformation->{'itemnumber'});
# If it costs to borrow this book, charge it to the patron's account.
my ($charge,$itemtype)=calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'});
@ -922,6 +1070,7 @@ sub issuebook {
# Record the fact that this book was issued.
&UpdateStats($env,$env->{'branchcode'},'issue',$charge,'',$iteminformation->{'itemnumber'},$iteminformation->{'itemtype'},$borrower->{'borrowernumber'});
}
return($error);
}
=head2 getLoanLength
@ -1072,6 +1221,10 @@ sub returnbook {
my $sth = $dbh->prepare("update issues set returndate = now() where (borrowernumber = ?) and (itemnumber = ?) and (returndate is null)");
$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right?
$sth=$dbh->prepare("update items set onloan=NULL where itemnumber=?");
$sth->execute($iteminformation->{'itemnumber'});
$sth->finish;
&MARCmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'items.onloan',"0000-00-00");
}
itemseen($iteminformation->{'itemnumber'});
($borrower) = getpatroninformation(\%env, $currentborrower, 0);
@ -1215,7 +1368,7 @@ sub fixoverduesonreturn {
$sth->execute($brn,$itm);
# alter fine to show that the book has been returned
if (my $data = $sth->fetchrow_hashref) {
my $usth=$dbh->prepare("update accountlines set accounttype='F' where (borrowernumber = ?) and (itemnumber = ?) and (acccountno = ?)");
my $usth=$dbh->prepare("update accountlines set accounttype='F' where (borrowernumber = ?) and (itemnumber = ?) and (accountno = ?)");
$usth->execute($brn,$itm,$data->{'accountno'});
$usth->finish();
}
@ -1620,12 +1773,16 @@ already renewed the loan.
sub renewstatus {
# check renewal status
my ($env,$bornum,$itemno)=@_;
my $dbh = C4::Context->dbh;
my $dbh=C4::Context->dbh;
my $renews = 1;
my $renewokay = 0;
my $renewokay; ##
# Look in the issues table for this item, lent to this borrower,
# and not yet returned.
my $borrower=getpatroninformation($dbh,$bornum,undef);
if ($borrower->{'categorycode'} eq 'F' ||$borrower->{'categorycode'} eq 'P'){
$renewokay = 1;
}
# FIXME - I think this function could be redone to use only one SQL call.
my $sth1 = $dbh->prepare("select * from issues
where (borrowernumber = ?)
@ -1645,23 +1802,53 @@ sub renewstatus {
and (biblioitems.itemtype = itemtypes.itemtype)");
$sth2->execute($itemno);
if (my $data2=$sth2->fetchrow_hashref) {
$renews = $data2->{'renewalsallowed'};
$renews = $data2->{'renewalsallowed'};
}
if ($renews > $data1->{'renewals'}) {
$renewokay = 1;
$renewokay= 1;
}else{
$renewokay=3;
}
$sth2->finish;
my ($resfound, $resrec) = CheckReserves($itemno);
if ($resfound) {
$renewokay = 0;
$renewokay=4;
}
my ($resfound, $resrec) = CheckReserves($itemno);
if ($resfound) {
$renewokay = 0;
$renewokay=4;
}
}
$sth1->finish;
## Try to find whether book can be renewed at this date
my $loanlength;
my $allowRenewalsBefore = C4::Context->preference("allowRenewalsBefore");
my @nowarr = localtime(time);
my $now = (1900+$nowarr[5])."-".($nowarr[4]+1)."-".$nowarr[3];
# Find the issues record for this book### Use the items table -->quicker
my $sth=$dbh->prepare("select onloan from items where itemnumber=? ");
$sth->execute($itemno);
my $issuedata=$sth->fetchrow;
$sth->finish;
#calculates the date on the we are allowed to renew the item
my $sth = $dbh->prepare("SELECT (DATE_SUB( ?, INTERVAL ? DAY))");
$sth->execute($issuedata, $allowRenewalsBefore);
my $startdate = $sth->fetchrow;
$sth->finish;
my $sth = $dbh->prepare("SELECT DATEDIFF(CURRENT_DATE,?)");
$sth->execute($startdate);
my $difference = $sth->fetchrow;
$sth->finish;
if ($difference < 0) {
$renewokay=2;
}
return($renewokay);
}
@ -1690,34 +1877,72 @@ C<$datedue> should be in the form YYYY-MM-DD.
=cut
sub renewbook {
# mark book as renewed
my ($env,$bornum,$itemno,$datedue)=@_;
my $dbh = C4::Context->dbh;
# mark book as renewed
# If the due date wasn't specified, calculate it by adding the
# book's loan length to today's date.
if ($datedue eq "" ) {
#debug_msg($env, "getting date");
my $iteminformation = getiteminformation($env, $itemno,0);
my $borrower = getpatroninformation($env,$bornum,0);
my $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
$datedue = UnixDate(DateCalc("today","$loanlength days"),"%Y-%m-%d");
my $loanlength;
my $dbh=C4::Context->dbh;
my $iteminformation = getiteminformation($env, $itemno,0);
# Find the issues record for this book### Use the items table -->quicker
my $sth=$dbh->prepare("select onloan from items where itemnumber=? ");
$sth->execute($itemno);
my $issuedata=$sth->fetchrow;
$sth->finish;
## We find a new datedue either from today or from the due_date of the book- T.G
if ($datedue eq "" ) {
my $borrower = getpatroninformation($env,$bornum,0);
$loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
my @nowarr = localtime(time);
my $now = (1900+$nowarr[5])."-".($nowarr[4]+1)."-".$nowarr[3];
if ($issuedata<=$now){
$datedue=$issuedata;
my $calendar = C4::Calendar::Calendar->new(branchcode => $borrower->{'branchcode'});
my ($yeardue, $monthdue, $daydue) = split /-/, $datedue;
($daydue, $monthdue, $yeardue) = $calendar->addDate($daydue, $monthdue, $yeardue, $loanlength);
$datedue = "$yeardue-".sprintf ("%0.2d", $monthdue)."-". sprintf("%0.2d",$daydue);
}else{
my @datearr = localtime();
$datedue = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $calendar = C4::Calendar::Calendar->new(branchcode => $borrower->{'branchcode'});
my ($yeardue, $monthdue, $daydue) = split /-/, $datedue;
($daydue, $monthdue, $yeardue) = $calendar->addDate($daydue, $monthdue, $yeardue, $loanlength);
$datedue = "$yeardue-".sprintf ("%0.2d", $monthdue)."-". sprintf("%0.2d",$daydue);
}
# Find the issues record for this book
my $sth=$dbh->prepare("select * from issues where borrowernumber=? and itemnumber=? and returndate is null");
$sth->execute($bornum,$itemno);
my $issuedata=$sth->fetchrow_hashref;
$sth->finish;
## Only update the renewal if we have a new $duedate -T.G
# Update the issues record to have the new due date, and a new count
# of how many times it has been renewed.
my $renews = $issuedata->{'renewals'} +1;
$sth=$dbh->prepare("update issues set date_due = ?, renewals = ?
#my $renews = $issuedata->{'renewals'} +1;
$sth=$dbh->prepare("update issues set date_due = ?, renewals = renewals+1
where borrowernumber=? and itemnumber=? and returndate is null");
$sth->execute($datedue,$renews,$bornum,$itemno);
$sth->execute($datedue,$bornum,$itemno);
$sth->finish;
## Update items and marc record with new date -T.G
my $iteminformation = getiteminformation($env, $itemno,0);
$sth=$dbh->prepare("update items set issues=?, onloan=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'}+1,$datedue,$itemno);
$sth->finish;
&MARCmoditemonefield($dbh,$iteminformation->{'biblionumber'},$iteminformation->{'itemnumber'},'items.onloan',$datedue);
# Log the renewal
UpdateStats($env,$env->{'branchcode'},'renew','','',$itemno);
@ -1731,9 +1956,13 @@ sub renewbook {
$sth->execute($bornum,$accountno,$charge,"Renewal of Rental Item $item->{'title'} $item->{'barcode'}",'Rent',$charge,$itemno);
$sth->finish;
# print $account;
}
}# end of rental charge
}
# return();
}
@ -1913,6 +2142,15 @@ sub fixdate {
return ($date, $invalidduedate);
}
sub DATE_diff {
my ($date1,$date2)=@_;
my $dbh=C4::Context->dbh;
my $sth = $dbh->prepare("SELECT DATEDIFF(?,?)");
$sth->execute($date1,$date2);
my $difference = $sth->fetchrow;
$sth->finish;
return $difference;
}
1;
__END__

View File

@ -16,12 +16,11 @@
# Suite 330, Boston, MA 02111-1307 USA
# $Id$
package C4::Context;
use strict;
use DBI;
use C4::Boolean;
use ZOOM;
use XML::Simple;
use vars qw($VERSION $AUTOLOAD),
qw($context),
qw(@context_stack);
@ -37,7 +36,7 @@ C4::Context - Maintain and manipulate the context of a Koha script
use C4::Context;
use C4::Context("/path/to/koha.conf");
use C4::Context("/path/to/koha.xml");
$config_value = C4::Context->config("config_variable");
$db_handle = C4::Context->dbh;
@ -83,7 +82,7 @@ environment variable to the pathname of a configuration file to use.
# config
# A reference-to-hash whose keys and values are the
# configuration variables and values specified in the config
# file (/etc/koha.conf).
# file (/etc/koha.xml).
# dbh
# A handle to the appropriate database for this context.
# dbh_stack
@ -92,7 +91,7 @@ environment variable to the pathname of a configuration file to use.
# Zconn
# A connection object for the Zebra server
use constant CONFIG_FNAME => "/etc/koha.conf";
use constant CONFIG_FNAME => "/etc2/koha.xml";
# Default config file, if none is specified
$context = undef; # Initially, no context is set
@ -116,47 +115,13 @@ $context = undef; # Initially, no context is set
sub read_config_file
{
my $fname = shift; # Config file to read
my $retval = {}; # Return value: ref-to-hash holding the
# configuration
open (CONF, $fname) or return undef;
my $koha = XMLin($fname, keyattr => ['id'],forcearray => ['listen']);
while (<CONF>)
{
my $var; # Variable name
my $value; # Variable value
chomp;
s/#.*//; # Strip comments
next if /^\s*$/; # Ignore blank lines
# Look for a line of the form
# var = value
if (!/^\s*(\w+)\s*=\s*(.*?)\s*$/)
{
print STDERR
"$_ isn't a variable assignment, skipping it";
next;
}
# Found a variable assignment
if ( exists $retval->{$1} )
{
print STDERR "$var was already defined, ignoring\n";
}else{
# Quick hack for allowing databases name in full text
if ( $1 eq "db_scheme" )
{
$value = db_scheme2dbi($2);
}else {
$value = $2;
}
$retval->{$1} = $value;
}
}
close CONF;
return $retval;
return $koha;
}
# db_scheme2dbi
@ -221,10 +186,12 @@ sub new
# that. Otherwise, use the built-in default.
$conf_fname = $ENV{"KOHA_CONF"} || CONFIG_FNAME;
}
# Load the desired config file.
$self = read_config_file($conf_fname);
$self->{"config_file"} = $conf_fname;
# Load the desired config file.
$self->{"config"} = &read_config_file($conf_fname);
warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
return undef if !defined($self->{"config"});
@ -342,9 +309,23 @@ sub config
# to check the return value.
# Return the value of the requested config variable
return $context->{"config"}{$var};
return $context->{"config"}->{$var};
}
sub zebraconfig
{
my $self = shift;
my $var = shift; # The config variable to return
return undef if !defined($context->{"server"});
# Presumably $self->{config} might be
# undefined if the config file given to &new
# didn't exist, and the caller didn't bother
# to check the return value.
# Return the value of the requested config variable
return $context->{"server"}->{$var};
}
=item preference
$sys_preference = C4::Context->preference("some_variable");
@ -405,7 +386,7 @@ sub AUTOLOAD
=item Zconn
$Zconn = C4::Context->Zconn
$Zconnauth = C4::Context->Zconnauth
Returns a connection to the Zebra database for the current
context. If no connection has yet been made, this method
creates one and connects.
@ -414,34 +395,29 @@ creates one and connects.
sub Zconn {
my $self = shift;
my $server=shift;
my $Zconn;
if (defined($context->{"Zconn"})) {
if (defined($context->{"Zconn"})) {
$Zconn = $context->{"Zconn"};
return $context->{"Zconn"};
return $context->{"Zconn"};
} else {
$context->{"Zconn"} = &new_Zconn();
$context->{"Zconn"} = &new_Zconn($server);
return $context->{"Zconn"};
}
}
=item Zconnauth
Returns a connection to the Zebradb with write privileges.Requires setting from etc/koha.conf
zebradb,zebraport,zebrauser,zebrapass
=cut
sub Zconnauth {
my $self = shift;
my $server=shift;
my $Zconnauth;
if (defined($context->{"Zconnauth"})) {
$Zconnauth = $context->{"Zconnauth"};
return $context->{"Zconnauth"};
} else {
$context->{"Zconnauth"} = &new_Zconnauth();
##We destroy each connection made so create a new one
$context->{"Zconnauth"} = &new_Zconnauth($server);
return $context->{"Zconnauth"};
}
}
=item new_Zconn
Internal helper function. creates a new database connection from
@ -450,52 +426,74 @@ the data given in the current context and returns it.
=cut
sub new_Zconn {
use ZOOM;
my $server=shift;
my $tried==0;
my $Zconn;
my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"};
retry:
eval {
$Zconn=new ZOOM::Connection($context->{"config"}{"hostname"},$context->{"config"}{"zebraport"},database=>$context->{"config"}{"zebradb"},
$Zconn=new ZOOM::Connection($context->config("hostname"),$port,databaseName=>$context->{"config"}->{$server},
preferredRecordSyntax => "USmarc",elementSetName=> "F");
};
if ($@){
###Uncomment the lines below if you want to automatically restart your zebra if its stop
###The system call is for Windows it should be changed to unix deamon starting for Unix platforms
if ($@->code==10000 && $tried==0){ ##No connection try restarting Zebra
$tried==1;
my $res=system('sc start "Z39.50 Server" >c:/zebraserver/error.log');
goto "retry";
}else{
warn "Error ", $@->code(), ": ", $@->message(), "\n";
$Zconn="error";
return $Zconn;
}
}
return $Zconn;
}
## Zebra handler with write permission
sub new_Zconnauth {
use ZOOM;
my $server=shift;
my $tried==0;
my $Zconnauth;
warn "zebra user and pass";
warn $context->{"config"}{"zebrauser"};
warn $context->{"config"}{"zebrapass"};
eval{
$Zconnauth=new ZOOM::Connection($context->{"config"}{"hostname"},$context->{"config"}{"zebraport"},databaseName=>$context->{"config"}{"zebradb"},
user=>$context->{"config"}{"zebrauser"},
password=>$context->{"config"}{"zebrapass"},preferredRecordSyntax => "USmarc",elementSetName=> "F");
};
if ($@){
warn "Error ", $@->code(), ": ", $@->message(), "\n";
$Zconnauth="error";
return $Zconnauth;
}
my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"};
my $o = new ZOOM::Options();
$o->option(async => 1);
$o->option(preferredRecordSyntax => "usmarc");
$o->option(elementSetName => "F");
$o->option(user=>$context->{"config"}->{"zebrauser"});
$o->option(password=>$context->{"config"}->{"zebrapass"});
$o->option(databaseName=>$context->{"config"}->{$server});
retry:
$Zconnauth=create ZOOM::Connection($o);
$Zconnauth->connect($context->config("hostname"),$port );
return $Zconnauth;
}
# _new_dbh
# Internal helper function (not a method!). This creates a new
# database connection from the data given in the current context, and
# returns it.
sub _new_dbh
{
my $db_driver = $context->{"config"}{"db_scheme"} || "mysql";
my $db_name = $context->{"config"}{"database"};
my $db_host = $context->{"config"}{"hostname"};
my $db_user = $context->{"config"}{"user"};
my $db_passwd = $context->{"config"}{"pass"};
##correct name for db_schme
my $db_driver;
if ($context->config("db_scheme")){
$db_driver=db_scheme2dbi($context->config("db_scheme"));
}else{
$db_driver="mysql";
}
my $db_name = $context->config("database");
my $db_host = $context->config("hostname");
my $db_user = $context->config("user");
my $db_passwd = $context->config("pass");
my $dbh= DBI->connect("DBI:$db_driver:$db_name:$db_host",
$db_user, $db_passwd);
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config.
@ -734,7 +732,7 @@ set_userenv is called in Auth.pm
=cut
#'
sub set_userenv{
my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $userflags, $emailaddress)= @_;
my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress)= @_;
my $var=$context->{"activeuser"};
my $cell = {
"number" => $usernum,
@ -744,6 +742,7 @@ sub set_userenv{
# "surname" => $usersurname,
#possibly a law problem
"branch" => $userbranch,
"branchname" => $branchname,
"flags" => $userflags,
"emailaddress" => $emailaddress,
};
@ -814,17 +813,14 @@ Andrew Arensburger <arensb at ooblick dot com>
=cut
# $Log$
# Revision 1.18.2.5.2.4 2006/05/09 12:35:47 rangi
# debugging
# Revision 1.18.2.5.2.5 2006/05/28 18:49:12 tgarip1957
# This is an unusual commit. The main purpose is a working model of Zebra on a modified rel2_2.
# Any questions regarding these commits should be asked to Joshua Ferraro unless you are Joshua whom I'll report to
#
# Revision 1.18.2.5.2.3 2006/05/09 12:01:02 kados
# add use Zoom;
#
# Revision 1.18.2.5.2.2 2006/05/09 07:41:09 hdl
# Fixing a bracket
#
# Revision 1.18.2.5.2.1 2006/05/08 15:02:05 tgarip1957
# 2 Zebra connection handllers one for read one for write acess
# Revision 1.36 2006/05/09 13:28:08 tipaul
# adding the branchname and the librarian name in every page :
# - modified userenv to add branchname
# - modifier menus.inc to have the librarian name & userenv displayed on every page. they are in a librarian_information div.
#
# Revision 1.35 2006/04/13 08:40:11 plg
# bug fixed: typo on Zconnauth name

View File

@ -157,8 +157,8 @@ sub NewBorrowerNumber {
return($data->{'max(borrowernumber)'});
}
=item catalogsearch3 & catalogsearch4
####OBSOLETE replaced with catalogsearch3 & catalogsearch4
=item catalogsearch
($count, @results) = &catalogsearch($env, $type, $search, $num, $offset);
This is primarily a front-end to other, more specialized catalog
@ -197,7 +197,88 @@ HTML.
=cut
#'
sub catalogsearch {
my ($env,$type,$search,$num,$offset)=@_;
my $dbh = C4::Context->dbh;
# foreach my $key (%$search){
# $search->{$key}=$dbh->quote($search->{$key});
# }
my ($count,@results);
if ($search->{'itemnumber'} ne '' || $search->{'isbn'} ne ''){
# print STDERR "Doing a precise search\n";
($count,@results)=CatSearch($env,'precise',$search,$num,$offset);
} elsif ($search->{'subject'} ne ''){
($count,@results)=CatSearch($env,'subject',$search,$num,$offset);
} elsif ($search->{'keyword'} ne ''){
($count,@results)=&KeywordSearch($env,'keyword',$search,$num,$offset);
} else {
($count,@results)=CatSearch($env,'loose',$search,$num,$offset);
}
if ($env->{itemcount} eq '1') {
foreach my $data (@results){
my ($counts) = itemcount2($env, $data->{'biblionumber'}, 'intra');
my $subject2=$data->{'subject'};
$subject2=~ s/ /%20/g;
$data->{'itemcount'}=$counts->{'total'};
my $totalitemcounts=0;
foreach my $key (keys %$counts){
if ($key ne 'total'){ # FIXME - Should ignore 'order', too.
#$data->{'location'}.="$key $counts->{$key} ";
$totalitemcounts+=$counts->{$key};
$data->{'locationhash'}->{$key}=$counts->{$key};
}
}
my $locationtext='';
my $locationtextonly='';
my $notavailabletext='';
foreach (sort keys %{$data->{'locationhash'}}) {
if ($_ eq 'notavailable') {
$notavailabletext="Not available";
my $c=$data->{'locationhash'}->{$_};
$data->{'not-available-p'}=$totalitemcounts;
if ($totalitemcounts>1) {
$notavailabletext.=" ($c)";
$data->{'not-available-plural-p'}=1;
}
} else {
$locationtext.="$_";
my $c=$data->{'locationhash'}->{$_};
if ($_ eq 'Item Lost') {
$data->{'lost-p'}=$totalitemcounts;
$data->{'lost-plural-p'}=1
if $totalitemcounts > 1;
} elsif ($_ eq 'Withdrawn') {
$data->{'withdrawn-p'}=$totalitemcounts;
$data->{'withdrawn-plural-p'}=1
if $totalitemcounts > 1;
} elsif ($_ eq 'On Loan') {
$data->{'on-loan-p'}=$totalitemcounts;
$data->{'on-loan-plural-p'}=1
if $totalitemcounts > 1;
} else {
$locationtextonly.=$_;
$locationtextonly.=" ($c), "
if $totalitemcounts>1;
}
if ($totalitemcounts>1) {
$locationtext.=" ($c), ";
}
}
}
if ($notavailabletext) {
$locationtext.=$notavailabletext;
} else {
$locationtext=~s/, $//;
}
$data->{'location'}=$locationtext;
$data->{'location-only'}=$locationtextonly;
$data->{'subject2'}=$subject2;
$data->{'use-location-flags-p'}=1; # XXX
}
}
return ($count,@results);
}
sub add_html_bold_fields {
my ($type, $data, $search) = @_;
@ -588,7 +669,7 @@ sub CatSearch3 {
if ($search->{'order'} eq "1=1003 i<"){
$query.= " ORDER BY b.author ";
}elsif ($search->{'order'} ge "1=9 i<"){
$query.= " ORDER BY lcsort,subclass ";
$query.= " ORDER BY lcsort ";
}elsif ($search->{'order'} eq "1=4 i<"){
$query.= " ORDER BY title ";
}else{
@ -596,7 +677,7 @@ sub CatSearch3 {
}
}
#warn $query,@params;
#warn "$query,@params,";
$count_query = $query;
#execute the query and returns just the results between $num and $num + $offset
my $limit = $num + $offset;
@ -618,7 +699,20 @@ my %branches;
}
#Building shelving hash
my %shelves;
#find shelvingname
my $stackstatus = $dbh->prepare('select authorised_value from marc_subfield_structure where kohafield="items.stack"');
$stackstatus->execute;
my ($authorised_valuecode) = $stackstatus->fetchrow;
if ($authorised_valuecode) {
$stackstatus = $dbh->prepare("select lib,authorised_value from authorised_values where category=? ");
$stackstatus->execute($authorised_valuecode);
while (my $lib = $stackstatus->fetchrow_hashref){
$shelves{$lib->{'authorised_value'}} = $lib->{'lib'};
}
}
#search item field code
my $sth3 =
@ -639,7 +733,6 @@ my $toggle;
my $even;
#proccess just the results to show
while (my( $data,$rel) = $sth->fetchrow) {
if (($i >= $startfrom) && ($i < $limit)) {
my $marcrecord=MARCgetbiblio($dbh,$data);
@ -673,7 +766,7 @@ $item->{$code}=$field->subfield($subfieldstosearch{$code});
my $status;
$item->{'branchname'}=$branches{$item->{'holdingbranch'}};
$item->{'shelves'}=$shelves{$item->{stack}};
$status="Lost" if ($item->{'itemlost'}>0);
$status="Withdrawn" if ($item->{'wthdrawn'}>0) ;
if ($search->{'from'} eq "intranet"){
@ -682,7 +775,7 @@ $status="Due:".format_date($item->{'onloan'}) if ($item->{'onloan'}>0);
$status = $item->{'holdingbranch'}."-".$item->{'stack'}."[".$item->{'itemcallnumber'}."]" unless defined $status;
}else{
$status="On Loan" if ($item->{'onloan'}>0);
$status = $item->{'branchname'} unless defined $status;
$status = $item->{'branchname'}."[".$item->{'shelves'}."]" unless defined $status;
}
$counts{$status}++;
$counts{'total'}++;
@ -701,8 +794,7 @@ push @items,$item;
$oldbiblio->{'noitems'} = $noitems;
$oldbiblio->{'norequests'} = $norequests;
$oldbiblio->{'even'} = $even = not $even;
$oldbiblio->{'itemcount'} = $counts{'total'};
$oldbiblio->{'itemcount'} = $counts{'total'};
my $totalitemcounts = 0;
foreach my $key (keys %counts){
if ($key ne 'total'){
@ -768,8 +860,6 @@ sub catalogsearch4 {
} else {
($count,@results) = CatSearch4('loose',$search,$num,$offset);
}
return ($count,@results);
}
@ -803,19 +893,16 @@ sub CatSearch4 {
$query = " \@attr 1=1007 ".$search->{'biblionumber'};
}elsif ($search->{'authnumber'} ne ''){
if ($search->{'authtype'} eq 'AUTH'){
$query = " \@attr GILS 1=2068 ".$search->{'authnumber'};
}else{
## We may have more than 1 authnumber so split
my @auths = split /,/, $search->{'authnumber'};
my $i;
for ( $i = 0; $i < @auths ;$i++) {
$query .= " \@attr GILS 1=2057 ". $auths[$i] ;
}
$query = "\@or ".$query if ($i>1);
}
my $n=0;
my @ids=split / /,$search->{'authnumber'} ;
foreach my $id (@ids){
$query .= " \@attr GILS 1=2057 ".$id;
$n++;
}
if ($n>1){
$query= "\@or ".$query;
}
}
#add branch condition
if ($search->{'branch'} ne '') {
@ -859,7 +946,11 @@ sub CatSearch4 {
$query .= " \@attr 1=1033 \"".$search->{'branch'}."\"";
}
if ($search->{'stack'} ne '') {
$query= "\@and ".$query;
$query .= " \@attr 1=1019 \"".$search->{'stack'}."\"";
push @params, $search->{'stack'};
}
if ($search->{'date_from'} ne '') {
$query= "\@and ".$query;
$query .= " \@attr 1=30 \@attr 2=4 \@attr 4=4 ".$search->{'date_from'};
@ -1132,7 +1223,11 @@ sub CatSearch4 {
$query .= " \@attr 1=1033 \"".$search->{'branch'}."\"";
#
}
if ($search->{'stack'} ne '') {
$query= "\@and ".$query;
$query .= " \@attr 1=1019 \"".$search->{'stack'}."\"";
}
if ($search->{'date_from'} ne '') {
$query= "\@and ".$query;
$query .= " \@attr 1=30 \@attr 2=4 \@attr 4=4 ".$search->{'date_from'};
@ -1151,8 +1246,8 @@ sub CatSearch4 {
#execute the query and returns just the results between $num and $num + $offset
my $limit = $num + $offset;
my $startfrom = $offset;
my $oConnection=C4::Context->Zconn;
return unless $query; ##Somebody hit the search button with no query. Prevent a system crash
my $oConnection=C4::Context->Zconn("biblioserver");
if ($oConnection eq "error"){
return("error",undef);
}
@ -1191,6 +1286,19 @@ my %branches;
#Building shelving hash
my %shelves;
#find shelvingname
my $stackstatus = $dbh->prepare('select authorised_value from marc_subfield_structure where kohafield="items.stack"');
$stackstatus->execute;
my ($authorised_valuecode) = $stackstatus->fetchrow;
if ($authorised_valuecode) {
$stackstatus = $dbh->prepare("select lib,authorised_value from authorised_values where category=? ");
$stackstatus->execute($authorised_valuecode);
while (my $lib = $stackstatus->fetchrow_hashref){
$shelves{$lib->{'authorised_value'}} = $lib->{'lib'};
}
}
#search item field code
my $sth =
@ -1246,13 +1354,13 @@ $item->{$code}=$field->subfield($subfieldstosearch{$code});
my $status;
$item->{'branchname'}=$branches{$item->{'holdingbranch'}};
$item->{'shelves'}=$shelves{$item->{stack}};
$status="Lost" if ($item->{'itemlost'}>0);
$status="Withdrawn" if ($item->{'wthdrawn'}>0);
if ($search->{'from'} eq "intranet"){
$search->{'avoidquerylog'}=1;
$status="Due:".format_date($item->{'onloan'}) if ($item->{'onloan'}>0);
$status = $item->{'holdingbranch'}."-"."[".$item->{'itemcallnumber'}."]" unless defined $status;
$status = $item->{'holdingbranch'}."-".$item->{'stack'}."[".$item->{'itemcallnumber'}."]" unless defined $status;
}else{
$status="On Loan" if ($item->{'onloan'}>0);
$status = $item->{'branchname'}."[".$item->{'shelves'}."]" unless defined $status;
@ -3550,7 +3658,7 @@ sub barcodes{
#called from request.pl
my ($biblioitemnumber)=@_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT barcode, itemlost, holdingbranch FROM items
my $sth=$dbh->prepare("SELECT barcode, itemlost, holdingbranch,onloan,itemnumber FROM items
WHERE biblioitemnumber = ?
AND (wthdrawn <> 1 OR wthdrawn IS NULL)");
$sth->execute($biblioitemnumber);

View File

@ -33,13 +33,15 @@ sub StringSearch {
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
my $sth=$dbh->prepare("Select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder from auth_subfield_structure where (tagfield like ? and authtypecode=?) order by tagfield");
my $sth=$dbh->prepare("Select * from auth_subfield_structure where (tagfield like ? and authtypecode=?) order by tagfield");
$sth->execute("$searchstring%",$authtypecode);
my @results;
my $cnt=0;
my $u=1;
while (my $data=$sth->fetchrow_hashref){
push(@results,$data);
$cnt ++;
$u++;
}
$sth->finish;
$dbh->disconnect;
@ -55,7 +57,7 @@ my $offset=$input->param('offset');
my $script_name="/cgi-bin/koha/admin/auth_subfields_structure.pl";
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "parameters/auth_subfields_structure.tmpl",
= get_template_and_user({template_name => "admin/auth_subfields_structure.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
@ -84,9 +86,18 @@ if ($op eq 'add_form') {
my $data;
my $dbh = C4::Context->dbh;
my $more_subfields = $input->param("more_subfields")+1;
# builds kohafield tables
my @kohafields;
push @kohafields, "";
my $sth2=$dbh->prepare("SHOW COLUMNS from auth_header");
$sth2->execute;
while ((my $field) = $sth2->fetchrow_array) {
push @kohafields, "auth_header.".$field;
}
# build authorised value list
my $sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->finish;
$sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->execute;
my @authorised_values;
push @authorised_values,"";
@ -95,9 +106,19 @@ if ($op eq 'add_form') {
}
push (@authorised_values,"branches");
push (@authorised_values,"itemtypes");
# build value_builder list
my @value_builder=('');
opendir(DIR, "../value_builder") || die "can't opendir ../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);
@ -106,45 +127,108 @@ if ($op eq 'add_form') {
closedir DIR;
# build values list
my $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder from auth_subfield_structure where tagfield=? and authtypecode=?"); # and tagsubfield='$tagsubfield'");
my $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and authtypecode=?"); # and tagsubfield='$tagsubfield'");
$sth->execute($tagfield,$authtypecode);
my @loop_data = ();
my $toggle="white";
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 'white'){
$toggle="#ffffcc";
if ($toggle eq 1){
$toggle=0;
} else {
$toggle="white";
$toggle=1;
}
$row_data{tab} = CGI::scrolling_list(-name=>'tab',
-id=>"tab$i",
-values=>['-1','0'],
-labels => {'-1' =>'No (ignore)','0'=>'yes'
-labels => {'-1' =>'ignore','0'=>'0',
},
-default=>$data->{'tab'},
-size=>1,
-multiple=>0,
);
$row_data{tagsubfield} =$data->{'tagsubfield'}."<input type='hidden' name='tagsubfield' value='".$data->{'tagsubfield'}."'>";
$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
-id=>"ohidden$i",
-values=>['0','1','2'],
-labels => {'0'=>'Show','1'=>'Show Collapsed',
'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','1','2'],
-labels => {'0'=>'Show','1'=>'Show Collapsed',
'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{kohafield}= CGI::scrolling_list( -name=>"kohafield",
-id=>"kohafield$i",
-values=> \@kohafields,
-default=> "$data->{'kohafield'}",
-size=>1,
-multiple=>0,
);
$row_data{authorised_value} = CGI::scrolling_list(-name=>'authorised_value',
-id=>'authorised_value',
-values=> \@authorised_values,
-default=>$data->{'authorised_value'},
-size=>1,
-multiple=>0,
);
$row_data{value_builder} = CGI::scrolling_list(-name=>'value_builder',
-id=>'value_builder',
-values=> \@value_builder,
-default=>$data->{'value_builder'},
-size=>1,
-multiple=>0,
);
$row_data{repeatable} = CGI::checkbox("repeatable$i",$data->{'repeatable'}?'checked':'',1,'');
$row_data{mandatory} = CGI::checkbox("mandatory$i",$data->{'mandatory'}?'checked':'',1,'');
$row_data{bgcolor} = $toggle;
$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{link} = CGI::checkbox( -name => "link$i",
-id => "link$i",
-checked => $data->{'link'}?'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++;
}
@ -152,25 +236,86 @@ if ($op eq 'add_form') {
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'],
-labels => {'-1' =>'no (ignore)','0'=>'yes',
-labels => {'-1' =>'ignore','0'=>'0',
},
-default=>"",
-size=>1,
-multiple=>0,
);
$row_data{tagsubfield} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"3\" maxlength=\"1\">";
$row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
-id=>"ohidden$i",
-values=>['0','1','2'],
-labels => {'0'=>'Show','1'=>'Show Collapsed',
'2' =>'Hide',
},
-default=>"0",
-size=>1,
-multiple=>0,
);
$row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
-id=>"ihidden$i",
-values=>['0','1','2'],
-labels => {'0'=>'Show','1'=>'Show Collapsed',
'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{repeatable} = CGI::checkbox('repeatable','',1,'');
$row_data{mandatory} = CGI::checkbox('mandatory','',1,'');
$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{kohafield}= CGI::scrolling_list( -name=>'kohafield',
-id => "kohafield$i",
-values=> \@kohafields,
-default=> "",
-size=>1,
-multiple=>0,
);
$row_data{authorised_value} = CGI::scrolling_list(-name=>'authorised_value',
-id => 'authorised_value',
-values=> \@authorised_values,
-size=>1,
-multiple=>0,
);
$row_data{bgcolor} = $toggle;
$row_data{link} = CGI::checkbox( -name => "link",
-id => "link$i",
-checked => '',
-value => 1,
-label => '');
# $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);
@ -187,15 +332,23 @@ if ($op eq 'add_form') {
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
my $sth=$dbh->prepare("replace auth_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder,authtypecode)
values (?,?,?,?,?,?,?,?,?,?,?)");
my $sth=$dbh->prepare("replace auth_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl, link)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
my @liblibrarian = $input->param('liblibrarian');
my @libopac = $input->param('libopac');
my @kohafield = $input->param('kohafield');
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];
@ -204,10 +357,15 @@ if ($op eq 'add_form') {
my $libopac =$libopac[$i];
my $repeatable =$input->param("repeatable$i")?1:0;
my $mandatory =$input->param("mandatory$i")?1:0;
my $kohafield =$kohafield[$i];
my $tab =$tab[$i];
my $seealso =$seealso[$i];
my $authorised_value =$authorised_values[$i];
# my $authtypecode =$authtypecodes;
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 = $input->param("link$i")?1:0;
if ($liblibrarian) {
unless (C4::Context->config('demo') eq 1) {
$sth->execute ($tagfield,
@ -216,10 +374,18 @@ if ($op eq 'add_form') {
$libopac,
$repeatable,
$mandatory,
$kohafield,
$tab,
$seealso,
$authorised_value,
$value_builder,$authtypecode);
$authtypecode,
$value_builder,
$hidden,
$isurl,
$link,
);
}
}
}
@ -232,8 +398,9 @@ if ($op eq 'add_form') {
# 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 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 $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and tagsubfield=? and authtypecode=?");
#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'},
@ -251,7 +418,6 @@ if ($op eq 'add_form') {
unless (C4::Context->config('demo') eq 1) {
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;
}
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode\"></html>";
@ -262,40 +428,48 @@ if ($op eq 'add_form') {
} else { # DEFAULT
my $env;
my ($count,$results)=StringSearch($env,$tagfield,$authtypecode);
my $toggle="white";
my $toggle=1;
my @loop_data = ();
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
if ($toggle eq 'white'){
$toggle="#ffffcc";
if ($toggle eq 1){
$toggle=0;
} else {
$toggle="white";
$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{kohafield} = $results->[$i]{'kohafield'};
$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&amp;tagfield=$tagfield&amp;tagsubfield=".$results->[$i]{'tagsubfield'}."&authtypecode=$authtypecode";
$row_data{bgcolor} = $toggle;
$row_data{toggle} = $toggle;
if ($row_data{tab} eq -1) {
$row_data{subfield_ignored} = 1;
}
push(@loop_data, \%row_data);
}
$template->param(loop => \@loop_data);
$template->param(edit => "<a href=\"$script_name?op=add_form&amp;tagfield=$tagfield&authtypecode=$authtypecode\">");
$template->param(edit_tagfield => $tagfield,
edit_authtypecode => $authtypecode);
if ($offset>0) {
my $prevpage = $offset-$pagesize;
$template->param(prev =>"<a href=\"$script_name?offset=$prevpage&amp;tagfield=$tagfield&authtypecode=$authtypecode\">");
$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&amp;tagfield=$tagfield&authtypecode=$authtypecode\">");
$template->param(next => "<a href=\"$script_name?offset=$nextpage\">");
}
} #---- END $OP eq DEFAULT
$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),

View File

@ -50,7 +50,7 @@ my $dbh = C4::Context->dbh;
# open template
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "parameters/auth_tag_structure.tmpl",
= get_template_and_user({template_name => "admin/auth_tag_structure.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
@ -73,7 +73,7 @@ foreach my $thisauthtype (keys %$authtypes) {
my $sth;
# check that authtype framework is defined in auth_tag_structure if we are on a default action
if (!$op or $op eq 'authtype_create_confirm') {
warn "IN";
#warn "IN";
$sth=$dbh->prepare("select count(*) from auth_tag_structure where authtypecode=?");
$sth->execute($authtypecode);
my ($authtypeexist) = $sth->fetchrow;
@ -204,19 +204,19 @@ if ($op eq 'add_form') {
################## DEFAULT ##################################
} else { # DEFAULT
# here, $op can be unset or set to "authtype_create_confirm".
warn "authtype : $authtypecode";
# warn "authtype : $authtypecode";
if ($searchfield ne '') {
$template->param(searchfield => $searchfield);
}
my $env;
my ($count,$results)=StringSearch($env,$searchfield,$authtypecode);
my $toggle=1;
my $toggle="white";
my @loop_data = ();
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
if ($toggle eq 1){
$toggle=0;
if ($toggle eq 'white'){
$toggle="#ffffcc";
} else {
$toggle=1;
$toggle="white";
}
my %row_data; # get a fresh hash for the row data
$row_data{tagfield} = $results->[$i]{'tagfield'};
@ -227,7 +227,7 @@ if ($op eq 'add_form') {
$row_data{subfield_link} ="auth_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode;
$row_data{edit} = "$script_name?op=add_form&amp;searchfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode;
$row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode;
$row_data{toggle} = $toggle;
$row_data{bgcolor} = $toggle;
push(@loop_data, \%row_data);
}
$template->param(loop => \@loop_data,
@ -250,12 +250,7 @@ if ($op eq 'add_form') {
}
} #---- END $OP eq DEFAULT
$template->param(loggeninuser => $loggedinuser,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
$template->param(loggeninuser => $loggedinuser);
output_html_with_http_headers $input, $cookie, $template->output;
@ -284,19 +279,19 @@ sub StringSearch {
#
sub duplicate_auth_framework {
my ($newauthtype,$oldauthtype) = @_;
warn "TO $newauthtype FROM $oldauthtype";
# warn "TO $newauthtype FROM $oldauthtype";
my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from auth_tag_structure where authtypecode=?");
$sth->execute($oldauthtype);
my $sth_insert = $dbh->prepare("insert into auth_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, authtypecode) values (?,?,?,?,?,?,?)");
my $sth_insert = $dbh->prepare("insert into auth_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, authtypecode) values (?,?,?,?,?,?,?)");
while ( my ($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) = $sth->fetchrow) {
$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newauthtype);
}
$sth = $dbh->prepare("select authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,seealso from auth_subfield_structure where authtypecode=?");
$sth = $dbh->prepare("select tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,value_builder,seealso,hidden,link from auth_subfield_structure where authtypecode=?");
$sth->execute($oldauthtype);
$sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder,seealso) values (?,?,?,?,?,?,?,?,?,?,?)");
while ( my ($authtypecode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value, $thesaurus_category, $seealso) = $sth->fetchrow) {
$sth_insert->execute($newauthtype, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value, $thesaurus_category, $seealso);
$sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,value_builder,seealso,hidden,link) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
while ( my ( $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield,$tab, $authorised_value, $thesaurus_category, $seealso,$hidden,$link) = $sth->fetchrow) {
$sth_insert->execute($newauthtype, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory,$kohafield, $tab, $authorised_value, $thesaurus_category, $seealso,$hidden,$link);
}
}

View File

@ -56,7 +56,7 @@ my $pagesize=20;
my $op = $input->param('op');
$searchfield=~ s/\,//g;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "parameters/authtypes.tmpl",
= get_template_and_user({template_name => "admin/authtypes.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
@ -84,7 +84,7 @@ if ($op eq 'add_form') {
$data=$sth->fetchrow_hashref;
$sth->finish;
}
warn "=> $data->{'authtypetext'} : ".$data->{'summary'};
# warn "=> $data->{'authtypetext'} : ".$data->{'summary'};
$template->param(authtypecode => $authtypecode,
authtypetext => $data->{'authtypetext'},
auth_tag_to_report => $data->{'auth_tag_to_report'},
@ -171,10 +171,6 @@ if ($op eq 'add_form') {
$template->param(next => "$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;
# Local Variables:

View File

@ -29,7 +29,7 @@ use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::AuthoritiesMarc;
use C4::SearchMarc;
#use C4::Biblio;
use C4::Acquisition;
use C4::Koha; # XXX subfield_is_koha_internal_p
@ -37,7 +37,7 @@ my $query=new CGI;
my $op = $query->param('op');
my $authtypecode = $query->param('authtypecode');
my $index = $query->param('index');
my $tagid=$query->param('tagid');
# my $category = $query->param('category');
my $resultstring = $query->param('result');
my $dbh = C4::Context->dbh;
@ -133,7 +133,6 @@ if ($op eq "do_search") {
startfromnext => $startfrom+1,
startfromprev => $startfrom-1,
index => $index,
tagid => $tagid,
searchdata=>\@field_data,
total=>$total,
from=>$from,
@ -153,17 +152,14 @@ if ($op eq "do_search") {
});
$template->param(index=>$query->param('index')."",
tagid => $tagid,
resultstring => $resultstring,
);
}
$template->param(authtypesloop => \@authtypesloop,
authtypecode => $authtypecode,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
authtypecode => $authtypecode,
nonav=>"1",);
# Print the page
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -24,20 +24,19 @@ use CGI;
use C4::Auth;
use HTML::Template;
use C4::Context;
use C4::Search;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::AuthoritiesMarc;
use C4::SearchMarc;
use C4::Acquisition;
use C4::Koha; # XXX subfield_is_koha_internal_p
use C4::Biblio;
my $query=new CGI;
my $op = $query->param('op');
my $authtypecode = $query->param('authtypecode');
my $dbh = C4::Context->dbh;
my $mergefrom=$query->param('mergefrom');
my $mergeto=$query->param('mergeto');
my $startfrom=$query->param('startfrom');
my $authid=$query->param('authid');
$startfrom=0 if(!defined $startfrom);
@ -49,11 +48,21 @@ my @authtypesloop;
foreach my $thisauthtype (sort { $authtypes->{$a} <=> $authtypes->{$b} } keys %$authtypes) {
my $selected = 1 if $thisauthtype eq $authtypecode;
my %row =(value => $thisauthtype,
selected => $selected,
selected => $selected,
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
);
push @authtypesloop, \%row;
}
my %row =(value =>"TSUB ESUB",
selected => "",
authtypetext => "All Subject Headings",
);
push @authtypesloop, \%row;
my %row =(value =>"AUTH CORP",
selected => "",
authtypetext => "All Name Authorities",
);
push @authtypesloop, \%row;
if ($op eq "do_search") {
my @marclist = $query->param('marclist');
@ -63,16 +72,17 @@ if ($op eq "do_search") {
my @value = $query->param('value');
$resultsperpage= $query->param('resultsperpage');
$resultsperpage = 19 if(!defined $resultsperpage);
$resultsperpage = 20 if(!defined $resultsperpage);
my @tags;
my ($results,$total) = authoritysearch($dbh, \@marclist,\@and_or,
\@excluding, \@operator, \@value,
$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
$startfrom*$resultsperpage, $resultsperpage,$authtypecode) ;
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "authorities/searchresultlist.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
authtypecode=> $authtypecode,
flagsrequired => {borrowers => 1},
flagsrequired => {catalogue => 1},
debug => 1,
@ -104,7 +114,7 @@ if ($op eq "do_search") {
{
for (my $i=1; $i<$total/$resultsperpage+1; $i++)
{
if ($i<16)
if ($i<31)
{
my $highlight=0;
($startfrom==($i-1)) && ($highlight=1);
@ -139,12 +149,11 @@ if ($op eq "do_search") {
to=>$to,
numbers=>\@numbers,
authtypecode=>$authtypecode,
isEDITORS => $authtypecode eq 'EDITORS',
);
} elsif ($op eq "delete") {
&AUTHdelauthority($dbh,$authid, 1);
&AUTHdelauthority($dbh,$authid, 0);
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "authorities/authorities-home.tmpl",
@ -230,8 +239,21 @@ elsif ($op eq "AddStatement") {
$template->param("statements" => \@statements,
"nbstatements" => $nbstatements);
}
else {
}elsif ($op eq "merge") {
my $MARCfrom = AUTHgetauthority($dbh,$mergefrom);
my $MARCto = AUTHgetauthority($dbh,$mergeto);
merge($dbh,$mergefrom,$MARCfrom,$mergeto,$MARCto);
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "authorities/authorities-home.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
flagsrequired => {catalogue => 1},
debug => 1,
});
}else {
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "authorities/authorities-home.tmpl",
query => $query,
@ -243,11 +265,9 @@ else {
}
$template->param(authtypesloop => \@authtypesloop,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
$template->param(authtypesloop => \@authtypesloop);
# Print the page
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -29,10 +29,15 @@ use C4::Context;
use C4::Koha; # XXX subfield_is_koha_internal_p
use HTML::Template;
use MARC::File::USMARC;
use MARC::File::XML;
use C4::Biblio;
use vars qw( $tagslib);
use vars qw( $authorised_values_sth);
use vars qw( $is_a_modif );
my $input = new CGI;
my $z3950 = $input->param('z3950');
my $logstatus=C4::Context->preference('Activate_log');
my $itemtype; # created here because it can be used in build_authorized_values_list sub
=item find_value
@ -60,8 +65,8 @@ sub find_value {
my @subfields = $field->subfields();
foreach my $subfield (@subfields) {
if (@$subfield[0] eq $insubfield) {
push @result,char_decode(@$subfield[1],$encoding);
$indicator = $field->indicator(1).$field->indicator(2);
push @result,@$subfield[1];
$indicator = $field->indicator(1).$field->indicator(2);
}
}
}
@ -104,7 +109,7 @@ sub build_authorized_values_list ($$$$$) {
push @authorised_values, $itemtype;
$authorised_lib{$itemtype}=$description;
}
# $value=$itemtype unless ($value);
$value=$itemtype unless ($value);
#---- "true" authorised value
} else {
@ -121,39 +126,64 @@ sub build_authorized_values_list ($$$$$) {
-values => \@authorised_values,
-default => $value,
-labels => \%authorised_lib,
-override => 1,
-size => 1,
-multiple => 0 );
}
=item create_input
builds the <input ...> entry for a subfield.
=cut
sub create_input () {
my ($tag,$subfield,$value,$i,$rec,$authorised_values_sth) = @_;
my ($tag,$subfield,$value,$i,$tabloop,$rec,$authorised_values_sth) = @_;
# must be encoded as utf-8 before it reaches the editor
my $dbh=C4::Context->dbh;
$value =~ s/"/&quot;/g;
my $dbh = C4::Context->dbh;
my %subfield_data;
$subfield_data{tag}=$tag;
$subfield_data{subfield}=$subfield;
$subfield_data{marc_lib}="<span id=\"error$i\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>";
$subfield_data{marc_lib_plain}=$tagslib->{$tag}->{$subfield}->{lib};
$subfield_data{tag_mandatory}=$tagslib->{$tag}->{mandatory};
$subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
$subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{kohafield};
$subfield_data{index} = $i;
$subfield_data{visibility} = "display:none" if (substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "0") ; #check parity
# it's an authorised field
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
$subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth);
} elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" size=47 maxlength=255 DISABLE READONLY> <a href=\"javascript:Dopop('../thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">...</a>";
# it's a thesaurus / authority field
} elsif ($tagslib->{$tag}->{$subfield}->{link}) {
$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff;'\" tabindex=\"1\" type=\"text\" name=\"field_value\" value=\"$value\" size=\"40\" maxlength=\"255\" DISABLE READONLY> <a style=\"cursor: help;\" href=\"javascript:Dopop('../authorities/auth_linker.pl?index=$i',$i)\">...</a>";
# it's a plugin field
} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
# opening plugin. Just check wether we are on a developper computer on a production one
# (the cgidir differs)
my $cgidir = C4::Context->intranetdir ."/cgi-bin/value_builder";
unless (opendir(DIR, "$cgidir")) {
$cgidir = C4::Context->intranetdir."/value_builder";
}
my $plugin=$cgidir."/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
require $plugin;
my $extended_param = plugin_parameters($dbh,$rec,$tagslib,$i,0);
my ($function_name,$javascript) = plugin_javascript($dbh,$rec,$tagslib,$i,0);
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" DISABLE READONLY size=47 maxlength=255 OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i)\"> <a href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
my $extended_param = plugin_parameters($dbh,$rec,$tagslib,$i,$tabloop);
my ($function_name,$javascript) = plugin_javascript($dbh,$rec,$tagslib,$i,$tabloop);
$subfield_data{marc_value}="<input tabindex=\"1\" type=\"text\" name=\"field_value\" value=\"$value\" size=\"40\" maxlength=\"255\" OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i); \"> <a style=\"cursor: help;\" href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
# it's an hidden field
} elsif ($tag eq '') {
$subfield_data{marc_value}="<input type=\"hidden\" name=\"field_value\" size=50 maxlength=255>"; #"
$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"hidden\" name=\"field_value\" value=\"$value\">";
} elsif (substr($tagslib->{$tag}->{$subfield}->{'hidden'},2,1) gt "1") {
$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"text\" name=\"field_value\" value=\"$value\" size=\"40\" maxlength=\"255\" >";
# it's a standard field
} else {
$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=50 maxlength=255>"; #"
if (length($value) >100) {
$subfield_data{marc_value}="<textarea tabindex=\"1\" name=\"field_value\" cols=\"40\" rows=\"5\" >$value</textarea>";
} else {
$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffffff'; \" tabindex=\"1\" type=\"text\" name=\"field_value\" value=\"$value\" size=\"50\">"; #"
}
}
return \%subfield_data;
}
@ -168,40 +198,93 @@ sub build_tabs ($$$$) {
from authorised_values
where category=? order by lib");
my @loop_data = ();
foreach my $tag (sort(keys (%{$tagslib}))) {
my $indicator;
# warn "TAG : $tag => ".$tagslib->{$tag}->{lib}."//";
# if MARC::Record is not empty => use it as master loop, then add missing subfields that should be in the tab.
# if MARC::Record is empty => use tab as master loop.
if ($record ne -1 && $record->field($tag)) {
my @fields = $record->field($tag);
foreach my $field (@fields) {
my @subfields_data;
if ($tag<10) {
my $value=$field->data();
my $subfield="@";
next if ($tagslib->{$tag}->{$subfield}->{tab} eq -1);
push(@subfields_data, &create_input($tag,$subfield,char_decode($value,$encoding),$i,$record,$authorised_values_sth));
$i++;
# loop through each tab 0 through 9
for (my $tabloop = 0; $tabloop <= 9; $tabloop++) {
my @loop_data = ();
foreach my $tag (sort(keys (%{$tagslib}))) {
my $indicator;
# if MARC::Record is not empty => use it as master loop, then add missing subfields that should be in the tab.
# if MARC::Record is empty => use tab as master loop.
if ($record ne -1 && ($record->field($tag) || $tag eq '000')) {
my @fields;
if ($tag ne '000') {
@fields = $record->field($tag);
} else {
my @subfields=$field->subfields();
foreach my $subfieldcount (0..$#subfields) {
my $subfield=$subfields[$subfieldcount][0];
my $value=$subfields[$subfieldcount][1];
push @fields,$record->leader();
}
foreach my $field (@fields) {
my @subfields_data;
if ($tag<10) {
my ($value,$subfield);
if ($tag ne '000') {
$value=$field->data();
$subfield="@";
} else {
$value = $field;
$subfield='@';
}
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
# next if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'auth_header.authid');
push(@subfields_data, &create_input($tag,$subfield,$value,$i,$tabloop,$record,$authorised_values_sth));
$i++;
} else {
my @subfields=$field->subfields();
foreach my $subfieldcount (0..$#subfields) {
my $subfield=$subfields[$subfieldcount][0];
my $value=$subfields[$subfieldcount][1];
next if (length $subfield !=1);
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
push(@subfields_data, &create_input($tag,$subfield,$value,$i,$tabloop,$record,$authorised_values_sth));
$i++;
}
}
# now, loop again to add parameter subfield that are not in the MARC::Record
foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
next if (length $subfield !=1);
next if ($tagslib->{$tag}->{$subfield}->{tab} eq -1);
push(@subfields_data, &create_input($tag,$subfield,char_decode($value,$encoding),$i,$record,$authorised_values_sth));
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
next if ($tag<10);
next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1") ); #check for visibility flag
next if (defined($field->subfield($subfield)));
push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
$i++;
}
if ($#subfields_data >= 0) {
my %tag_data;
$tag_data{tag} = $tag;
$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
$tag_data{indicator} = $record->field($tag)->indicator(1). $record->field($tag)->indicator(2) if ($tag>=10);
$tag_data{subfield_loop} = \@subfields_data;
if ($tag<10) {
$tag_data{fixedfield} = 1;
}
push (@loop_data, \%tag_data);
}
# If there is more than 1 field, add an empty hidden field as separator.
if ($#fields >=1 && $#loop_data >=0 && $loop_data[$#loop_data]->{'tag'} eq $tag) {
my @subfields_data;
my %tag_data;
push(@subfields_data, &create_input('','','',$i,$tabloop,$record,$authorised_values_sth));
$tag_data{tag} = '';
$tag_data{tag_lib} = '';
$tag_data{indicator} = '';
$tag_data{subfield_loop} = \@subfields_data;
if ($tag<10) {
$tag_data{fixedfield} = 1;
}
push (@loop_data, \%tag_data);
$i++;
}
}
# now, loop again to add parameter subfield that are not in the MARC::Record
foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
} else {
my @subfields_data;
foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
next if (length $subfield !=1);
next if ($tagslib->{$tag}->{$subfield}->{tab} eq -1);
next if ($tag<10);
next if (defined($record->field($tag)->subfield($subfield)));
push(@subfields_data, &create_input($tag,$subfield,'',$i,$record,$authorised_values_sth));
next if ((substr($tagslib->{$tag}->{$subfield}->{hidden},2,1) gt "1") ); #check for visibility flag
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
$i++;
}
if ($#subfields_data >= 0) {
@ -209,44 +292,18 @@ sub build_tabs ($$$$) {
$tag_data{tag} = $tag;
$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
$tag_data{indicator} = $record->field($tag)->indicator(1). $record->field($tag)->indicator(2) if ($tag>=10);
$tag_data{indicator} = $indicator;
$tag_data{subfield_loop} = \@subfields_data;
$tag_data{tagfirstsubfield} = $tag_data{subfield_loop}[0];
if ($tag<10) {
$tag_data{fixedfield} = 1;
}
push (@loop_data, \%tag_data);
}
# If there is more than 1 field, add an empty hidden field as separator.
if ($#fields >=1) {
my @subfields_data;
my %tag_data;
push(@subfields_data, &create_input('','','',$i,$record,$authorised_values_sth));
$tag_data{tag} = '';
$tag_data{tag_lib} = '';
$tag_data{indicator} = '';
$tag_data{subfield_loop} = \@subfields_data;
push (@loop_data, \%tag_data);
$i++;
}
}
# if breeding is empty
} else {
my @subfields_data;
foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
next if (length $subfield !=1);
next if ($tagslib->{$tag}->{$subfield}->{tab} eq -1);
push(@subfields_data, &create_input($tag,$subfield,'',$i,$record,$authorised_values_sth));
$i++;
}
if ($#subfields_data >= 0) {
my %tag_data;
$tag_data{tag} = $tag;
$tag_data{tag_lib} = $tagslib->{$tag}->{lib};
$tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
$tag_data{indicator} = $indicator;
$tag_data{subfield_loop} = \@subfields_data;
push (@loop_data, \%tag_data);
}
}
$template->param($tabloop."XX" =>\@loop_data);
}
$template->param("0XX" =>\@loop_data);
}
@ -277,7 +334,6 @@ sub build_hidden_data () {
}
}
# ========================
# MAIN
#=========================
@ -286,11 +342,15 @@ my $error = $input->param('error');
my $authid=$input->param('authid'); # if authid exists, it's a modif, not a new authority.
my $z3950 = $input->param('z3950');
my $op = $input->param('op');
# warn "OP : $op";
my $nonav = $input->param('nonav');
my $myindex = $input->param('index');
my $linkid=$input->param('linkid');
my $authtypecode = $input->param('authtypecode');
my $dbh = C4::Context->dbh;
$authtypecode = &AUTHfind_authtypecode($dbh,$authid) if $authid;
# warn "authtypecode : $authtypecode && authid = $authid";
$authtypecode = &AUTHfind_authtypecode($dbh,$authid) if !$authtypecode;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "authorities/authorities.tmpl",
query => $input,
@ -299,28 +359,24 @@ my ($template, $loggedinuser, $cookie)
flagsrequired => {editcatalogue => 1},
debug => 1,
});
$template->param(nonav => $nonav,index=>$myindex,authtypecode=>$authtypecode,);
$tagslib = AUTHgettagslib($dbh,1,$authtypecode);
my $record=-1;
my $encoding="";
$record = AUTHgetauthority($dbh,$authid) if ($authid);
my ($oldauthnumtagfield,$oldauthnumtagsubfield);
my ($oldauthtypetagfield,$oldauthtypetagsubfield);
$is_a_modif=0;
# my ($oldbiblionumtagfield,$oldbiblionumtagsubfield);
# my ($oldbiblioitemnumtagfield,$oldbiblioitemnumtagsubfield,$bibitem,$oldbiblioitemnumber);
if ($authid) {
$is_a_modif=1;
# if it's a modif, retrieve old biblio and bibitem numbers for the future modification of old-DB.
# ($oldbiblionumtagfield,$oldbiblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber");
# ($oldbiblioitemnumtagfield,$oldbiblioitemnumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblioitems.biblioitemnumber");
# # search biblioitems value
# my $sth=$dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
# $sth->execute($oldbiblionumber);
# ($oldbiblioitemnumber) = $sth->fetchrow;
($oldauthnumtagfield,$oldauthnumtagsubfield) = &AUTHfind_marc_from_kohafield($dbh,"auth_header.authid",$authtypecode);
($oldauthtypetagfield,$oldauthtypetagsubfield) = &AUTHfind_marc_from_kohafield($dbh,"auth_header.authtypecode",$authtypecode);
}
#------------------------------------------------------------------------------------------------------------------------------
if ($op eq "add") {
#------------------------------------------------------------------------------------------------------------------------------
# rebuild
my @tags = $input->param('tag');
my @subfields = $input->param('subfield');
@ -328,28 +384,39 @@ if ($op eq "add") {
# build indicator hash.
my @ind_tag = $input->param('ind_tag');
my @indicator = $input->param('indicator');
my $xml = AUTHhtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
#
# MARC::Record built => now, record in DB
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
#warn $xml;
my $record=MARC::Record->new_from_xml($xml,'UTF-8');
$record->encoding('UTF-8');
#warn $record->as_formatted;
#warn "IN ADDBIB";
# check for a duplicate
my ($duplicateauthid,$duplicateauthvalue) = FindDuplicate($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
my ($duplicateauthid,$duplicateauthvalue) = C4::AuthoritiesMarc::FindDuplicate($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
#warn "duplicate:$duplicateauthid,$duplicateauthvalue";
my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
if (!$duplicateauthid or $confirm_not_duplicate) {
if ($is_a_modif) {
AUTHmodauthority($dbh,$authid,$record,$authtypecode);
# warn "noduplicate";
if ($is_a_modif ) {
$authid=AUTHmodauthority($dbh,$authid,$record,$authtypecode,1);
} else {
($authid) = AUTHaddauthority($dbh,$record,$authid,$authtypecode);
($authid) = AUTHaddauthority($dbh,$record,$authid,$authtypecode);
}
# now, redirect to detail page
print $input->redirect("detail.pl?authid=$authid");
if ($nonav){
#warn ($myindex,$nonav);
print $input->redirect("auth_finder.pl?index=$myindex&nonav=$nonav&authtypecode=$authtypecode");
}else{
print $input->redirect("detail.pl?nonav=$nonav&authid=$authid");
}
exit;
} else {
#warn "duplicate";
# it may be a duplicate, warn the user and do nothing
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
$template->param(
$template->param(authid =>$authid,
duplicateauthid => $duplicateauthid,
duplicateauthvalue => $duplicateauthvalue,
);
@ -358,45 +425,54 @@ if ($op eq "add") {
} elsif ($op eq "addfield") {
#------------------------------------------------------------------------------------------------------------------------------
my $addedfield = $input->param('addfield_field');
my $tagaddfield_subfield = $input->param('addfield_subfield');
my @tags = $input->param('tag');
my @subfields = $input->param('subfield');
my @values = $input->param('field_value');
# build indicator hash.
my @ind_tag = $input->param('ind_tag');
my @indicator = $input->param('indicator');
my $xml = AUTHhtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
#
my $field = MARC::Field->new("$addedfield",'','','a'=> "");
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
my $record=MARC::Record->new_from_xml($xml,'UTF-8');
$record->encoding('UTF-8');
# adding an empty field
my $field = MARC::Field->new("$addedfield",'','','$tagaddfield_subfield' => "");
$record->append_fields($field);
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
$template->param(
authid => $authid,);
# oldbiblionumtagfield => $oldbiblionumtagfield,
# oldbiblionumtagsubfield => $oldbiblionumtagsubfield,
# oldbiblioitemnumtagfield => $oldbiblioitemnumtagfield,
# oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
# oldbiblioitemnumber => $oldbiblioitemnumber );
} elsif ($op eq "delete") {
#------------------------------------------------------------------------------------------------------------------------------
&AUTHdelauthority($dbh,$authid);
}
unless ($op) {
# warn "BUILDING";
if ($nonav){
print $input->redirect("auth_finder.pl");
}else{
print $input->redirect("authorities-home.pl?authid=0");
}
exit;
} else {
if ($op eq "duplicate")
{
$authid = "";
}
build_tabs ($template, $record, $dbh,$encoding);
build_hidden_data;
$template->param(oldauthtypetagfield=>$oldauthtypetagfield, oldauthtypetagsubfield=>$oldauthtypetagsubfield,
oldauthnumtagfield=>$oldauthnumtagfield, oldauthnumtagsubfield=>$oldauthnumtagsubfield,
authid => $authid , authtypecode=>$authtypecode, );
}
#unless ($op) {
# warn "BUILDING";
# build_tabs ($template, $record, $dbh,$encoding);
# build_hidden_data;
#}
$template->param(
authid => $authid,
# oldbiblionumtagfield => $oldbiblionumtagfield,
# oldbiblionumtagsubfield => $oldbiblionumtagsubfield,
# oldbiblioitemnumtagfield => $oldbiblioitemnumtagfield,
# # oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
# oldbiblioitemnumber => $oldbiblioitemnumber,
authtypecode => $authtypecode,
linkid=>$linkid,
);
my $authtypes = getauthtypes;
@ -412,9 +488,5 @@ foreach my $thisauthtype (keys %$authtypes) {
$template->param(authtypesloop => \@authtypesloop,
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
hide_marc => C4::Context->preference('hide_marc'),
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
nonav=>$nonav,);
output_html_with_http_headers $input, $cookie, $template->output;

View File

@ -57,7 +57,6 @@ my $dbh=C4::Context->dbh;
my $authid = $query->param('authid');
my $index = $query->param('index');
my $tagid = $query->param('tagid');
my $authtypecode = &AUTHfind_authtypecode($dbh,$authid);
my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode);
@ -81,20 +80,15 @@ my $tag;
my @loop_data =();
if ($authid) {
foreach my $field ($record->field($auth_type->{auth_tag_to_report})) {
my @subfields_data;
my @subf=$field->subfields;
my @subfields_data;
my @subf=$field->subfields;
# loop through each subfield
my %result;
for my $i (0..$#subf) {
$subf[$i][0] = "@" unless $subf[$i][0];
$result{$subf[$i][0]}.=$subf[$i][1]."|";
}
foreach (keys %result) {
my %subfield_data;
chop $result{$_};
$subfield_data{marc_value}=$result{$_};
$subfield_data{marc_subfield}=$_;
# $subfield_data{marc_tag}=$field->tag();
$subfield_data{marc_value}=$subf[$i][1];
$subfield_data{marc_subfield}=$subf[$i][0];
$subfield_data{marc_tag}=$field->tag();
push(@subfields_data, \%subfield_data);
}
if ($#subfields_data>=0) {
@ -136,11 +130,6 @@ $template->param("0XX" =>\@loop_data);
$template->param(authid => $authid?$authid:"",
# authtypesloop => \@authtypesloop,
index => $index,
tagid => $tagid,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
index => $index);
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -179,10 +179,6 @@ foreach my $thisauthtype (keys %$authtypes) {
}
$template->param(authid => $authid,
authtypesloop => \@authtypesloop, index => $index,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
authtypesloop => \@authtypesloop, index => $index);
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -49,29 +49,21 @@ use CGI;
use C4::Search;
use MARC::Record;
use C4::Koha;
# use C4::Biblio;
# use C4::Catalogue;
use HTML::Template;
my $query=new CGI;
my $dbh=C4::Context->dbh;
my $nonav = $query->param('nonav');
my $authid = $query->param('authid');
my $authtypecode = &AUTHfind_authtypecode($dbh,$authid);
my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode);
my $record =AUTHgetauthority($dbh,$authid);
my $count = AUTHcount_usage($authid);
# find the marc field/subfield used in biblio by this authority
my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
$sth->execute($authtypecode);
my $biblio_fields;
while (my ($tagfield) = $sth->fetchrow) {
$biblio_fields.= $tagfield."9,";
}
chop $biblio_fields;
my ($count) = AUTHcount_usage($authid);
#chop;
# open template
my ($template, $loggedinuser, $cookie)
@ -83,6 +75,7 @@ my ($template, $loggedinuser, $cookie)
debug => 1,
});
# fill arrays
my @loop_data =();
my $tag;
@ -95,7 +88,7 @@ foreach my $field (@fields) {
my @subfields_data;
# if tag <10, there's no subfield, use the "@" trick
if ($field->tag()<10) {
next if ($tagslib->{$field->tag()}->{'@'}->{hidden});
next if (substr($tagslib->{$field->tag()}->{'@'}->{hidden},0,1) gt "0");
my %subfield_data;
$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib};
$subfield_data{marc_value}=$field->data();
@ -107,7 +100,7 @@ foreach my $field (@fields) {
# loop through each subfield
for my $i (0..$#subf) {
$subf[$i][0] = "@" unless $subf[$i][0];
next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden});
next if (substr($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden},0,1) gt "0");
my %subfield_data;
$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) {
@ -141,13 +134,11 @@ foreach my $thisauthtype (keys %$authtypes) {
}
$template->param(authid => $authid,
count => $count,
biblio_fields => $biblio_fields,
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
authtypesloop => \@authtypesloop,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
count => $count,
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
authtypecode => $authtypes->{$authtypecode}{'authtypecode'},
authtypesloop => \@authtypesloop);
$template->param(nonav =>$nonav);
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -110,7 +110,7 @@ if ($op eq "do_search") {
my ($count, @results);
##Check to see if Zebra is available;
if ($zoom eq "1"){
my $zconn=C4::Context->Zconn;
my $zconn=C4::Context->Zconn("biblioserver");
if (!$zconn ||$zconn eq "error"){
$zoom=0;
}
@ -207,9 +207,9 @@ if ($zoom eq "1"){
$template->param(numbers => $numbers);
#show the virtual shelves
# my $results = &GetShelfListOfExt($borrowernumber);
# $template->param(shelvescount => scalar(@{$results}));
# $template->param(shelves => $results);
my $results = &GetShelfListOfExt($borrowernumber);
$template->param(shelvescount => scalar(@{$results}));
$template->param(shelves => $results);
########
if ($format eq '1') {
@ -286,7 +286,16 @@ if ( $count == 1){
}
$template->param(branches => \@branches);
#show stacks
my $stack = $query->param('stack');
my ($stackcount,@stacks)=C4::Biblio::getstacks();
foreach my $row (@stacks) {
if ($stack eq $row->{'authorised_value'}) {
$row->{'sel'} = 1;
}
}
$template->param(stacks => \@stacks);
}
show:
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -4,7 +4,7 @@
#written 8/5/2002 by Finlay
#script to execute issuing of books
# New functions (renew etc.) added 07-08-2005 Tumer Garip tgarip@neu.edu.tr
# Copyright 2000-2002 Katipo Communications
#
@ -35,9 +35,9 @@ use C4::Interface::CGI::Output;
use C4::Koha;
use HTML::Template;
use C4::Date;
use Date::Manip;
use C4::Context;
use C4::Members;
#
# PARAMETERS READING
#
my $query=new CGI;
@ -52,13 +52,15 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user
});
my $branches = getbranches();
my $printers = getprinters();
my $branch = getbranch($query, $branches);
#my $branch = getbranch($query, $branches);
my $branch=C4::Context->preference("defaultBranch");
my $printer = getprinter($query, $printers);
my $findborrower = $query->param('findborrower');
$findborrower =~ s|,| |g;
$findborrower =~ s|'| |g;
my $borrowernumber = $query->param('borrnumber');
my $print=$query->param('print');
my $barcode = $query->param('barcode');
my $year=$query->param('year');
@ -67,15 +69,23 @@ my $day=$query->param('day');
my $stickyduedate=$query->param('stickyduedate');
my $issueconfirmed = $query->param('issueconfirmed');
my $cancelreserve = $query->param('cancelreserve');
my %error;
my $errorflag=$query->param('error');
if ( $errorflag gt "1"){
%error=(TOO_EARLY=>{1},) if ($errorflag eq "2");
%error=(NO_MORE_RENEWALS=>{1},) if ($errorflag eq "3");
%error=(RESERVE_FOUND=>{1},) if ($errorflag eq "4");
}elsif ( $errorflag eq "1"){
%error=(SUCCESFULL_RENEW=>{1},)
}
#set up cookie.....
my $branchcookie;
my $printercookie;
if ($query->param('setcookies')) {
$branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
$printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
}
#if ($query->param('setcookies')) {
# $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
# $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
#}
my %env; # FIXME env is used as an "environment" variable. Could be dropped probably...
@ -85,7 +95,7 @@ $env{'queue'}=$printer;
my @datearr = localtime(time());
# FIXME - Could just use POSIX::strftime("%Y%m%d", localtime);
my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", ($datearr[3]));
my $todaysdate = (1900+$datearr[5])."-".sprintf ("%0.2d", ($datearr[4]+1))."-".sprintf ("%0.2d", ($datearr[3]));
# check and see if we should print
@ -121,43 +131,59 @@ if ($findborrower) {
# get the borrower information.....
my $borrower;
my $bornum=$query->param('bornum');
if ($bornum){
$borrowernumber=$bornum;
}
my $issues;
if ($borrowernumber) {
$borrower = getpatroninformation(\%env,$borrowernumber,0);
my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
#warn $borrower->{'expiry'};
my $warningdate = DateCalc($borrower->{'expiry'},"- ".C4::Context->preference('NotifyBorrowerDeparture')." days");
my $offset = '+ '.$borrower->{'enrolmentperiod'}.' years';
my $renewaldate = DateCalc($warningdate, $offset);
$renewaldate = UnixDate($renewaldate,'%Y-%m-%d');
my $warning=Date_Cmp(ParseDate("today"),$warningdate);
if ($warning>0){
#borrowercard expired
$template->param(warndeparture=>$warning,
renewaldate=>$renewaldate);
}
$template->param(overduecount => $od,
issuecount => $issue,
finetotal => $fines);
}
my $warning;
$template->param(overduecount => $od,
issuecount => $issue.$warning,
finetotal => $fines);
$issues=$issue;
my $picture;
my $htdocs = C4::Context->config('opacdir');
$picture =$htdocs. "/htdocs/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg";
if (-e $picture)
{
$template->param(borrowerphoto => "http://library.neu.edu.tr/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg");
}else{
$picture = "http://cc.neu.edu.tr/stdpictures/".$borrower->{'cardnumber'}.".jpg";
$template->param(borrowerphoto => $picture);
}
}
#
# STEP 3 : ISSUING
#
#
#Try to issue
if ($barcode) {
$barcode = cuecatbarcodedecode($barcode);
my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
if ($issueconfirmed) {
issuebook(\%env, $borrower, $barcode, $datedue,$cancelreserve);
issuebook(\%env, $borrower, $barcode, $datedue,$cancelreserve);
my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
my $warning;
$template->param(overduecount => $od,
issuecount => $issue.$warning,
finetotal => $fines);
} else {
my ($error, $question) = canbookbeissued(\%env, $borrower, $barcode, $year, $month, $day);
my ($error, $question) = canbookbeissued(\%env, $borrower, $barcode, $year, $month, $day) unless %error;
$error=\%error if %error;
my $noerror=1;
my $noquestion = 1;
foreach my $impossible (keys %$error) {
$template->param($impossible => $$error{$impossible},
IMPOSSIBLE => 1);
$noerror = 0;
@ -172,14 +198,22 @@ if ($barcode) {
year => $year);
if ($noerror && ($noquestion || $issueconfirmed)) {
issuebook(\%env, $borrower, $barcode, $datedue);
my ($od,$issue,$fines)=borrdata2(\%env,$borrowernumber);
my $warning;
$template->param(overduecount => $od,
issuecount => $issue.$warning,
finetotal => $fines);
}
}
}
# reload the borrower info for the sake of reseting the flags.....
if ($borrowernumber) {
$borrower = getpatroninformation(\%env,$borrowernumber,0);
}
#if ($borrowernumber) {
# $borrower = getpatroninformation(\%env,$borrowernumber,0);
#}
##################################################################################
@ -190,8 +224,10 @@ my $todaysissues='';
my $previssues='';
my @realtodayissues;
my @realprevissues;
#my @renewissues;
my $allowborrow;
if ($borrower) {
# get each issue of the borrower & separate them in todayissues & previous issues
my @todaysissues;
my @previousissues;
@ -199,13 +235,16 @@ if ($borrower) {
# split in 2 arrays for today & previous
foreach my $it (keys %$issueslist) {
my $issuedate = $issueslist->{$it}->{'timestamp'};
$issuedate = substr($issuedate, 0, 8);
if ($todaysdate == $issuedate) {
$issuedate = substr($issuedate, 0, 10);
if ($todaysdate eq $issuedate) {
push @todaysissues, $issueslist->{$it};
} else {
} else {
push @previousissues, $issueslist->{$it};
}
}
my $od; # overdues
my $i = 0;
my $togglecolor;
@ -213,57 +252,65 @@ if ($borrower) {
foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
$dd=format_date($dd);
$datedue=~s/-//g;
if ($datedue < $todaysdate) {
# $datedue=~s/-//g;
if ($datedue lt $todaysdate) {
$od = 1;
} else {
$od=0;
}
if ($i%2) {
$book->{'od'}=$od;
$book->{'dd'}=$dd;
$book->{'tcolor'}=$togglecolor;
if ($togglecolor) {
$togglecolor=0;
} else {
$togglecolor=1;
}
$book->{'togglecolor'} = $togglecolor;
$book->{'od'}=$od;
$book->{'dd'}=$dd;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
push @realtodayissues,$book;
$i++;
$i++;
}
# parses previous & build Template array
$i = 0;
$i=0;
foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} @previousissues){
my $dd = $book->{'date_due'};
my $datedue = $book->{'date_due'};
$dd=format_date($dd);
my $pcolor = '';
my $od = '';
$datedue=~s/-//g;
if ($datedue < $todaysdate) {
# $datedue=~s/-//g;
if ($datedue lt $todaysdate) {
$od = 1;
} else {
$od = 0;
}
if ($i%2) {
if ($togglecolor) {
$togglecolor=0;
} else {
$togglecolor=1;
}
$book->{'togglecolor'} = $togglecolor;
$book->{'tcolor'}=$togglecolor;
$book->{'dd'}=$dd;
$book->{'od'}=$od;
$book->{'tcolor'}=$pcolor;
if ($book->{'author'} eq ''){
$book->{'author'}=' ';
}
push @realprevissues,$book;
$i++;
$i++;
}
}
}#borrower
my @values;
@ -286,7 +333,7 @@ my ($patrontable, $flaginfotable) = patrontable($borrower);
my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'};
my @temp=split(/\$/,$amountold);
$amountold=$temp[1];
$template->param(
$template->param( today=>format_date($todaysdate),
findborrower => $findborrower,
borrower => $borrower,
borrowernumber => $borrowernumber,
@ -296,8 +343,7 @@ $template->param(
printername => $printers->{$printer}->{'printername'},
firstname => $borrower->{'firstname'},
surname => $borrower->{'surname'},
expiry => format_date($borrower->{'expiry'}),
categorycode => $borrower->{'categorycode'},
categorycode => getborrowercategory($borrower->{'categorycode'}),
streetaddress => $borrower->{'streetaddress'},
emailaddress => $borrower->{'emailaddress'},
borrowernotes => $borrower->{'borrowernotes'},
@ -311,6 +357,7 @@ $template->param(
CGIselectborrower => $CGIselectborrower,
todayissues => \@realtodayissues,
previssues => \@realprevissues,
);
# set return date if stickyduedate
if ($stickyduedate) {
@ -328,11 +375,7 @@ if ($stickyduedate) {
if ($branchcookie) {
$cookie=[$cookie, $branchcookie, $printercookie];
}
$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
patronimages => C4::Context->preference("patronimages"),
);
output_html_with_http_headers $query, $cookie, $template->output;
####################################################################

View File

@ -1,47 +1,53 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<div id="main">
<h1>Authority search</h1>
<form name="f" method="post" action="auth_finder.pl">
<input type="hidden" name="op" value="do_search">
<input type="hidden" name="type" value="intranet">
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
<h2>Search on</h2>
<p>
<label>Authority type</label>
<!-- TMPL_VAR NAME="authtypecode" -->
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
</p>
<p>
<label for="mainentry">Main entry</label><select name="operator">
<option value="start">start by</option>
<option value="contains">contains</option>
</select><input type="text" id="mainentry" name="value" value="<!-- TMPL_VAR name="resultstring" -->">
<input type="hidden" name="marclist" value="mainentry">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="tagid" value="<!-- TMPL_VAR NAME="tagid" -->">
</p>
<p>
<label for="anywhere">Anywhere</label><select name="operator">
<option value="contains">contains</option>
<option value="start">start by</option>
</select><input type="text" name="value">
<input type="hidden" id="anywhere" name="marclist" value="">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="tagid" value="<!-- TMPL_VAR NAME="tagid" -->">
</p>
<p>
<input type="submit" value="Start search" class="submit" />
</p>
</form>
<form name="f" method="post">
<input type="hidden" name="nonav" value="<!-- TMPL_VAR NAME="nonav" -->">
<input type="hidden" name="op" value="do_search">
<input type="hidden" name="type" value="author">
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
<div id="bloc25">
<h2 class="authority">Search on</h2>
<p>
<label class="label100">Authority type</label>
<!-- TMPL_VAR NAME="authtypecode" -->
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
</p>
<p>
<label class="label100">Main heading(a)</label><input type="text" name="value" value="<!-- TMPL_VAR name="resultstring" -->">
<input type="hidden" name="marclist" value="mainentry">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<select name="operator">
<option value="all">All words</option>
<option value="phrase">Phrase</option>
</select>
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
</p>
<p>
<label class="label100">Sub heading</label><input type="text" name="value">
<input type="hidden" name="marclist" value="">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<select name="operator">
<option value="all">All words</option>
<option value="phrase">Phrase</option>
</select>
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
</p>
<p>
<input type="submit" value="Start search" class="button authority">
</p>
</div>
</form>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View File

@ -1,68 +1,46 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities Home
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
<div id="main">
<h1>Authority search</h1>
<form name="f" action="/cgi-bin/koha/authorities/authorities-home.pl" method="post">
<input type="hidden" name="op" value="do_search">
<input type="hidden" name="type" value="intranet">
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
<div class="details">
<h2>Search on
<select name="authtypecode">
<form name="f" method="post">
<input type="hidden" name="op" value="do_search" />
<input type="hidden" name="type" value="intranet" />
<input type="hidden" name="stype" value="author" />
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->" />
<div class="data"><table>
<caption>Authority search</caption>
<tr><th><label for="authtypecode">Authority type</label></th><td><select id="authtypecode" name="authtypecode" >
<!-- TMPL_LOOP NAME="authtypesloop" -->
<!-- TMPL_IF name="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="authtypetext" --></option>
<!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"> <!-- TMPL_VAR NAME="authtypetext" --></option>
<!-- /TMPL_IF -->
<option value="<!-- TMPL_VAR NAME="value" -->" >
<!-- TMPL_VAR NAME="authtypetext" -->
</option>
<!-- /TMPL_LOOP -->
</select>
</h2>
<p>
<label for="mainentry">Main entry</label>
<input type="hidden" name="marclist" value="mainentry">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<select name="operator">
<option value="contains">contains</option>
<option value="start">start by</option>
</select>
<input type="text" id="mainentry" name="value" value="<!-- TMPL_VAR NAME="value" -->">
</p>
<p>
<label for="anywhere">Anywhere</label>
</select></td></tr>
<tr><th><label id="mainentry">Main entry</label></th><td><select name="operator" id="mainentry">
<option value="all">All words</option>
<option value="phrase">Phrase</option>
</select> <input type="text" name="value" value="<!-- TMPL_VAR NAME="value" -->" />
<input type="hidden" name="marclist" value="mainentry" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
</td></tr>
<tr><th><label for="anywhere">Anywhere</label></th><td><select name="operator" id="anywhere">
<option value="all">All words</option>
<option value="phrase">Phrase</option>
</select> <input type="text" name="value" value="<!-- TMPL_VAR NAME="value" -->">
<input type="hidden" name="marclist" value="">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<select name="operator">
<option value="contains">contains</option>
<option value="start">start by</option>
</select>
<input type="text" id="anywhere" name="value" value="<!-- TMPL_VAR NAME="value" -->">
</p>
</td></tr></table></div>
<p>
<input type="submit" value="Start search" class="submit">
</p>
</div>
</form>
<div class="details">
<h2>Add authority</h2>
<form name="f2" method="post" action="authorities.pl">
<p><label for="authtypecode">Authority type</label>
<select name="authtypecode" id="authtypecode">
<!-- TMPL_LOOP name="authtypesloop" -->
<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->>
<!-- TMPL_VAR name="authtypetext" -->
</option>
<!-- /TMPL_LOOP -->
</select>
<input type="submit" value="Add" class="submit">
</p>
</form>
</div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View File

@ -1,74 +1,68 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->NEULIS -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close-addbiblio.inc" -->
<!--TMPL_UNLESS NAME="nonav"--><!-- TMPL_INCLUDE NAME="masthead.inc" --><!--/TMPL_UNLESS-->
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
<!--TMPL_UNLESS NAME="nonav"--><!-- TMPL_INCLUDE NAME="intranet-nav-brief.inc" --><!--/TMPL_UNLESS-->
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/includes/marc-editor.css">
<div id="main">
<div class="tabbed">
<form method="post" name="f">
<!-- TMPL_IF name="authid" -->
<h1>Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
<!-- TMPL_ELSE -->
<h1>Adding authority (<!-- TMPL_VAR name="authtypetext" -->)</h1>
<!-- /TMPL_IF -->
<p>
<form method="post" name="f" id="f" action="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->&nonav=<!-- TMPL_VAR NAME="nonav" -->&linkid="+document.form.f.linkid.value >
<div class="tabitem">
<h1>Authority number <!-- TMPL_VAR NAME="authid" --></h1>
<p><input type="hidden" name="nonav" value="<!-- TMPL_VAR NAME="nonav" -->"><input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="op" value="add">
<input type="hidden" name="addfield_field">
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
<input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->">
<input type="hidden" name="linkid" id="linkid" value="0000">
<!-- TMPL_IF name="authid" -->
<input type="button" value="Save" onClick="Check(this.form)" accesskey="w" class="submit">
<input type="button" value="Save" onClick="Check(this.form)" accesskey="w" class="button authority">
<!-- TMPL_ELSE -->
<input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w" class="submit">
<input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w" class="button authority">
<!-- /TMPL_IF -->
</p>
</div>
<div name="0XX" id="0XX" class="tab" style="visibility:visible">
<!-- TMPL_IF name="duplicateauthid" -->
<div class="error">
<p>Duplicate suspected with <a href='javascript:openWindow("detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&popup=1", "Duplicate Authority")'><!-- TMPL_VAR name="duplicateauthvalue" --></a></p>
<p>You must either :</p>
<ul>
<p><input type="checkbox" value="1" name="confirm_not_duplicate">confirm it's not a duplicate (and click on <input type="button" value="Add authority" onClick="Check(this.form)" accesskey="w" class="submit"> again)</p>
<p>Go to <a href="authorities.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->" >original authority</a></p>
</ul>
</div>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="0XX" -->
<!-- TMPL_IF name="tag" -->
<p class="MARCtag">
<!-- TMPL_VAR NAME="tag" -->
<input type="hidden" name="ind_tag" value="<!-- TMPL_VAR NAME="tag" -->">
<input type="text" name="indicator" size="3" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->"> - <TMPL_VAR NAME="tag_lib">
<!-- TMPL_IF name="repeatable" -->
<a href="javascript:AddField(<!-- TMPL_VAR NAME="tag" -->)">+</a>
<div class="error">
<p>Is this a duplicate of <a href="detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&nonav=<!-- TMPL_VAR name="nonav" -->" onclick="openWindow('detail.pl?nonav=<!-- TMPL_VAR name="nonav" -->&authid=<!-- TMPL_VAR name="duplicateauthid" -->&popup=1', ''; return false;)"><!-- TMPL_VAR name="duplicateauthvalue" --></a>?</p>
<ul>
<li>If not, click to <input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" /> <a href="#" onclick="confirmnotdup(); return false;">Confirm it's not a duplicate</a></li>
</ul>
</div>
<!-- /TMPL_IF -->
</p>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="subfield_loop" -->
<p>
<label class="labelsubfield">
<!-- TMPL_UNLESS name="hide_marc" -->
<img src="<!-- TMPL_VAR NAME="themelang" -->/images/prev.gif" onClick="javascript:upSubfield('<!-- TMPL_VAR name="index" -->')">
<input type="text" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1">
<!-- TMPL_ELSE -->
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->">
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF -->
<!-- TMPL_VAR NAME="marc_lib" -->
<!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF -->
</label>
<!-- TMPL_VAR NAME="marc_value" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->">
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->">
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
</p>
<!-- /tmpl_loop -->
<!-- /tmpl_loop -->
<!-- TMPL_LOOP NAME="0XX" -->
<!-- TMPL_IF name="tag" -->
<p class="MARCtag">
<input type="hidden" name="ind_tag" value="<!-- TMPL_VAR NAME="tag" -->">
<!-- TMPL_UNLESS name="hide_marc" --><a title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></a>
<input tabindex="1" onblur="this.style.backgroundColor='#ffffff';" onfocus="this.style.backgroundColor='#ffffff;'" type="text" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" class="flat"> -
<!-- TMPL_ELSE -->
<input tabindex="1" type="hidden" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" value="<!-- TMPL_VAR NAME="indicator" -->"><!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="advancedMARCEditor" --><!-- TMPL_VAR NAME="tag_lib" --><!-- /TMPL_UNLESS -->
<!-- TMPL_IF name="repeatable" --><a href="javascript:AddField('<!-- TMPL_VAR NAME="tag" -->')">+</a><!-- /TMPL_IF -->
</p>
<!-- /TMPL_IF -->
<div><!-- TMPL_LOOP NAME="subfield_loop" -->
<!-- TMPL_IF NAME="visibility" -->
<a tabindex="1" style="color: grey; font-size: 80%; cursor: se-resize;" id="label<!-- TMPL_VAR name="index" -->" onclick="unHideSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->','label<!-- TMPL_VAR name="index" -->')"><!-- TMPL_VAR NAME="subfield" --></a>
<!-- /TMPL_IF -->
<div style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='index' -->"><!-- TMPL_UNLESS NAME="advancedMARCEditor" --><label <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield"> <!-- /TMPL_UNLESS --><!-- TMPL_UNLESS name="hide_marc" --><img <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> src="<!-- TMPL_VAR NAME="themelang" -->/images/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')"/><input title="<!-- TMPL_VAR NAME="marc_lib_plain" -->" style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" DISABLE READONLY tabindex=-1 />
<!-- TMPL_ELSE --><input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->"/><!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="advancedMARCEditor" --><!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label><!-- /TMPL_UNLESS -->
<!-- TMPL_VAR NAME="marc_value" --><!-- TMPL_IF NAME="repeatable" --><a style="cursor: crosshair; color: grey; font-size: 80%;" onclick="cloneSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')">+</a><!-- /TMPL_IF -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->"/>
<input type="hidden" name="subfieldYYY" value="<!-- TMPL_VAR NAME="subfield" -->" size="2" maxlength="1"/>
<input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->"/>
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->"/>
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->"/>
</div><!-- /TMPL_LOOP --></div>
<!-- /TMPL_LOOP -->
</div>
<div name="hidden" id="hidden" class="tab">
<!-- TMPL_LOOP NAME="hidden_loop" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->">
@ -78,22 +72,18 @@
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
<!-- /TMPL_LOOP -->
</div>
<!-- TMPL_IF name="oldbiblionumtagfield" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldbiblionumtagfield" -->">
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldbiblionumtagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="oldbiblionumber" -->">
<input type="hidden" name="mandatory" value="0">
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldbiblioitemnumtagfield" -->">
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldbiblioitemnumtagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="oldbiblioitemnumber" -->">
<!-- TMPL_IF name="oldauthnumtagfield" -->
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthnumtagfield" -->">
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthnumtagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authid" -->">
<input type="hidden" name="mandatory" value="0">
<input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->">
<input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->">
<input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthtypetagfield" -->">
<input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthtypetagsubfield" -->">
<input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authtypecode" -->">
<!-- /TMPL_IF -->
</form>
</div>
<script language="JavaScript" type="text/javascript">
function _(s) { return s } // dummy function for gettext
function active(numlayer)
@ -164,49 +154,75 @@ function Check(f) {
}
function Dopop(link,i) {
defaultvalue=document.forms['f'].field_value[i].value;
newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes');
newin=window.open(link+"&result="+defaultvalue,"",'width=550,height=550,toolbar=false,scrollbars=yes');
}
function _(s) { return s } // dummy function for gettext
function PopupZ3950() {
var strQuery="";
for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
if (document.forms['f'].kohafield[i].value == "biblioitems.isbn" && document.forms['f'].field_value[i].value.length>0) {
strQuery += "&isbn="+document.forms['f'].field_value[i].value;
for (i=0 ; i<document.forms[0].field_value.length ; i++) {
if (document.forms[0].kohafield[i].value == "biblioitems.isbn" && document.forms[0].field_value[i].value.length>0) {
strQuery += "&isbn="+document.forms[0].field_value[i].value;
}
if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) {
strQuery += "&title="+document.forms['f'].field_value[i].value;
if (document.forms[0].kohafield[i].value == "biblio.title" && document.forms[0].field_value[i].value.length>0) {
strQuery += "&title="+document.forms[0].field_value[i].value;
}
if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) {
strQuery += "&author="+document.forms['f'].field_value[i].value;
if (document.forms[0].kohafield[i].value == "biblio.author" &&document.forms[0].field_value[i].value.length>0) {
strQuery += "&author="+document.forms[0].field_value[i].value;
}
if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) {
strQuery += "&issn="+document.forms['f'].field_value[i].value;
if (document.forms[0].kohafield[i].value == "biblioitems.issn" && document.forms[0].field_value[i].value.length>0) {
strQuery += "&issn="+document.forms[0].field_value[i].value;
}
}
newin=window.open("../z3950/search.pl?bibid=<!-- TMPL_VAR NAME="bibid" -->"+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes');
}
function confirmnotdup(){
document.getElementById("confirm_not_duplicate").value = 1;
var checkform = document.getElementById("f");
Check(checkform);
}
function AddField(field) {
document.forms['f'].op.value = "addfield";
document.forms['f'].addfield_field.value=field;
document.f.submit();
}
function upSubfield(index) {
temp = document.forms['f'].field_value[index-1].value;
document.forms['f'].field_value[index-1].value=document.forms['f'].field_value[index].value;
document.forms['f'].field_value[index].value= temp;
temp = document.forms['f'].subfield[index-1].value;
document.forms['f'].subfield[index-1].value=document.forms['f'].subfield[index].value;
document.forms['f'].subfield[index].value = temp;
temp = document.forms['f'].mandatory[index-1].value;
document.forms['f'].mandatory[index-1].value=document.forms['f'].mandatory[index].value;
document.forms['f'].mandatory[index].value = temp;
temp = document.forms['f'].kohafield[index-1].value;
document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value;
document.forms['f'].kohafield[index].value = temp;
function cloneSubfield(index) {
var original = document.getElementById(index);
var clone = original.cloneNode(true);
clone.setAttribute("id", index + index);
// orginput : the value of the original field (in [0] if hide_marc=1, otherwise in [1]
// image : the up button. don't exist is hide_marc=1
<!-- TMPL_IF name="hide_marc" -->
var orginput = original.getElementsByTagName('input')[0];
<!-- TMPL_ELSE -->
var orginput = original.getElementsByTagName('input')[1];
image = clone.getElementsByTagName('img')[0];
image.setAttribute("onclick","upSubfield('" + index + index + "')");
<!-- /TMPL_IF -->
trigger = original.getElementsByTagName('a')[0];
if (trigger) {
trigger.parentNode.removeChild(trigger);
}
clonetrigger = clone.getElementsByTagName('a')[0];
clonetrigger.setAttribute("onclick","cloneSubfield('" + index + index + "')");
clone.setAttribute("tabindex","1");
orginput.value = '';
original.parentNode.insertBefore( clone, original.nextSibling);
}
function upSubfield(index) {
var original = document.getElementById(index);
var previous = original.previousSibling;
original.parentNode.insertBefore( original, previous );
}
function unHideSubfield(index,labelindex) {
subfield = document.getElementById(index);
subfield.style.display = 'block';
label = document.getElementById(labelindex);
label.style.display='none';
}
</script>
</body>
</html>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View File

@ -1,47 +1,51 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<body>
<script language="JavaScript" type="text/javascript">
function go() {
var tagid = '<!-- TMPL_VAR NAME="tagid" -->';
// alert("I"+tagid);
var whichtag = opener.opener.document.getElementById(tagid);
// parses all the fields of this tag (every id)
whichsubfields=whichtag.getElementsByTagName("div");
subfieldcode='';
for(var i=0; i<whichsubfields.length;i++) {
// get every <input>
change_value=whichsubfields[i].getElementsByTagName("input");
for(j=0;j<change_value.length;j++) {
// if this <input> if the subfield code, store if for future use !
if (change_value[j].getAttribute("name") == 'subfield') {
subfieldcode=subfield_value=change_value[j].value;
// alert("subfieldcode ="+subfieldcode);
}
// if this <input> is for field_value => replace it by the correct value
if (change_value[j].getAttribute("name") == 'field_value') {
// empty any previous value, except if we are facing a $4 (UNIMARC specific, does not exist in MARC21)
if (subfieldcode !=4) {
change_value[j].value ='';
}
// if we are on the $9 replace by authid
if (subfieldcode=='9') {
// alert("subfield 9 valeur <!-- TMPL_VAR NAME="authid" -->");
change_value[j].value = "<!-- TMPL_VAR NAME="authid" -->";
}
// otherwise, build the loop for all subfields to replace
<!-- TMPL_LOOP NAME="0XX" -->
<!-- TMPL_LOOP NAME="subfield" -->
if (subfieldcode == '<!-- TMPL_VAR NAME="marc_subfield" -->') {
// alert("subfield"+subfieldcode+" valeur <!-- TMPL_VAR NAME="marc_value" -->");
change_value[j].value = "<!-- TMPL_VAR NAME="marc_value" -->";
}
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
}
}
function go()
{
var index_start = <!-- TMPL_VAR NAME="index" -->;
var whichfield = opener.opener.document.f.tag[index_start].value;
i=index_start
// go forward, until reaching the end of the field.
while (i<=opener.opener.document.f.field_value.length) {
if (opener.opener.document.f.tag[i].value == whichfield && opener.opener.document.f.subfield[i].value == '9') {
opener.opener.document.f.field_value[i].value = "<!-- TMPL_VAR NAME="authid">";
}
<!-- TMPL_LOOP NAME="0XX" -->
<!-- TMPL_LOOP NAME="subfield" -->
if (opener.opener.document.f.tag[i].value == whichfield && opener.opener.document.f.subfield[i].value == '<!-- TMPL_VAR NAME="marc_subfield" -->')
{
opener.opener.document.f.field_value[i].value = "<!-- TMPL_VAR NAME="marc_value" -->";
}
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
if (opener.opener.document.f.tag[i].value != whichfield) {
i=opener.opener.document.f.field_value.length;
}
i++;
}
// go backward until the beginning of the field
i=index_start
while (i>=0) {
if (opener.opener.document.f.tag[i].value == whichfield && opener.opener.document.f.subfield[i].value == '9') {
opener.opener.document.f.field_value[i].value = "<!-- TMPL_VAR NAME="authid">";
}
<!-- TMPL_LOOP NAME="0XX" -->
<!-- TMPL_LOOP NAME="subfield" -->
if (opener.opener.document.f.tag[i].value == whichfield && opener.opener.document.f.subfield[i].value == '<!-- TMPL_VAR NAME="marc_subfield" -->')
{
opener.opener.document.f.field_value[i].value = "<!-- TMPL_VAR NAME="marc_value" -->";
}
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
if (opener.opener.document.f.tag[i].value != whichfield) {
i=0;
}
i--;
}
opener.close();
self.close();
return false;

View File

@ -1,18 +1,23 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_UNLESS NAME="nonav"--><!-- TMPL_INCLUDE NAME="masthead.inc" --><!--/TMPL_UNLESS-->
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
<!--TMPL_UNLESS NAME="nonav"--><!-- TMPL_INCLUDE NAME="intranet-nav-brief.inc" --><!--/TMPL_UNLESS-->
<div id="main">
<div class="tabbed">
<h1>Authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
<a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit</a>
<!-- TMPL_UNLESS name="count" -->
<a href="javascript:confirm_deletion()">Delete</a>
<!-- /TMPL_UNLESS -->
<a href="javascript:Dopop('detailprint.pl?authid=<!-- TMPL_VAR NAME="authid" -->')">Print</a>
<a href="../search.marc/search.pl?type=intranet&amp;op=do_search&amp;marclist=<!-- TMPL_VAR NAME="biblio_fields" -->&amp;operator==&amp;value=<!-- TMPL_VAR NAME="authid" -->&amp;and_or=and&amp;excluding="><!-- TMPL_VAR name="count" --> biblios</a>
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/includes/marc-editor.css">
<div class="tabbed"><input type="hidden" name="nonav" value="<!-- TMPL_VAR NAME="nonav" -->">
<h1>Authority number : <!-- TMPL_VAR NAME="authid" --> in <!-- TMPL_VAR NAME="authtypetext" --></h1>
<a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->&nonav=<!-- TMPL_VAR NAME="nonav" -->&authtypecode=<!-- TMPL_VAR name="authtypecode" -->"">
<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/fileopen.png">
</a>
<!--TMPL_UNLESS NAME="nonav"--><a href="javascript:confirm_deletion()">
<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/edittrash.png">
</a>
<a href="javascript:Dopop('detailprint.pl?authid=<!-- TMPL_VAR NAME="authid" -->')" class="button authority">
Print
</a><!--/TMPL_UNLESS--><!--TMPL_IF NAME="count"-->&nbsp;<a href="/cgi-bin/koha/catalogue-home.pl?authtype=<!-- TMPL_VAR NAME="authtypecode" -->&amp;authnumber=<!-- TMPL_VAR NAME="authid" --> <!-- TMPL_VAR NAME="linkid" -->&amp;op=do_search&amp;zoom=1&amp;search_type=precise" class="button authority">Used in <!-- TMPL_VAR NAME="count" --> biblio(s)</a><!--/TMPL_IF-->
</div>
<div name="0XX" id="0XX" class="tab" style="visibility:visible">
@ -23,6 +28,9 @@
<!-- TMPL_LOOP NAME="subfield" -->
<p>
<label class="labelsubfield">
<a href="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode=<!-- TMPL_VAR NAME="authtypecode" -->&marclist=<!-- TMPL_VAR NAME="marc_tag" --><!-- TMPL_VAR NAME="marc_subfield" -->&and_or=and&excluding=&operator=all&stype=author&value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15">
</a>
<!-- TMPL_VAR NAME="marc_subfield" -->
<!-- TMPL_VAR NAME="marc_lib" --></label>
<!-- TMPL_VAR NAME="marc_value" -->
@ -30,18 +38,17 @@
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
</div>
</div>
<script language="JavaScript" type="text/javascript">
function confirm_deletion() {
var is_confirmed = confirm('Are you sure you want to delete this authority?');
var is_confirmed = confirm('Are you sure you want to delete this biblio?');
if (is_confirmed) {
window.location="authorities-home.pl?op=delete&amp;authid=<!-- TMPL_VAR NAME="authid" -->";
window.location="authorities.pl?op=delete&authid=<!-- TMPL_VAR NAME="authid" -->&nonav=<!-- TMPL_VAR NAME="nonav" -->";
}
}
function Dopop(link) {
newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
}
</script>
</body>
</html>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View File

@ -1,118 +1,95 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<div id="main-compact">
<div id="details">
<h1>Authority search results</h1>
<form name="f" method="post" action="auth_finder.pl">
<input type="hidden" name="op" value="do_search">
<input type="hidden" name="type" value="intranet">
<input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<h2>Search on</h2>
<p>
<label>Authority type</label>
<!-- TMPL_VAR NAME="authtypecode" -->
<input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->">
</p>
<p>
<label for="mainentry">Main entry</label><select name="operator">
<option value="start">start by</option>
<option value="contains">contains</option>
</select><input type="text" id="mainentry" name="value" value="<!-- TMPL_VAR name="resultstring" -->">
<input type="hidden" name="marclist" value="mainentry">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="tagid" value="<!-- TMPL_VAR NAME="tagid" -->">
</p>
<p>
<label for="anywhere">Anywhere</label><select name="operator">
<option value="contains">contains</option>
<option value="start">start by</option>
</select><input type="text" name="value">
<input type="hidden" id="anywhere" name="marclist" value="">
<input type="hidden" name="and_or" value="and">
<input type="hidden" name="excluding" value="">
<input type="hidden" name="index" value="<!-- TMPL_VAR NAME="index" -->">
<input type="hidden" name="tagid" value="<!-- TMPL_VAR NAME="tagid" -->">
</p>
<p>
<input type="submit" value="Start search" class="submit" />
</p>
</form>
</div>
<div class="details">
<!-- TMPL_IF NAME="numbers" --><div id="pages">
<div id="main">
<h1 class="authority">Authority search results</h1>
<div id="resultnumber">
<p>
<!-- TMPL_IF name="displayprev" -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->&amp;tagid=<!-- TMPL_VAR name="tagid" -->">&lt;&lt;</a>
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=any&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF name="highlight" --><span class="current"><!-- TMPL_VAR NAME="number" --></span><!-- TMPL_ELSE -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->&amp;tagid=<!-- TMPL_VAR name="tagid" -->"><!-- TMPL_VAR NAME="number" --></a>
<!-- TMPL_IF name="highlight" -->
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->-highlight.gif">
<!-- TMPL_ELSE -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=any&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->.gif" border="0"></a>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- TMPL_IF name="displaynext" -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->&amp;tagid=<!-- TMPL_VAR name="tagid" -->">&gt;&gt;</a>
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=any&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/next.gif" border="0"></a>
<!-- /TMPL_IF -->
</div><!-- /TMPL_IF -->
<div id="results">
</p>
<p>
<!-- TMPL_IF name="total" -->
<b>Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --></b><br>
&nbsp;<b>Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --></b><br><br>
<!-- TMPL_ELSE -->
No results found.<br>
&nbsp;No results found.<br>
<!-- /TMPL_IF -->
</p>
</div>
<div id="searchresults">
<div id="resultlist">
<table>
<tr>
<th>Summary</th>
<th>Used</th>
<th>Get It!</th>
<th class="authority">Summary</th>
<th class="authority">Used</th>
<th class="authority">Get It!</th>
<th class="authority">Edit It!</th>
</tr>
<tr>
<td>Clear any entry</td>
<td>&nbsp;</td>
<td>
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=0&amp;index=<!-- TMPL_VAR NAME="index" -->')" class="button authority">
Clear
</a>
</td>
<!-- TMPL_LOOP NAME="result" -->
<tr>
<td><!-- TMPL_VAR NAME="summary" --></td>
<td><!-- TMPL_VAR NAME="used" --> times</td>
<td>
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=0&amp;index=<!-- TMPL_VAR NAME="index" -->&amp;tagid=<!-- TMPL_VAR NAME="tagid" -->')">Choose</a>
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')"><img src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" width="16" height="16" hspace="0" vspace="0" border="0"></a>
</td>
<td> <a href="/cgi-bin/koha/authorities/authorities.pl?nonav=<!-- TMPL_VAR NAME="nonav" -->&authid=<!-- TMPL_VAR NAME="authid" -->&index=<!-- TMPL_VAR NAME="index" -->&authtypecode=<!-- TMPL_VAR name="authtypecode" -->">Edit<a/></td>
</tr>
<!-- /TMPL_LOOP -->
<tfoot><tr>
<td colspan="2">&nbsp;</td>
<td>
<a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=0&amp;index=<!-- TMPL_VAR NAME="index" -->')">Clear</a>
</td>
</tr></tfoot>
</table>
</div>
<!-- TMPL_IF NAME="numbers" --><div id="pages">
</div>
<div id="resultnumber">
<p>
<!-- TMPL_IF name="displayprev" -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->">&lt;&lt;</a>
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=contains&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF name="highlight" --><span class="current"><!-- TMPL_VAR NAME="number" --></span><!-- TMPL_ELSE -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->"><!-- TMPL_VAR NAME="number" --></a>
<!-- TMPL_IF name="highlight" -->
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->-highlight.gif">
<!-- TMPL_ELSE -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=contains&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->.gif" border="0"></a>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- TMPL_IF name="displaynext" -->
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" --><!-- TMPL_LOOP name="searchdata"-->&amp;<!-- TMPL_VAR name="term" -->=<!-- TMPL_VAR name="val"--><!-- /TMPL_LOOP -->&amp;op=do_search&amp;type=intranet&amp;index=<!-- TMPL_VAR name="index" -->">&gt;&gt;</a>
<a href="auth_finder.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->&and_or=and&operator=contains&value=<!-- TMPL_VAR NAME="resultstring" -->&op=do_search&type=intranet&stype=author">
<img src="/intranet-tmpl/default/images/numbers/next.gif" border="0"></a>
<!-- /TMPL_IF -->
</div><!-- /TMPL_IF -->
</div>
</p>
</div><a href="auth_finder.pl?index=<!-- TMPL_VAR NAME="index" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">Search again</a>
</div>
</div>
<script language="JavaScript" type="text/javascript">
function jumpfull(page)
{
window.open(page,'','width=10,height=10');
window.open(page,'','');
}
</script>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View File

@ -1,61 +1,60 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities Search Results
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Authorities
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="authorities-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
<div id="main">
<h1>Authority search results</h1>
<div id="pages">
<h1 class="authority">Authority search results</h1>
<div id="resultnumber">
<p>
<!-- TMPL_IF name="displayprev" -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
&lt;&lt;
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF name="highlight" -->
<span class="current"><!-- TMPL_VAR NAME="number" --></span>
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->-highlight.gif">
<!-- TMPL_ELSE -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&authtypecode=<!-- TMPL_VAR name="authtypecode" -->"><!-- TMPL_VAR NAME="number" --></a>
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- TMPL_IF name="displaynext" -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&authtypecode=<!-- TMPL_VAR name="authtypecode" -->">&gt;&gt;</a>
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/next.gif" border="0">
</a>
<!-- /TMPL_IF -->
</div>
<div id="results">
</p>
<p>
<!-- TMPL_IF name="total" -->
&nbsp;<b>Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --></b><br><br>
<!-- TMPL_ELSE -->
&nbsp;No results found.<br>
<!-- /TMPL_IF -->
</div>
<div class="searchresults">
</p>
</div>
<div id="resultlist">
<table>
<tr>
<th>Summary</th>
<!-- TMPL_UNLESS name="isEDITORS" -->
<th>Used in</th>
<!-- /TMPL_UNLESS -->
<th>View</th>
<th>Delete</th>
<th class="authority">Summary</th>
<th class="authority">Used in</th>
<th class="authority">Authid/Delete</th>
</tr>
<!-- TMPL_LOOP NAME="result" -->
<tr>
<td><!-- TMPL_VAR NAME="summary" --></td>
<!-- TMPL_UNLESS name="isEDITORS" -->
<td>
<a href="/cgi-bin/koha/search.marc/search.pl?type=intranet&amp;op=do_search&amp;marclist=<!-- TMPL_VAR NAME="biblio_fields" -->&amp;operator==&amp;value=<!-- TMPL_VAR NAME="authid" -->&amp;and_or=and&amp;excluding="><!-- TMPL_VAR NAME="used" --> biblio(s)</a>
</td>
<!-- /TMPL_UNLESS -->
<td>
<a href="detail.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit Authority No. <!-- TMPL_VAR NAME="authid" --></a>
<td><a href="/cgi-bin/koha/catalogue-home.pl?authtype=<!-- TMPL_VAR NAME="authtypecode" -->&amp;authnumber=<!-- TMPL_VAR NAME="authid" --> <!-- TMPL_VAR NAME="linkid" -->&amp;op=do_search&amp;zoom=1&amp;search_type=precise" class="button authority"><!-- TMPL_VAR NAME="used" --> biblio(s)</a></td>
<td><!-- TMPL_VAR NAME="authid" -->&nbsp;
<!-- TMPL_UNLESS name="used" -->
<a href="javascript:do_delete('authorities-home.pl?op=delete&authid=<!-- TMPL_VAR NAME="authid" -->')">Delete</a>
<!-- /TMPL_UNLESS -->
</td>
<td>
<!-- TMPL_UNLESS name="used" -->
<a href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="authid" -->)">Delete</a>
<!-- /TMPL_UNLESS -->
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
@ -63,26 +62,48 @@
<div id="resultnumber">
<p>
<!-- TMPL_IF name="displayprev" -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&authtypecode=<!-- TMPL_VAR name="authtypecode" -->">&lt;&lt;</a>
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/prev.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF name="highlight" --><span class="current"><!-- TMPL_VAR NAME="number" --></span><!-- TMPL_ELSE -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&authtypecode=<!-- TMPL_VAR name="authtypecode" -->"><!-- TMPL_VAR NAME="number" --></a>
<!-- TMPL_IF name="highlight" -->
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->-highlight.gif">
<!-- TMPL_ELSE -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/<!-- TMPL_VAR NAME="number" -->.gif" border="0">
</a>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- TMPL_IF name="displaynext" -->
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">&gt;&gt;</a>
<a href="authorities-home.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;<!-- TMPL_LOOP NAME="searchdata" --><!-- TMPL_VAR NAME="term" -->=<!-- TMPL_VAR NAME="val" ESCAPE=URL -->&amp;<!-- /TMPL_LOOP -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;stype=author&amp;op=do_search&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">
<img src="/intranet-tmpl/default/images/numbers/next.gif" border="0">
</a>
<!-- /TMPL_IF -->
</p>
</div>
<form name"m" id="m">
From:<input type="text" size="10" name="mergefrom" id="mergefrom" value=""/>&nbsp;&nbsp;To:<input type="text" size="10" id="mergeto" name="mergeto" value=""/>
<input type="button" class="submit" value="Merge" onclick="do_merge(); return false;" /></form>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
<script language="JavaScript" type="text/javascript" >
function confirm_deletion(id) {
var is_confirmed = confirm('Are you sure you want to delete this authority?');
function do_delete(page)
{
window.location = page;
}
function do_merge(page)
{
X = document.forms['m'].elements['mergefrom'].value;
Y = document.forms['m'].elements['mergeto'].value;
var is_confirmed = confirm('Bu:'+X+' numaralı kayıtdan '+Y+' nolu kayda birleştirme yapacaksınız. Onaylıyor musunuz?');
if (is_confirmed) {
window.location="authorities-home.pl?op=delete&amp;authid="+id;
}
window.location="authorities-home.pl?op=merge&mergefrom="+X+"&mergeto="+Y;
}
}
</script>

View File

@ -1,4 +1,4 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Catalog: Simple Search<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Catalog: Simple Search<!-- TMPL_INCLUDE NAME="doc-head-close-cat.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
@ -223,7 +223,7 @@
<option value="" selected>Ranked</option>
<option value="1=4 i<" >Title</option>
<option value="1=1003 i<" >Author</option>
<option value="1=9 i< 1=16 i<" >LC classification</option>
<option value="1=9 i< " >LC classification</option>
</select>
</td></tr>
<tr><td><b>Search Type</b></td><td>ZOOM<input type="radio" name="zoom" value="1" checked=1>Normal<input type="radio" name="zoom" value="0"></td></tr>

View File

@ -75,8 +75,8 @@ function show_shelfPanel() {
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF NAME="highlight" -->
<span class="current>
<a class="current> <!-- TMPL_VAR NAME="number" --></a>
<span class="current">
<!-- TMPL_VAR NAME="number" -->
</span>
<!-- TMPL_ELSE -->
<span class="pages">
@ -211,17 +211,17 @@ function show_shelfPanel() {
</table>
</form>
<br>
<div style="width:80%;text-align:center;margin-top:10px;margin-bottom:10px;">
<div class="pages">
<!-- Row of numbers corresponding to search result pages -->
<!-- TMPL_LOOP NAME="numbers" -->
<!-- TMPL_IF NAME="highlight" -->
<span class="smallnumberactive">
<span class="current">
<!-- TMPL_VAR NAME="number" -->
</span>
<!-- TMPL_ELSE -->
<span class="smallnumber">
<a style="color:white" href="/cgi-bin/koha/catalogue-home.pl?op=do_search&startfrom=<!-- TMPL_VAR NAME="startfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&amp;<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE="URL" --><!-- /TMPL_LOOP -->&amp;pg=<!-- TMPL_VAR NAME="pg" -->"><!-- TMPL_VAR NAME=number --></a>
<span class="pages">
<a class="pages" href="/cgi-bin/koha/catalogue-home.pl?op=do_search&startfrom=<!-- TMPL_VAR NAME="startfrom" --><!-- TMPL_LOOP NAME="FORMINPUTS" -->&amp;<!-- TMPL_VAR NAME="field" -->=<!-- TMPL_VAR NAME="value" ESCAPE="URL" --><!-- /TMPL_LOOP -->&amp;pg=<!-- TMPL_VAR NAME="pg" -->"><!-- TMPL_VAR NAME=number --></a>
</span>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->

View File

@ -148,7 +148,7 @@
<th>Edit</th>
<th>Delete</th>
<!-- TMPL_LOOP NAME="loop" -->
<!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
<tr valign="top" bgcolor="<!-- TMPL_VAR NAME="bgcolor" -->">
<td><b><!-- TMPL_VAR NAME="tagfield" --></b></td>
<td><!-- TMPL_VAR NAME="liblibrarian" --></td>
<td><!-- TMPL_IF NAME="repeatable" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
@ -166,10 +166,10 @@
<input type="hidden" name="op" value="add_form" />
<input type="submit" class="submit" value="Add Tag" />
<!-- TMPL_IF NAME="isprevpage" -->
<a href="<!-- TMPL_VAR NAME="script_name" -->?offset=<!-- TMPL_VAR NAME="prevpage" -->&amp;searchfield=<!-- TMPL_VAR NAME="searchfield" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">Previous Page</a>
<a href="<!-- TMPL_VAR NAME="script_name" -->?offset=<!-- TMPL_VAR NAME="prevpage" -->&amp;searchfield=<!-- TMPL_VAR NAME="searchfield" -->">Previous Page</a>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="nextpage" -->
<a href="<!-- TMPL_VAR NAME="script_name" -->?offset=<!-- TMPL_VAR NAME="nextpage" -->&amp;searchfield=<!-- TMPL_VAR NAME="searchfield" -->&amp;authtypecode=<!-- TMPL_VAR name="authtypecode" -->">Next Page</a>
<a href="<!-- TMPL_VAR NAME="script_name" -->?offset=<!-- TMPL_VAR NAME="nextpage" -->&amp;searchfield=<!-- TMPL_VAR NAME="searchfield" -->">Next Page</a>
<!-- /TMPL_IF -->
</form>
</div>