require Exporter;
use C4::Context;
-use C4::Output; # to get the template
+use C4::Templates; # to get the template
use C4::Members;
use C4::Koha;
use C4::Branch; # GetBranches
sub get_template_and_user {
my $in = shift;
my $template =
- gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
+ C4::Templates::gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
my ( $user, $cookie, $sessionID, $flags );
if ( $in->{'template_name'} !~m/maintenance/ ) {
( $user, $cookie, $sessionID, $flags ) = checkauth(
}
my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl';
- my $template = gettemplate( $template_name, $type, $query );
+ my $template = C4::Templates::gettemplate( $template_name, $type, $query );
$template->param(branchloop => \@branch_loop,);
my $checkstyle = C4::Context->preference("opaccolorstylesheet");
if ($checkstyle =~ /\//)
=head2 TransformHtmlToMarc
- L<$record> = TransformHtmlToMarc(L<$params>,L<$cgi>)
- L<$params> is a ref to an array as below:
+ L<$record> = TransformHtmlToMarc(L<$cgi>)
+ L<$cgi> is the CGI object which containts the values for subfields
{
'tag_010_indicator1_531951' ,
'tag_010_indicator2_531951' ,
'tag_200_code_f_873510_110730' ,
'tag_200_subfield_f_873510_110730' ,
}
- L<$cgi> is the CGI object which containts the value.
L<$record> is the MARC::Record object.
=cut
sub TransformHtmlToMarc {
- my $params = shift;
my $cgi = shift;
+ my @params = $cgi->param();
+
# explicitly turn on the UTF-8 flag for all
# 'tag_' parameters to avoid incorrect character
# conversion later on
my $record = MARC::Record->new();
my $i = 0;
my @fields;
- while ( $params->[$i] ) { # browse all CGI params
- my $param = $params->[$i];
+ while ( $params[$i] ) { # browse all CGI params
+ my $param = $params[$i];
my $newfield = 0;
# if we are on biblionumber, store it in the MARC::Record (it may not be in the edited fields)
my $tag = $1;
my $ind1 = _default_ind_to_space( substr( $cgi->param($param), 0, 1 ) );
- my $ind2 = _default_ind_to_space( substr( $cgi->param( $params->[ $i + 1 ] ), 0, 1 ) );
+ my $ind2 = _default_ind_to_space( substr( $cgi->param( $params[ $i + 1 ] ), 0, 1 ) );
$newfield = 0;
my $j = $i + 2;
# Force a fake leader even if not provided to avoid crashing
# during decoding MARC record containing UTF-8 characters
$record->leader(
- length( $cgi->param($params->[$j+1]) ) == 24
- ? $cgi->param( $params->[ $j + 1 ] )
+ length( $cgi->param($params[$j+1]) ) == 24
+ ? $cgi->param( $params[ $j + 1 ] )
: ' nam a22 4500'
)
;
# between 001 and 009 (included)
- } elsif ( $cgi->param( $params->[ $j + 1 ] ) ne '' ) {
- $newfield = MARC::Field->new( $tag, $cgi->param( $params->[ $j + 1 ] ), );
+ } elsif ( $cgi->param( $params[ $j + 1 ] ) ne '' ) {
+ $newfield = MARC::Field->new( $tag, $cgi->param( $params[ $j + 1 ] ), );
}
# > 009, deal with subfields
} else {
- while ( defined $params->[$j] && $params->[$j] =~ /_code_/ ) { # browse all it's subfield
- my $inner_param = $params->[$j];
+ while ( defined $params[$j] && $params[$j] =~ /_code_/ ) { # browse all it's subfield
+ my $inner_param = $params[$j];
if ($newfield) {
- if ( $cgi->param( $params->[ $j + 1 ] ) ne '' ) { # only if there is a value (code => value)
- $newfield->add_subfields( $cgi->param($inner_param) => $cgi->param( $params->[ $j + 1 ] ) );
+ if ( $cgi->param( $params[ $j + 1 ] ) ne '' ) { # only if there is a value (code => value)
+ $newfield->add_subfields( $cgi->param($inner_param) => $cgi->param( $params[ $j + 1 ] ) );
}
} else {
- if ( $cgi->param( $params->[ $j + 1 ] ) ne '' ) { # creating only if there is a value (code => value)
- $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($inner_param) => $cgi->param( $params->[ $j + 1 ] ), );
+ if ( $cgi->param( $params[ $j + 1 ] ) ne '' ) { # creating only if there is a value (code => value)
+ $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($inner_param) => $cgi->param( $params[ $j + 1 ] ), );
}
}
$j += 2;
my ($budget_id) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(qq|
- SELECT SUM(ecost * quantity) AS sum FROM aqorders
+ SELECT SUM( COALESCE(unitprice, ecost) * quantity ) AS sum FROM aqorders
WHERE budget_id = ? AND
quantityreceived > 0 AND
datecancellationprinted IS NULL
#use warnings; FIXME - Bug 2505
use C4::Context;
-use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language_get_description accept_language );
use C4::Dates qw(format_date);
use C4::Budgets qw(GetCurrency);
use C4::Templates;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
- %EXPORT_TAGS = ( all =>[qw(&themelanguage &gettemplate setlanguagecookie pagination_bar
- &output_with_http_headers &output_html_with_http_headers)],
+ %EXPORT_TAGS = ( all =>[qw(&pagination_bar
+ &output_with_http_headers &output_html_with_http_headers)],
ajax =>[qw(&output_with_http_headers is_ajax)],
html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
);
push @EXPORT, qw(
- &themelanguage &gettemplate setlanguagecookie getlanguagecookie pagination_bar
- );
- push @EXPORT, qw(
- &output_html_with_http_headers &output_with_http_headers FormatData FormatNumber
+ &output_html_with_http_headers &output_with_http_headers FormatData FormatNumber pagination_bar
);
}
+
=head1 NAME
-C4::Output - Functions for managing templates
+C4::Output - Functions for managing output, is slowly being deprecated
=head1 FUNCTIONS
=over 2
-
=cut
-#FIXME: this is a quick fix to stop rc1 installing broken
-#Still trying to figure out the correct fix.
-my $path = C4::Context->config('intrahtdocs') . "/prog/en/includes/";
-
-#---------------------------------------------------------------------------------------------------------
-# FIXME - POD
-
-sub _get_template_file {
- my ( $tmplbase, $interface, $query ) = @_;
- my $htdocs = C4::Context->config( $interface ne 'intranet' ? 'opachtdocs' : 'intrahtdocs' );
- my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, $interface, $query );
- my $opacstylesheet = C4::Context->preference('opacstylesheet');
-
- # if the template doesn't exist, load the English one as a last resort
- my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
- unless (-f $filename) {
- $lang = 'en';
- $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
- }
-
- return ( $htdocs, $theme, $lang, $filename );
-}
-
-sub gettemplate {
- my ( $tmplbase, $interface, $query ) = @_;
- ($query) or warn "no query in gettemplate";
- my $path = C4::Context->preference('intranet_includes') || 'includes';
- my $opacstylesheet = C4::Context->preference('opacstylesheet');
- $tmplbase =~ s/\.tmpl$/.tt/;
- my ( $htdocs, $theme, $lang, $filename ) = _get_template_file( $tmplbase, $interface, $query );
- my $template = C4::Templates->new( $interface, $filename, $tmplbase);
- my $themelang=( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' )
- . "/$theme/$lang";
- $template->param(
- themelang => $themelang,
- yuipath => (C4::Context->preference("yuipath") eq "local"?"$themelang/lib/yui":C4::Context->preference("yuipath")),
- interface => ( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' ),
- theme => $theme,
- lang => $lang
- );
-
- # Bidirectionality
- my $current_lang = regex_lang_subtags($lang);
- my $bidi;
- $bidi = get_bidi($current_lang->{script}) if $current_lang->{script};
- # Languages
- my $languages_loop = getTranslatedLanguages($interface,$theme,$lang);
- my $num_languages_enabled = 0;
- foreach my $lang (@$languages_loop) {
- foreach my $sublang (@{ $lang->{'sublanguages_loop'} }) {
- $num_languages_enabled++ if $sublang->{enabled};
- }
- }
- $template->param(
- languages_loop => $languages_loop,
- bidi => $bidi,
- one_language_enabled => ($num_languages_enabled <= 1) ? 1 : 0, # deal with zero enabled langs as well
- ) unless @$languages_loop<2;
-
- return $template;
-}
-
-# FIXME - this is a horrible hack to cache
-# the current known-good language, temporarily
-# put in place to resolve bug 4403. It is
-# used only by C4::XSLT::XSLTParse4Display;
-# the language is set via the usual call
-# to themelanguage.
-my $_current_language = 'en';
-sub _current_language {
- return $_current_language;
-}
-
-#---------------------------------------------------------------------------------------------------------
-# FIXME - POD
-sub themelanguage {
- my ( $htdocs, $tmpl, $interface, $query ) = @_;
- ($query) or warn "no query in themelanguage";
-
- # Set some defaults for language and theme
- # First, check the user's preferences
- my $lang;
- my $http_accept_language = $ENV{ HTTP_ACCEPT_LANGUAGE };
- $lang = accept_language( $http_accept_language,
- getTranslatedLanguages($interface,'prog') )
- if $http_accept_language;
- # But, if there's a cookie set, obey it
- $lang = $query->cookie('KohaOpacLanguage') if (defined $query and $query->cookie('KohaOpacLanguage'));
- # Fall back to English
- my @languages;
- if ($interface eq 'intranet') {
- @languages = split ",", C4::Context->preference("language");
- } else {
- @languages = split ",", C4::Context->preference("opaclanguages");
- }
- if ($lang){
- @languages=($lang,@languages);
- } else {
- $lang = $languages[0];
- }
- my $theme = 'prog'; # in the event of theme failure default to 'prog' -fbcit
- my $dbh = C4::Context->dbh;
- my @themes;
- if ( $interface eq "intranet" ) {
- @themes = split " ", C4::Context->preference("template");
- }
- else {
- # we are in the opac here, what im trying to do is let the individual user
- # set the theme they want to use.
- # and perhaps the them as well.
- #my $lang = $query->cookie('KohaOpacLanguage');
- @themes = split " ", C4::Context->preference("opacthemes");
- }
-
- # searches through the themes and languages. First template it find it returns.
- # Priority is for getting the theme right.
- THEME:
- foreach my $th (@themes) {
- foreach my $la (@languages) {
- #for ( my $pass = 1 ; $pass <= 2 ; $pass += 1 ) {
- # warn "$htdocs/$th/$la/modules/$interface-"."tmpl";
- #$la =~ s/([-_])/ $1 eq '-'? '_': '-' /eg if $pass == 2;
- if ( -e "$htdocs/$th/$la/modules/$tmpl") {
- #".($interface eq 'intranet'?"modules":"")."/$tmpl" ) {
- $theme = $th;
- $lang = $la;
- last THEME;
- }
- last unless $la =~ /[-_]/;
- #}
- }
- }
-
- $_current_language = $lang; # FIXME part of bad hack to paper over bug 4403
- return ( $theme, $lang );
-}
-
-sub setlanguagecookie {
- my ( $query, $language, $uri ) = @_;
- my $cookie = $query->cookie(
- -name => 'KohaOpacLanguage',
- -value => $language,
- -expires => ''
- );
- print $query->redirect(
- -uri => $uri,
- -cookie => $cookie
- );
-}
-
-sub getlanguagecookie {
- my ($query) = @_;
- my $lang;
- if ($query->cookie('KohaOpacLanguage')){
- $lang = $query->cookie('KohaOpacLanguage') ;
- }else{
- $lang = $ENV{HTTP_ACCEPT_LANGUAGE};
-
- }
- $lang = substr($lang, 0, 2);
-
- return $lang;
-}
-
=item FormatNumber
=cut
sub FormatNumber{
# It's ok to check it in if it exists, and if it was checked out
$circ->ok($item && $item->{patron});
- if ($circ->ok) {
- $circ->patron($patron = new ILS::Patron $item->{patron});
- delete $item->{patron};
- delete $item->{due_date};
- $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
- }
+ if (!defined($item->{patron})) {
+ $circ->screen_msg("Item not checked out");
+ } else {
+ if ($circ->ok) {
+ $circ->patron($patron = new ILS::Patron $item->{patron});
+ delete $item->{patron};
+ delete $item->{due_date};
+ $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
+ }
+ }
# END TRANSACTION
return $circ;
use base qw(Class::Accessor);
use Template;
use Template::Constants qw( :debug );
+use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language_get_description accept_language );
use C4::Context;
__PACKAGE__->mk_accessors(qw( theme lang filename htdocs interface vars));
+
+
sub new {
my $class = shift;
my $interface = shift;
my $filename = shift;
my $tmplbase = shift;
+ my $query = @_? shift: undef;
my $htdocs;
if ( $interface ne "intranet" ) {
$htdocs = C4::Context->config('opachtdocs');
$htdocs = C4::Context->config('intrahtdocs');
}
- my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, $interface );
+ my ($theme, $lang)= themelanguage( $htdocs, $tmplbase, $interface, $query);
my $template = Template->new(
{
EVAL_PERL => 1,
return $_current_language;
}
-sub themelanguage {
+sub themelanguage_lite {
my ( $htdocs, $tmpl, $interface ) = @_;
my $query = new CGI;
}
}
+
+=head1 NAME
+
+C4::Templates - Functions for managing templates
+
+=head1 FUNCTIONS
+
+=cut
+
+# FIXME: this is a quick fix to stop rc1 installing broken
+# Still trying to figure out the correct fix.
+my $path = C4::Context->config('intrahtdocs') . "/prog/en/includes/";
+
+#---------------------------------------------------------------------------------------------------------
+# FIXME - POD
+
+sub _get_template_file {
+ my ( $tmplbase, $interface, $query ) = @_;
+ my $htdocs = C4::Context->config( $interface ne 'intranet' ? 'opachtdocs' : 'intrahtdocs' );
+ my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, $interface, $query );
+ my $opacstylesheet = C4::Context->preference('opacstylesheet');
+
+ # if the template doesn't exist, load the English one as a last resort
+ my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
+ unless (-f $filename) {
+ $lang = 'en';
+ $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
+ }
+
+ return ( $htdocs, $theme, $lang, $filename );
+}
+
+sub gettemplate {
+ my ( $tmplbase, $interface, $query ) = @_;
+ ($query) or warn "no query in gettemplate";
+ my $path = C4::Context->preference('intranet_includes') || 'includes';
+ my $opacstylesheet = C4::Context->preference('opacstylesheet');
+ $tmplbase =~ s/\.tmpl$/.tt/;
+ my ( $htdocs, $theme, $lang, $filename ) = _get_template_file( $tmplbase, $interface, $query );
+ my $template = C4::Templates->new($interface, $filename, $tmplbase, $query);
+ my $themelang=( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' )
+ . "/$theme/$lang";
+ $template->param(
+ themelang => $themelang,
+ yuipath => (C4::Context->preference("yuipath") eq "local"?"$themelang/lib/yui":C4::Context->preference("yuipath")),
+ interface => ( $interface ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' ),
+ theme => $theme,
+ lang => $lang
+ );
+
+ # Bidirectionality
+ my $current_lang = regex_lang_subtags($lang);
+ my $bidi;
+ $bidi = get_bidi($current_lang->{script}) if $current_lang->{script};
+ # Languages
+ my $languages_loop = getTranslatedLanguages($interface,$theme,$lang);
+ my $num_languages_enabled = 0;
+ foreach my $lang (@$languages_loop) {
+ foreach my $sublang (@{ $lang->{'sublanguages_loop'} }) {
+ $num_languages_enabled++ if $sublang->{enabled};
+ }
+ }
+ $template->param(
+ languages_loop => $languages_loop,
+ bidi => $bidi,
+ one_language_enabled => ($num_languages_enabled <= 1) ? 1 : 0, # deal with zero enabled langs as well
+ ) unless @$languages_loop<2;
+
+ return $template;
+}
+
+
+#---------------------------------------------------------------------------------------------------------
+# FIXME - POD
+sub themelanguage {
+ my ( $htdocs, $tmpl, $interface, $query ) = @_;
+ ($query) or warn "no query in themelanguage";
+
+ # Set some defaults for language and theme
+ # First, check the user's preferences
+ my $lang;
+ my $http_accept_language = $ENV{ HTTP_ACCEPT_LANGUAGE };
+ $lang = accept_language( $http_accept_language,
+ getTranslatedLanguages($interface,'prog') )
+ if $http_accept_language;
+ # But, if there's a cookie set, obey it
+ $lang = $query->cookie('KohaOpacLanguage') if (defined $query and $query->cookie('KohaOpacLanguage'));
+ # Fall back to English
+ my @languages;
+ if ($interface eq 'intranet') {
+ @languages = split ",", C4::Context->preference("language");
+ } else {
+ @languages = split ",", C4::Context->preference("opaclanguages");
+ }
+ if ($lang){
+ @languages=($lang,@languages);
+ } else {
+ $lang = $languages[0];
+ }
+ my $theme = 'prog'; # in the event of theme failure default to 'prog' -fbcit
+ my $dbh = C4::Context->dbh;
+ my @themes;
+ if ( $interface eq "intranet" ) {
+ @themes = split " ", C4::Context->preference("template");
+ }
+ else {
+ # we are in the opac here, what im trying to do is let the individual user
+ # set the theme they want to use.
+ # and perhaps the them as well.
+ #my $lang = $query->cookie('KohaOpacLanguage');
+ @themes = split " ", C4::Context->preference("opacthemes");
+ }
+
+ # searches through the themes and languages. First template it find it returns.
+ # Priority is for getting the theme right.
+ THEME:
+ foreach my $th (@themes) {
+ foreach my $la (@languages) {
+ #for ( my $pass = 1 ; $pass <= 2 ; $pass += 1 ) {
+ # warn "$htdocs/$th/$la/modules/$interface-"."tmpl";
+ #$la =~ s/([-_])/ $1 eq '-'? '_': '-' /eg if $pass == 2;
+ if ( -e "$htdocs/$th/$la/modules/$tmpl") {
+ #".($interface eq 'intranet'?"modules":"")."/$tmpl" ) {
+ $theme = $th;
+ $lang = $la;
+ last THEME;
+ }
+ last unless $la =~ /[-_]/;
+ #}
+ }
+ }
+
+ $_current_language = $lang; # FIXME part of bad hack to paper over bug 4403
+ return ( $theme, $lang );
+}
+
+sub setlanguagecookie {
+ my ( $query, $language, $uri ) = @_;
+ my $cookie = $query->cookie(
+ -name => 'KohaOpacLanguage',
+ -value => $language,
+ -expires => ''
+ );
+ print $query->redirect(
+ -uri => $uri,
+ -cookie => $cookie
+ );
+}
+
+sub getlanguagecookie {
+ my ($query) = @_;
+ my $lang;
+ if ($query->cookie('KohaOpacLanguage')){
+ $lang = $query->cookie('KohaOpacLanguage') ;
+ }else{
+ $lang = $ENV{HTTP_ACCEPT_LANGUAGE};
+
+ }
+ $lang = substr($lang, 0, 2);
+
+ return $lang;
+}
+
1;
use C4::Biblio;
use C4::Circulation;
use C4::Reserves;
-use C4::Output qw//;
use Encode;
use XML::LibXML;
use XML::LibXSLT;
if ($interface eq 'intranet') {
$xslfile = C4::Context->config('intrahtdocs') .
'/' . C4::Context->preference("template") .
- '/' . C4::Output::_current_language() .
+ '/' . C4::Templates::_current_language() .
'/xslt/' .
C4::Context->preference('marcflavour') .
"slim2intranet$xsl_suffix.xsl";
} else {
$xslfile = C4::Context->config('opachtdocs') .
'/' . C4::Context->preference("opacthemes") .
- '/' . C4::Output::_current_language() .
+ '/' . C4::Templates::_current_language() .
'/xslt/' .
C4::Context->preference('marcflavour') .
"slim2OPAC$xsl_suffix.xsl";
use XML::Simple;
use Config;
-use C4::Output; # contains gettemplate
+use C4::Output;
use C4::Auth;
use C4::Context;
use C4::Installer;
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
my $basketgroups;
my $member = GetMember(borrowernumber => $loggedinuser);
- if ($basket->{closedate} && haspermission({ flagsrequired => { acquisition => 'group_manage'} })) {
+ if ($basket->{closedate} && haspermission({ acquisition => 'group_manage'} )) {
$basketgroups = GetBasketgroups($basket->{booksellerid});
for my $bg ( @{$basketgroups} ) {
if ($basket->{basketgroupid} && $basket->{basketgroupid} == $bg->{id}){
if (( $basket->{authorisedby}
&& $basket->{authorisedby} eq $loggedinuser
)
- || haspermission( $uid, { flagsrequired => { acquisition => q{*} } } )
+ || haspermission( $uid, { acquisition => q{*} } )
) {
for my $date_field (qw( creationdate closedate)) {
if ( $basket->{$date_field} ) {
use C4::ClassSource;
use C4::Log;
use C4::Output;
+use C4::Templates;
use C4::Budgets qw(GetCurrency);
use File::Spec;
use IO::File;
sub GetTab {
my ( $input, $tab ) = @_;
- my $tab_template = C4::Output::gettemplate( 'admin/preferences/' . $tab . '.pref', 'intranet', $input );
+ my $tab_template = C4::Templates::gettemplate( 'admin/preferences/' . $tab . '.pref', 'intranet', $input );
my $active_currency = GetCurrency();
my $local_currency;
sub _get_pref_files {
my ( $input, $open_files ) = @_;
- my ( $htdocs, $theme, $lang, undef ) = C4::Output::_get_template_file( 'admin/preferences/admin.pref', 'intranet', $input );
+ my ( $htdocs, $theme, $lang, undef ) = C4::Templates::_get_template_file( 'admin/preferences/admin.pref', 'intranet', $input );
my %results;
# build indicator hash.
my @ind_tag = $input->param('ind_tag');
my @indicator = $input->param('indicator');
- my @params = $input->param();
- my $record = TransformHtmlToMarc(\@params,$input);
+ my $record = TransformHtmlToMarc($input);
if (C4::Context->preference("marcflavour") eq "UNIMARC"){
unless ($record->field('100')){
use POSIX qw(strftime);
use C4::Items;
use C4::Branch;
use C4::Acquisition;
-use C4::Output; # contains gettemplate
+use C4::Output;
use C4::Auth;
use C4::Serials;
use C4::Dates qw/format_date/;
my @results;
## I. BUILD THE QUERY
-my $lang = C4::Output::getlanguagecookie($cgi);
+my $lang = C4::Templates::getlanguagecookie($cgi);
( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan,$lang);
## parse the query_cgi string and put it into a form suitable for <input>s
);
# getting html input
my @params = $input->param();
- $record = TransformHtmlToMarc( \@params , $input );
+ $record = TransformHtmlToMarc( $input );
# check for a duplicate
my ( $duplicatebiblionumber, $duplicatetitle );
if ( !$is_a_modif ) {
$biblionumber = "";
}
+ if ( $record eq -1 ) {
+ $record = TransformHtmlToMarc( $input );
+ }
+ else {
#FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding
- eval {
- my $uxml = $record->as_xml;
- MARC::Record::default_record_format("UNIMARC")
- if ( C4::Context->preference("marcflavour") eq "UNIMARC" );
- my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
- $record = $urecord;
- };
+ eval {
+ my $uxml = $record->as_xml;
+ MARC::Record::default_record_format("UNIMARC")
+ if ( C4::Context->preference("marcflavour") eq "UNIMARC" );
+ my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
+ $record = $urecord;
+ };
+ }
build_tabs( $template, $record, $dbh, $encoding,$input );
$template->param(
biblionumber => $biblionumber,
#------------------------
if ($merge) {
- my @params = $input->param();
my $dbh = C4::Context->dbh;
my $sth;
# Creating a new record from the html code
- my $record = TransformHtmlToMarc( \@params , $input );
+ my $record = TransformHtmlToMarc( $input );
my $tobiblio = $input->param('biblio1');
my $frombiblio = $input->param('biblio2');
use strict;
use warnings;
-use C4::Output qw(setlanguagecookie);
+use C4::Templates;
use CGI;
my $query = new CGI;
my $url = $query->referer();
#warn "Language : $query // $language // $url";
-setlanguagecookie( $query, $language, $url );
+C4::Templates::setlanguagecookie( $query, $language, $url );
authenticated page.
More information on the C<gettemplate> sub can be found in the
- Output.pm module.
+ Templates.pm module.
=cut
.linktools a:first-child { border-bottom: 1px solid #DDD; }
.linktools a:hover { background-color: #FFC; }
.subfield_controls { margin : 0 .5em; }
-.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; }
\ No newline at end of file
+.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../../img/locked.png) center left no-repeat; width:29em; }
+
+#cataloguing_additem_itemlist {
+ margin-bottom : 1em;
+}
+.yui-gf div.first {
+ width : 19%;
+}
+
+.yui-gf .yui-u {
+ width: 79.2%;
+}
\ No newline at end of file
vertical-align: middle;
padding-right: 0.3em;
}
-#cataloguing_additem_itemlist div {
- overflow : scroll;
-}
ul.budget_hierarchy {
margin-left: 0px;
padding-left: 0px;
[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]">Circulation History</a></li>[% END %]
[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=MEMBERS&modules=circulation&object=[% borrowernumber %]&src=circ">Modification Log</a></li>[% END %]
[% IF ( EnhancedMessagingPreferences ) %]
- [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrowernumber %]">Messaging</a></li>
[% END %]
[% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber %]">Notices</a></li>
</ul></div>
[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrower.borrowernumber %]">Circulation History</a></li>[% END %]
[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=MEMBERS&modules=circulation&object=[% borrower.borrowernumber %]&src=circ">Modification Log</a></li>[% END %]
[% IF ( EnhancedMessagingPreferences ) %]
- [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrower.borrowernumber %]">Messaging</a></li>
[% END %]
[% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrower.borrowernumber %]">Notices</a></li>
</ul></div>
[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]">Circulation History</a></li>[% END %]
[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=MEMBERS&action=MODIFY&object=[% borrowernumber %]">Modification Log</a></li>[% END %]
[% IF ( EnhancedMessagingPreferences ) %]
- [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrowernumber %]">Messaging</a></li>
[% END %]
[% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber %]">Notices</a></li>
</ul></div>
}
function Changefwk(FwkList) {
- var fwk = FwkList.options[FwkList.selectedIndex].value;
- window.location = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumberdata %]&op=[% op %]&breedingid=[% breedingid %]&mode=[% popup %]&frameworkcode="+fwk;
-
+ var f = document.f;
+ f.op.value = "";
+ f.submit();
}
// returns the subfieldcode based upon subfieldid writing
<li id="savebutton"><input id="addbiblio" type="submit" value="Save" /></li>
<li id="z3950searchc"><input type="button" id="z3950search" value="Z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
<li id="changeframework"><label for="Frameworks">Change framework: </label>
- <select name="Frameworks" id="Frameworks" onchange="Changefwk(this);">
+ <select name="frameworkcode" id="Frameworks" onchange="Changefwk(this);">
<option value="Default">Default</option>
[% FOREACH frameworkcodeloo IN frameworkcodeloop %]
[% IF ( frameworkcodeloo.selected ) %]
› <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
</div>
-<div id="doc3" class="yui-t2">
+<div id="doc3" class="yui-t7">
<div id="bd">
<div id="yui-main">
- <div class="yui-b">
-
<h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
</div>
[% END %]
</div>
-
+<div class="yui-gf">
+<div class="yui-u first">
+[% INCLUDE 'biblio-view-menu.inc' %]
+</div>
+<div class="yui-u">
<div id="cataloguing_additem_newitem">
<form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
<input type="hidden" name="op" value="[% op %]" />
[% END %]</fieldset>
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
- <input type="hidden" name="stickyduedate"" value="[% stickyduedate %]" />
+ <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
<input type="hidden" name="barcode" value="[% barcode %]" />
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
</form>
</div>
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'biblio-view-menu.inc' %]
+</div><!-- /yui-u -->
+</div><!-- /yui-gf -->
+
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% IF ( soundon ) %]
<audio src="/intranet-tmpl/prog/sound/ending.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
-[% END %]
-
+[% END %]
+
<div class="dialog message">
<h3>Hold Found (item is already waiting): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
[% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
[% IF ( diffbranch ) %]
<!-- diffbranch -->
+ [% IF ( soundon ) %]
+ <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
+ [% END %]
<div class="dialog message">
<h3>Hold needing transfer found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
<h4>Hold for: </h4>
[% IF ( transfer ) %]
<!-- transfer: item with no reservation, must be returned to its homebranch -->
<div class="dialog message">
- <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]</h3></div>[% END %]
+ <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]</h3>
+ </div>
+ [% IF ( soundon ) %]
+ <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
+ [% END %]
+ [% END %]
[% IF ( needstransfer ) %]
<!-- needstransfer -->
+ [% IF ( soundon ) %]
+ <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
+ [% END %]
<div class="dialog message"><h3> This item needs to be transferred to [% homebranchname %]</h3>
Transfer Now?<br />
<form method="post" action="returns.pl" name="mainform" id="mainform">
[% END %]
<input type="hidden" name="barcode" value="0" />
</form> </div>
- [% END %]
+ [% END %]
[% IF ( diffbranch ) %]
<!-- diffbranch -->
+ [% IF ( soundon ) %]
+ <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
+ [% END %]
<h3>Item Consigned:</h3>
<table>
<caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
<!-- case of simple return no issue or transfer but with a reservation -->
[% IF ( reserved ) %]
<!-- reserved -->
-
-[% IF ( soundon ) %]
-<audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
-[% END %]
-
+
+ [% IF ( soundon ) %]
+ <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
+ [% END %]
+
<div class="dialog message">
<h3>Hold Found: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber %]">[% title |html %]</a></h3>
[% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
+++ /dev/null
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Patrons › [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Patron Details for [% firstname %] [% surname %] ([% cardnumber %])[% END %]</title>
-[% INCLUDE 'doc-head-close.inc' %]
-</head>
-<body>
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'patron-search.inc' %]
-
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Patron Details for [% firstname %] [% surname %] ([% cardnumber %])[% END %] </div>
-
-<div id="doc3" class="yui-t2">
-
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
-[% INCLUDE 'members-toolbar.inc' %]
-[% IF ( error ) %]
-<div class="dialog alert">
-[% IF ( AUTH_UPDATE_FAILED ) %]
-<h3>Userid / Password update failed</h3>
-<strong>Insufficient privileges.</strong>
-<p>Other fields updated.</p>
-[% END %]
-[% IF ( CANT_DELETE_STAFF ) %]
-<h3>Unable to delete staff user</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-[% IF ( CANT_DELETE_OTHERLIBRARY ) %]
-<h3>Unable to delete patrons from other libraries with current settings</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-[% IF ( CANT_DELETE ) %]
-<h3>Unable to delete patron:</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-</div>
-[% END %]
-<div class="yui-g">
-[% IF ( unknowuser ) %]
- <div class="dialog message">
- This patron does not exist.
- </div>
-[% ELSE %]
-
-<table>
- <caption>Message Queue</caption>
- <tr><th>Type</th><th>Subject</th><th>Status</th><th>Time Prepared</th></tr>
-[% IF ( message_queue ) %]
- [% FOREACH message_queu IN message_queue %]
- <tr><td>[% message_queu.message_transport_type %]</td><td>[% message_queu.subject %]</td><td>[% message_queu.status %]</td><td>[% message_queu.time_queued %]</td></tr>
- [% END %]
-[% ELSE %]
- <tr><td colspan="4">There is no record of any messages that have been sent to this patron.</td></tr>
-[% END %]
-</table>
-
-</div>
-
-[% END %] <!-- unknowuser -->
-
-
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
-</div>
-</div>
-[% INCLUDE 'intranet-bottom.inc' %]
dateFormat: 'uk'
[% END %]
});
+
+ $(".message").hide();
+ $(".message-title").click(function(e){
+ $(this).next(".message").toggle();
+ e.preventDefault();
+ });
+
});
//]]>
</script>
-
+<style type="text/css">
+ p.message { display: none; }
+ a.message-title { font-weight: bold; display: block; }
+</style>
</head>
<body>
[% INCLUDE 'header.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Sent notices for [% firstname %] [% surname %]</div>
<div id="doc3" class="yui-t2">
-
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
[% INCLUDE 'circ-toolbar.inc' %]
<h1>Sent notices for [% firstname %] [% surname %]</h1>
+
<table id="noticestable">
<thead>
<tr>
- <th>Subject</th>
- <th>Content</th>
+ <th>Notice</th>
<th>Type</th>
<th>Status</th>
<th>Time</th>
</tr>
</thead>
+[% IF ( QUEUED_MESSAGES ) %]
<tbody>
[% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
<tr>
- <td>[% QUEUED_MESSAGE.subject %]</td>
- <td>[% QUEUED_MESSAGE.content %]</td>
- <td>[% QUEUED_MESSAGE.message_transport_type %]</td>
- <td>[% QUEUED_MESSAGE.status %]</td>
+ <td>
+ <a class="message-title" href="#">[% QUEUED_MESSAGE.subject %]</a>
+ <p class="message">
+ [% QUEUED_MESSAGE.content FILTER html_line_break %]
+ </p>
+ </td>
+ <td>
+ [% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email
+ [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'print' ) %]print
+ [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'feed' ) %]feed
+ [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'sms' ) %]sms
+ [% ELSE %][% QUEUED_MESSAGE.message_transport_type %][% END %]
+ </td>
+ <td>
+ [% IF ( QUEUED_MESSAGE.status == 'sent' ) %]sent
+ [% ELSIF ( QUEUED_MESSAGE.status == 'pending' ) %]pending
+ [% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]failed
+ [% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
+ [% ELSE %][% QUEUED_MESSAGE.status %][% END %]
+ </td>
<td>[% QUEUED_MESSAGE.time_queued %]</td>
</tr>
[% END %]
</tbody>
+ [% ELSE %]
+ <tr><td colspan="4">There is no record of any messages that have been sent to this patron.</td></tr>
+ [% END %]
</table>
</div>
[% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Asked</option>
[% ELSE %]<option value="ASKED">Asked</option>[% END %]
[% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
- [ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
+ [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
[% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
[% ELSE %]<option value="CHECKED">Checked</option>[% END %]
[% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
</xsl:when>
</xsl:choose>
+ <xsl:choose> <xsl:when test="count(key('item-by-status', 'available'))>0">
+ <xsl:choose><xsl:when test="count(key('item-by-status', 'reference'))>0">
+ <br/>
+ </xsl:when></xsl:choose>
+ </xsl:when> </xsl:choose>
+
<xsl:choose>
<xsl:when test="count(key('item-by-status', 'reference'))>0">
<span class="available">
+++ /dev/null
-#!/usr/bin/perl
-
-# Copyright 2008 LibLime
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-use strict;
-use warnings;
-
-use CGI;
-use C4::Context;
-use C4::Auth;
-use C4::Output;
-use C4::Members;
-use C4::Members::Messaging;
-use C4::Dates;
-use C4::Reserves;
-use C4::Circulation;
-use C4::Koha;
-use C4::Letters;
-use C4::Biblio;
-use C4::Reserves;
-use C4::Branch; # GetBranchName
-
-use Data::Dumper;
-
-use vars qw($debug);
-
-BEGIN {
- $debug = $ENV{DEBUG} || 0;
-}
-
-my $dbh = C4::Context->dbh;
-
-my $query = CGI->new();
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
- {
- template_name => 'members/messaging.tmpl',
- query => $query,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => { borrowers => 1 },
- debug => 1,
- }
-);
-my $borrowernumber = $query->param('borrowernumber');
-my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
-my $branch = C4::Context->userenv->{'branch'};
-
-$template->param( $borrower );
-
-$borrower = GetMemberDetails( $borrowernumber );
-
-
- if ( $borrower->{'category_type'} eq 'C') {
- my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
- my $cnt = scalar(@$catcodes);
- $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
- $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
- }
-
-my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
-$template->param( picture => 1 ) if $picture;
-
-# get some recent messages sent to this borrower for display:
-my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } );
-
-$template->param( messagingview => 1,
- message_queue => $message_queue,
- DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
- borrowernumber => $borrowernumber,
- branchname => GetBranchName($borrower->{'branchcode'}),
- dateformat => C4::Context->preference("dateformat"),
- categoryname => $borrower->{'description'},
- $borrower->{'categorycode'} => 1,
-);
-
-#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'}
-# ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'};
-
-$template->param( %{ $borrower } );
-$template->param(
- messagingview => 1,
- is_child => ($borrower->{'category_type'} eq 'C'),
- );
-
-output_html_with_http_headers $query, $cookie, $template->output;
$template->param(
QUEUED_MESSAGES => $queued_messages,
borrowernumber => $borrowernumber,
- sentnotices => 1
+ sentnotices => 1,
+ branchname => GetBranchName($borrower->{'branchcode'}),
+ categoryname => $borrower->{'description'},
);
output_html_with_http_headers $input, $cookie, $template->output;
eval { require "$FindBin::Bin/../kohalib.pl" };
}
-use CGI; # NOT a CGI script, this is just to keep C4::Output::gettemplate happy
+use CGI; # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
use C4::Context;
use C4::Dates;
use C4::Debug;
use C4::Letters;
-use C4::Output;
+use C4::Templates;
use File::Spec;
use Getopt::Long;
open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" );
-my $template = C4::Output::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
+my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
my $stylesheet_contents = '';
if ($stylesheet) {
}
use C4::Context;
-use C4::Output; # contains gettemplate
use C4::Biblio;
use C4::Auth;
my $outfile = $ARGV[0];
use strict;
use warnings;
-use C4::Output qw(setlanguagecookie);
+use C4::Templates;
use CGI;
my $query = new CGI;
my $url = $query->referer();
# warn "Language : $query // $language // $url";
-setlanguagecookie( $query, $language, $url );
+C4::Templates::setlanguagecookie( $query, $language, $url );
# display news
# use cookie setting for language, bug default to syspref if it's not set
-(my $theme) = themelanguage(C4::Context->config('opachtdocs'),'opac-main.tmpl','opac',$input);
-
-my $translations = getTranslatedLanguages('opac',$theme);
-my @languages = ();
-foreach my $trans (@$translations)
-{
- push(@languages, $trans->{rfc4646_subtag});
-}
-
-my $news_lang;
-if($input->cookie('KohaOpacLanguage')){
- $news_lang = $input->cookie('KohaOpacLanguage');
-}else{
- if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
- while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
- if( my @lang = grep { /^$1$/i } @languages ) {
- $news_lang = $lang[0];
- }
- }
- }
- if (not $news_lang) {
- my @languages = split ",", C4::Context->preference("opaclanguages");
- $news_lang = $languages[0];
- }
-}
-
-$news_lang = $news_lang ? $news_lang : 'en' ;
+my ($theme, $news_lang) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
my $all_koha_news = &GetNewsToDisplay($news_lang);
my $koha_news_count = scalar @$all_koha_news;
my @results;
## I. BUILD THE QUERY
-my $lang = C4::Output::getlanguagecookie($cgi);
+my $lang = C4::Templates::getlanguagecookie($cgi);
( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang);
sub _input_cgi_parse ($) {
use strict;
use warnings;
use C4::Auth;
-use C4::Output; # contains gettemplate
+use C4::Output;
use C4::Biblio; # GetMarcBiblio GetXmlBiblio
use CGI;
use C4::Koha; # GetItemTypes