creationdate => format_date( $basket->{creationdate} ),
authorisedbyname => $basket->{authorisedbyname},);
}else{
- my @datetoday = localtime();
- my $date = (1900+$datetoday[5])."-".($datetoday[4]+1)."-". $datetoday[3];
+
+ my $date = get_today();
$template->param(
creationdate => format_date($date),
authorisedbyname => $loggedinuser,);
use strict;
use CGI;
use C4::Auth;
-use C4::Output;
use C4::Interface::CGI::Output;
#---- if primkey exists, it's a modify action, so read values to modify...
my $data;
if ($id) {
- $sth=$dbh->prepare("select id,kohafield,attr,extraattr,label,sorts,recordtype,tagfield,tagsubfield,opacshow,intrashow,facets_label from koha_attr where id=? ");
+ $sth=$dbh->prepare("select id,kohafield,attr,label,sorts,recordtype,tagfield,tagsubfield,opacshow,intrashow from koha_attr where id=? ");
$sth->execute($id);
$data=$sth->fetchrow_hashref;
$sth->finish;
$template->param('use-heading-flags-p' => 1);
$template->param(label => $data->{'label'},
attr=> $data->{'attr'},
- extraattr=>$data->{'extraattr'},
recordtype=>$recordlist,
tagfield=>$taglist,
tagsubfield=>$tagsublist,
- facets_label=>$data->{'facets_label'},
sorts => CGI::checkbox(-name=>'sorts',
- -checked=> $data->{'sorts'}?'checked':'',
+ -checked=> $data->{'sorts'}?'checked':'',
-value=> 1,
-label => '',
-id=> 'sorts'),
} elsif ($op eq 'add_validate') {
my $id =$input->param('id');
- $sth=$dbh->prepare("replace koha_attr set id=?,kohafield=?,attr=?,extraattr=?,label=?,sorts=?,recordtype=?,tagfield=?,tagsubfield=? ,opacshow=?,intrashow=? ,facets_label=?");
+ $sth=$dbh->prepare("replace koha_attr set id=?,kohafield=?,attr=?,label=?,sorts=?,recordtype=?,tagfield=?,tagsubfield=? ,opacshow=?,intrashow=? ");
my $kohafield =$input->param('kohafield');
my $attr =$input->param('attr');
- my $extraattr =$input->param('extraattr');
my $label = $input->param('label');
my $sorts =$input->param('sorts');
my $opacshow =$input->param('opacshow');
my $recordtype =$input->param('recordtype');
my $tagfield =$input->param('tagfield');
my $tagsubfield =$input->param('tagsubfield');
- my $facets_label =$input->param('facets_label');
unless (C4::Context->config('demo') eq 1) {
- $sth->execute( $id,$kohafield,$attr,$extraattr,$label,$sorts?1:0,$recordtype,$tagfield,$tagsubfield,$opacshow?1:0,$intrashow?1:0,$facets_label);
+ $sth->execute( $id,$kohafield,$attr,$label,$sorts?1:0,$recordtype,$tagfield,$tagsubfield,$opacshow?1:0,$intrashow?1:0);
}
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=koha_attr.pl?searchfield=$kohafield\"></html>";
$row_data{label} = $results[$i]->{'label'};
$row_data{sorts} = $results[$i]->{'sorts'};
$row_data{attr} = $results[$i]->{'attr'};
- $row_data{extraattr} = $results[$i]->{'extraattr'};
$row_data{recordtype} = $results[$i]->{'recordtype'};
$row_data{tagfield} = $results[$i]->{'tagfield'};
$row_data{tagsubfield} = $results[$i]->{'tagsubfield'};
$row_data{opacshow} = $results[$i]->{'opacshow'};
$row_data{intrashow} = $results[$i]->{'intrashow'};
- $row_data{facets_label} = $results[$i]->{'facets_label'};
$row_data{edit} = "$script_name?op=add_form&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
$row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
$row_data{toggle} = $toggle;
$row_data{label} = $results[$i]->{'label'};
$row_data{sorts} = $results[$i]->{'sorts'};
$row_data{attr} = $results[$i]->{'attr'};
- $row_data{extraattr} = $results[$i]->{'extraattr'};
$row_data{recordtype} = $results[$i]->{'recordtype'};
$row_data{tagfield} = $results[$i]->{'tagfield'};
$row_data{tagsubfield} = $results[$i]->{'tagsubfield'};
$row_data{opacshow} = $results[$i]->{'opacshow'};
$row_data{intrashow} = $results[$i]->{'intrashow'};
- $row_data{facets_label} = $results[$i]->{'facets_label'};
- $row_data{edit} = "$script_name?op=add_form&searchfield=".$results[$i]->{marctokoha}."&id=".$results[$i]->{'id'};
- $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results[$i]->{marctokoha}."&id=".$results[$i]->{'id'};
+ $row_data{edit} = "$script_name?op=add_form&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
+ $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results[$i]->{'kohafield'}."&id=".$results[$i]->{'id'};
$row_data{toggle} = $toggle;
push(@loop_data, \%row_data);
}
$tabsysprefs{z3950AuthorAuthFields}="Catalogue";
$tabsysprefs{z3950NormalizeAuthor}="Catalogue";
$tabsysprefs{SQLorZEBRA}="Catalogue";
+
# Circulation
$tabsysprefs{maxoutstanding}="Circulation";
$tabsysprefs{maxreserves}="Circulation";
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
- my $sth=$dbh->prepare("Select host,port,db,userid,password,name,id,checked,rank,syntax from z3950servers where (name like ?) order by rank,name");
+ my $sth=$dbh->prepare("Select * from z3950servers where (name like ?) order by rank,name");
$sth->execute("$data[0]\%");
my @results;
while (my $data=$sth->fetchrow_hashref) {
my $data;
if ($searchfield) {
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax from z3950servers where (name = ?) order by rank,name");
+ my $sth=$dbh->prepare("select * from z3950servers where (name = ?) order by rank,name");
$sth->execute($searchfield);
$data=$sth->fetchrow_hashref;
$sth->finish;
db => $data->{'db'},
userid => $data->{'userid'},
password => $data->{'password'},
- checked => $data->{'checked'},
+
+ opacshow => CGI::checkbox(-name=>'opacshow',
+ -checked=> $data->{'opacshow'}?'checked':'',
+ -value=> 1,
+ -label => '',
+ -id=> 'opacshow'),
+ checked => CGI::checkbox(-name=>'checked',
+ -checked=> $data->{'checked'}?'checked':'',
+ -value=> 1,
+ -label => '',
+ -id=> 'checked'),
rank => $data->{'rank'});
# END $OP eq ADD_FORM
################## ADD_VALIDATE ##################################
my $sth=$dbh->prepare("select * from z3950servers where name=?");
$sth->execute($input->param('searchfield'));
if ($sth->rows) {
- $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=? where name=?");
+ $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,opacshow=?,syntax=? where name=?");
$sth->execute($input->param('host'),
$input->param('port'),
$input->param('db'),
$input->param('userid'),
$input->param('password'),
$input->param('searchfield'),
- $input->param('checked'),
+ $input->param('checked')?1:0,
$input->param('rank'),
+ $input->param('opacshow')?1:0,
$input->param('syntax'),
$input->param('searchfield'),
);
} else {
- $sth=$dbh->prepare("insert into z3950servers (host,port,db,userid,password,name,checked,rank,syntax) values (?, ?, ?, ?, ?, ?, ?, ?,?)");
- $sth->execute($input->param('host'),
- $input->param('port'),
- $input->param('db'),
- $input->param('userid'),
- $input->param('password'),
- $input->param('searchfield'),
- $input->param('checked'),
- $input->param('rank'),
- $input->param('syntax'),
- );
+ $sth=$dbh->prepare("insert into z3950servers (host,port,db,userid,password,name,checked,rank,opacshow,syntax) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
+ $sth->execute($input->param('host'), $input->param('port'), $input->param('db'), $input->param('userid'),
+ $input->param('password'), $input->param('searchfield'),$input->param('checked')?1:0, $input->param('rank'),
+ $input->param('opacshow')?1:0,$input->param('syntax') );
}
$sth->finish;
# END $OP eq ADD_VALIDATE
$template->param(delete_confirm => 1);
my $dbh = C4::Context->dbh;
- my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax from z3950servers where (name = ?) order by rank,name");
+ my $sth2=$dbh->prepare("select * from z3950servers where (name = ?) order by rank,name");
$sth2->execute($searchfield);
my $data=$sth2->fetchrow_hashref;
$sth2->finish;
db => $data->{'db'},
userid => $data->{'userid'},
password => $data->{'password'},
- checked => $data->{'checked'},
+ checked => CGI::checkbox(-name=>'checked',
+ -checked=> $data->{'checked'}?'checked':'',
+ -value=> 1,
+ -label => '',
+ -id=> 'checked'),
+ opacshow => CGI::checkbox(-name=>'opacshow',
+ -checked=> $data->{'opacshow'}?'checked':'',
+ -value=> 1,
+ -label => '',
+ -id=> 'opacshow'),
rank => $data->{'rank'});
# END $OP eq DELETE_CONFIRM
userid =>$results->[$i]{'userid'},
password => ($results->[$i]{'password'}) ? ('#######') : (' '),
checked => $results->[$i]{'checked'},
+ opacshow => $results->[$i]{'opacshow'},
rank => $results->[$i]{'rank'},
syntax => $results->[$i]{'syntax'},
toggle => $toggle);
if ($tag<10) {
my $value=XML_readline_onerecord($record,"","",$tag);
my $subfieldcode = "@";
- my $subfieldvalue = get_authorised_value_desc($tag, $subf[$i][0], $value, '', $dbh);;
+ my $subfieldvalue = get_authorised_value_desc($tag, "", $value, '', $dbh);;
my $tagsubf = $tag.$subfieldcode;
$calculated =~ s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue\{$1$tagsubf$2\}$2/g;
} else {
my @subf = XML_readline_withtags($record,"","",$tag);
+
for my $i (0..$#subf) {
my $subfieldcode = $subf[$i][0];
my $subfieldvalue = get_authorised_value_desc($tag, $subf[$i][0], $subf[$i][1], '', $dbh);;
}
#### Now normal search routine
foreach my $field (@fields) {
+ $search{$field} = $query->param($field);
my @fieldvalue = $query->param($field);
foreach my $fvalue (@fieldvalue) {
push @forminputs, { field=>$field ,value=> $fvalue} unless ($field eq 'reorder');
- $facetsdesc.="&".$field."=".$fvalue;
+
}
}
-
-
+## Build the query for facets as well
+ for (my $i=0;$i<@value;$i++){
+$facetsdesc.="&value=".$value[$i];
+$facetsdesc.="&kohafield=".$kohafield[$i];
+$facetsdesc.="&relation=".$relation[$i];
+$facetsdesc.="&and_or=".$and_or[$i];
+}
+$facetsdesc.="&order=".$order;
$hashdesc{'query'} = join " , ", @value;
push @searchdesc,\%hashdesc;
## using sql search for barcode,biblionumber or itemnumber only useful for libraian interface
($count, @results) =sqlsearch($dbh,\%search);
}else{
-my $sortorder=$order.",".$ascend if $order;
+my $sortorder=$order.$ascend if $order;
($count,$facets,@results) =ZEBRAsearch_kohafields(\@kohafield,\@value, \@relation,$sortorder, \@and_or, 1,$reorder,$startfrom, $number_of_results,"intranet",$searchtype);
}
if ( $count eq "error"){
pg => $url };
push @$numbers, { number => ">>",
highlight => 0 , forminputs=>\@forminputs,
- start => ($total_pages-1)*$number_of_results,
+ startfrom => ($total_pages-1)*$number_of_results,
pg => $total_pages};
}
# push @$numbers,{forminputs=>@forminputs};
foreach my $sort (@kohafields) {
if ($sort->{sorts}){
push @sorts,$sort;
- if ($order eq $sort->{'attr'}) {
+ if ($order eq $sort->{'kohafield'}) {
$sort->{'sel'} = 1;
}
}
my $itemtypes=GetItemTypes();
my (@item_type_loop);
foreach my $thisitemtype (sort keys %$itemtypes) {
- my %row =(value => $thisitemtype,
+ my %row =(itemtype => $thisitemtype,
description => $itemtypes->{$thisitemtype}->{'description'},
);
push @item_type_loop, \%row;
use C4::Biblio;
use C4::Context;
-use Encode;
-
my $dbh=C4::Context->dbh;
my $query=new CGI;
my ($template, $borrowernumber, $cookie)
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-
-use HTML::Template;
use strict;
require Exporter;
-use C4::Context;
-use C4::Output; # contains gettemplate
-use CGI;
use C4::Search;
use C4::Auth;
+use C4::Serials; #uses getsubscriptionfrom biblionumber
use C4::Interface::CGI::Output;
-use C4::Date;
+use CGI;
+use C4::Biblio;
+use C4::Context;
+my $dbh=C4::Context->dbh;
my $query=new CGI;
-my $type=$query->param('type');
-($type) || ($type='intra');
-
-my $biblionumber=$query->param('bib');
-
-# change back when ive fixed request.pl
-my @items = ItemInfo(undef, $biblionumber, $type);
+my ($template, $borrowernumber, $cookie)
+ = get_template_and_user({template_name => "catalogue/detailprint.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => {borrow => 1},
+ });
+
+my $biblionumber=$query->param('biblionumber');
+$template->param(biblionumber => $biblionumber);
+my $retrieve_from=C4::Context->preference('retrieve_from');
+my ($record,$frameworkcode);
+my @itemrecords;
+my @items;
+if ($retrieve_from eq "zebra"){
+($record,@itemrecords)=ZEBRAgetrecord($biblionumber);
+}else{
+ $record =XMLgetbiblio($dbh,$biblionumber);
+$record=XML_xml2hash_onerecord($record);
+my @itemxmls=XMLgetallitems($dbh,$biblionumber);
+ foreach my $itemrecord(@itemxmls){
+ my $itemhash=XML_xml2hash_onerecord($itemrecord);
+ push @itemrecords, $itemhash;
+ }
+}
+
+my $dat = XMLmarc2koha_onerecord($dbh,$record,"biblios");
my $norequests = 1;
-foreach my $itm (@items) {
- $norequests = 0 unless $itm->{'notforloan'};
+foreach my $itemrecord (@itemrecords){
+
+my $item= XMLmarc2koha_onerecord($dbh,$itemrecord,"holdings");
+$item=ItemInfo($dbh,$item);
+$item->{itemtype}=$dat->{itemtype};
+ $norequests = 0 unless $item->{'notforloan'};
+ $item->{$item->{'publictype'}} = 1; ## NOT sure what this is kept from old db probably useless now
+push @items,$item;
}
-
-
-my $dat=bibdata($biblionumber);
-my ($authorcount, $addauthor)= &addauthor($biblionumber);
-my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
-my ($websitecount, @websites) = &getwebsites($biblionumber);
+my $subscriptionsnumber = GetSubscriptionsFromBiblionumber($biblionumber);
$dat->{'count'}=@items;
-$dat->{'norequests'} = $norequests;
+$template->param(count =>$dat->{'count'});
+$template->param(norequests => $norequests);
-$dat->{'additional'}=$addauthor->[0]->{'author'};
-for (my $i = 1; $i < $authorcount; $i++) {
- $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
-} # for
+ ## get notes subjects and URLS from MARC record
+
+ my $marcflavour = C4::Context->preference("marcflavour");
+ my $marcnotesarray = &getMARCnotes($dbh,$record,$marcflavour);
+ my $marcsubjctsarray = &getMARCsubjects($dbh,$record,$marcflavour);
+ my $marcurlssarray = &getMARCurls($dbh,$record,$marcflavour);
+ $template->param(MARCURLS => $marcurlssarray);
+ $template->param(MARCNOTES => $marcnotesarray);
+ $template->param(MARCSUBJCTS => $marcsubjctsarray);
-my @results;
-$results[0]=$dat;
+my @results = ($dat,);
my $resultsarray=\@results;
my $itemsarray=\@items;
-my $webarray=\@webbiblioitems;
-my $sitearray=\@websites;
-
-my $startfrom=$query->param('startfrom');
-($startfrom) || ($startfrom=0);
-
-my ($template, $loggedinuser, $cookie) = get_template_and_user({
- template_name => ('catalogue/detailprint.tmpl'),
- query => $query,
- type => "intranet",
- authnotrequired => ($type eq 'opac'),
- flagsrequired => {catalogue => 1},
- });
-
-my $count=1;
-# now to get the items into a hash we can use and whack that thru
-
-my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
-my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
-$template->param(startfrom => $startfrom+1,
- endat => $startfrom+20,
- numrecords => $count,
- nextstartfrom => $nextstartfrom,
- prevstartfrom => $prevstartfrom,
- BIBLIO_RESULTS => $resultsarray,
- ITEM_RESULTS => $itemsarray,
- WEB_RESULTS => $webarray,
- SITE_RESULTS => $sitearray,
- loggedinuser => $loggedinuser,
- biblionumber => $biblionumber,
- );
+$template->param(BIBLIO_RESULTS => $resultsarray,
+ ITEM_RESULTS => $itemsarray,
+ subscriptionsnumber => $subscriptionsnumber,
+);
output_html_with_http_headers $query, $cookie, $template->output;
-
-
-# Local Variables:
-# tab-width: 8
-# End:
}else {
##UPDATE here
-#my $sth=$dbh->prepare("update items set itemlost=? ,wthdrawn=? where itemnumber=?");
-#$sth->execute($lost,$withdrawn,$itemnumber);
-#$sth->finish;
+
XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'wthdrawn',$withdrawn,1);
XMLmoditemonefield($dbh,$biblionumber,$itemnumber,'itemlost',$lost);
use strict;
use C4::Context;
-use C4::Output;
use CGI;
-use HTML::Template;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
-use Date::Manip;
use C4::Reserves2;
use C4::Search;
use C4::Koha;
});
my $default = C4::Context->userenv->{'branch'};
-
-my @datearr = localtime(time());
-my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
+my $dbh=C4::Context->dbh;
+my $todaysdate = get_today();
# if we have a return from the form we launch the subroutine CancelReserve
# if the document is not in his homebranch location and there is not reservation after, we transfer it
if (($fbr ne $tbr) and (not $nextreservinfo)){
C4::Circulation::Circ2::dotransfer($item,$fbr,$tbr);
+ C4::Circulation::Circ2::itemseen($dbh,$itm);
}
}
show_date => format_date($todaysdate),
);
- print "Content-Type: text/html\n\n", $template->output;
\ No newline at end of file
+output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file
use strict;
use CGI;
use C4::Circulation::Circ2;
-use C4::Output;
use C4::Reserves2;
use C4::Auth;
use C4::Interface::CGI::Output;
-use HTML::Template;
use C4::Koha;
use C4::Members;
###############################################
my $linecolor1='#ffffcc';
my $linecolor2='white';
-my $branches = getbranches();
+my $branches = GetBranches();
my $printers = getprinters(\%env);
$env{'printer'}=$printer;
$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 =get_today();
# check and see if we should print
$env{'printer'}=$printer;
$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 =get_today();
# check and see if we should print
use C4::Reserves2;
use C4::Auth;
use C4::Interface::CGI::Output;
-#use HTML::Template;
+
use C4::Koha;
use C4::Members;
my $query = new CGI;
my $linecolor1 = '#ffffcc';
my $linecolor2 = 'white';
-my $branches = getbranches();
+my $branches = GetBranches();
my $printers = getprinters( \%env );
# my $branch = getbranch( $query, $branches );
use C4::Interface::CGI::Output;
use C4::Koha;
use C4::Members;
+use C4::Date;
my $query = new CGI;
#getting the template
my $headerbackgroundcolor = '#99cc33';
my $linecolor1 = '#ffffcc';
my $linecolor2 = 'white';
-
+my $todaysdate =get_today();
my $branches = GetBranches();
my $printers = getprinters( \%env );
}
if ( $res->{'ResFound'} eq "Reserved" ) {
- my @da = localtime( time() );
- my $todaysdate =
- sprintf( "%0.2d", ( $da[3] + 1 ) ) . "/"
- . sprintf( "%0.2d", ( $da[4] + 1 ) ) . "/"
- . ( $da[5] + 1900 );
+
$template->param(
found => 1,
branchname => $branches->{ $res->{'branchcode'} }->{'branchname'},
reserved => 1,
- today => $todaysdate,
+ today =>format_date( $todaysdate),
itemnumber => $res->{'itemnumber'},
itemtitle => $iteminfo->{'title'},
itemauthor => $iteminfo->{'author'},
my $overduetext;
my $borrowerinfo;
if ($duedate) {
- my @tempdate = split ( /-/, $duedate );
- $ri{year}=$tempdate[0];
- $ri{month}=$tempdate[1];
- $ri{day}=$tempdate[2];
- my $duedatenz = "$tempdate[2]/$tempdate[1]/$tempdate[0]";
- my @datearr = localtime( time() );
- my $todaysdate =
- $datearr[5] . '-'
- . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
- . sprintf( "%0.2d", $datearr[3] );
- $ri{duedate}=$duedate;
+
+
+ $ri{duedate}=format_date($duedate);
my ($borrower) =
getpatroninformation( \%env, $riborrowernumber{$_}, 0 );
$ri{bornum} = $borrower->{'borrowernumber'};