use C4::Koha;
use MARC::Record;
use C4::Branch; # GetBranches
+use C4::ItemType;
sub plugin_parameters {
my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
function Clic$function_name(i) {
defaultvalue=document.getElementById(\"$field_number\").value;
- window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
+ window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=\" + i + \"&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
}
</script>
query => $query,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { editcatalogue => 1 },
+ flagsrequired => { editcatalogue => '*' },
debug => 1,
}
);
}
elsif ( $op eq "do_search" ) {
my $search = $query->param('search');
+ my $itype = $query->param('itype');
my $startfrom = $query->param('startfrom');
my $resultsperpage = $query->param('resultsperpage') || 20;
my $orderby;
- my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom, $resultsperpage );
+ $search = 'kw,wrdl='.$search.' and mc-itemtype='.$itype if $itype;
+ my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
my $total = scalar(@$results);
# warn " biblio count : ".$total;
# multi page display gestion
my $displaynext = 0;
my $displayprev = $startfrom;
- if ( ( $total - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
+
+ if( ( $total_hits - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
$displaynext = 1;
}
my @arrayresults;
my @field_data = ($search);
for (
- my $i = $startfrom * $resultsperpage ;
- $i < (( $startfrom * $resultsperpage + $resultsperpage < scalar(@$results))
- ? $startfrom * $resultsperpage + $resultsperpage
- : scalar(@$results)
- ) ;
+ my $i = 0 ;
+ $i < $resultsperpage ;
$i++
)
{
my $from = $startfrom * $resultsperpage + 1;
my $to;
- if ( $total < ( ( $startfrom + 1 ) * $resultsperpage ) ) {
- $to = $total;
- }
- else {
- $to = ( ( $startfrom + 1 ) * $resultsperpage );
+ if ( $total_hits < $from + $resultsperpage ) {
+ $to = $total_hits;
+ }else{
+ $to = $from + $resultsperpage ;
}
my $defaultview =
'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView');
startfromnext => $startfrom + 1,
startfromprev => $startfrom - 1,
searchdata => \@field_data,
- total => $total,
+ total => $total_hits,
from => $from,
to => $to,
numbers => \@numbers,
# }
# $sth->finish;
+ my @itemtypes = C4::ItemType->all;
+
$template->param( #classlist => $classlist,
CGIitemtype => $CGIitemtype,
CGIbranch => $CGIbranch,
CGIPublisher => $CGIpublisher,
+ itypeloop => \@itemtypes,
index => $query->param('index'),
Search => 1,
);