Merge remote-tracking branch 'kc/new/bug_6679' into kcmaster
authorChris Cormack <chrisc@catalyst.net.nz>
Fri, 23 Sep 2011 02:19:11 +0000 (14:19 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 23 Sep 2011 02:19:11 +0000 (14:19 +1200)
38 files changed:
C4/Auth.pm
C4/Biblio.pm
C4/Budgets.pm
C4/Output.pm
C4/SIP/ILS.pm
C4/Templates.pm
C4/XSLT.pm
about.pl
acqui/basket.pl
acqui/booksellers.pl
admin/preferences.pl
authorities/authorities.pl
catalogue/moredetail.pl
catalogue/search.pl
cataloguing/addbiblio.pl
cataloguing/merge.pl
changelanguage.pl
installer/InstallAuth.pm
koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt [deleted file]
koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
members/messaging.pl [deleted file]
members/notices.pl
misc/cronjobs/gather_print_notices.pl
misc/exportauth.pl
opac/opac-changelanguage.pl
opac/opac-main.pl
opac/opac-search.pl
tools/export.pl

index 495f04c..7211769 100644 (file)
@@ -26,7 +26,7 @@ use CGI::Session;
 
 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
@@ -136,7 +136,7 @@ EOQ
 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(
@@ -936,7 +936,7 @@ sub 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 =~ /\//)
index 96baaef..915139e 100644 (file)
@@ -1989,8 +1989,8 @@ sub _default_ind_to_space {
 
 =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' ,
@@ -2007,15 +2007,15 @@ sub _default_ind_to_space {
         '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
@@ -2035,8 +2035,8 @@ sub TransformHtmlToMarc {
     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)
@@ -2052,7 +2052,7 @@ sub TransformHtmlToMarc {
             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;
 
@@ -2062,27 +2062,27 @@ sub TransformHtmlToMarc {
                     # 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;
index 888b4fd..7c867e0 100644 (file)
@@ -304,7 +304,7 @@ sub GetBudgetSpent {
        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
index 98f2d7a..41a0a28 100644 (file)
@@ -29,7 +29,6 @@ use strict;
 #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;
@@ -43,193 +42,26 @@ BEGIN {
     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{
index 7dc29a7..432e4f1 100644 (file)
@@ -190,12 +190,16 @@ sub checkin {
        # 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;
index 4368492..37e8932 100644 (file)
@@ -31,16 +31,20 @@ use CGI;
 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');
@@ -49,7 +53,7 @@ sub new {
         $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,
@@ -164,7 +168,7 @@ sub _current_language {
     return $_current_language;
 }
 
-sub themelanguage {
+sub themelanguage_lite {
     my ( $htdocs, $tmpl, $interface ) = @_;
     my $query = new CGI;
 
@@ -228,5 +232,168 @@ sub param {
     }
 }
 
+
+=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;
 
index 4dafff3..8bc4000 100755 (executable)
@@ -29,7 +29,6 @@ use C4::Koha;
 use C4::Biblio;
 use C4::Circulation;
 use C4::Reserves;
-use C4::Output qw//;
 use Encode;
 use XML::LibXML;
 use XML::LibXSLT;
@@ -160,14 +159,14 @@ sub XSLTParse4Display {
         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";
index 2ad7393..ae2d0dc 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -28,7 +28,7 @@ use LWP::Simple;
 use XML::Simple;
 use Config;
 
-use C4::Output;    # contains gettemplate
+use C4::Output;
 use C4::Auth;
 use C4::Context;
 use C4::Installer;
index dfc9447..70fb39c 100755 (executable)
@@ -197,7 +197,7 @@ if ( $op eq 'delete_confirm' ) {
 #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}){
index cc5c084..fb6b2f1 100755 (executable)
@@ -106,7 +106,7 @@ for my $vendor (@suppliers) {
         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} ) {
index f4d1823..055f69d 100755 (executable)
@@ -28,6 +28,7 @@ use C4::Languages qw(getTranslatedLanguages);
 use C4::ClassSource;
 use C4::Log;
 use C4::Output;
+use C4::Templates;
 use C4::Budgets qw(GetCurrency);
 use File::Spec;
 use IO::File;
@@ -41,7 +42,7 @@ our $lang;
 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;
@@ -174,7 +175,7 @@ sub TransformPrefsToHTML {
 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;
 
index 44387d9..2f82f5a 100755 (executable)
@@ -581,8 +581,7 @@ if ($op eq "add") {
     # 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);
index d848188..d285a49 100755 (executable)
@@ -27,7 +27,7 @@ use C4::Biblio;
 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/;
index b9f9ed3..97fa3d7 100755 (executable)
@@ -471,7 +471,7 @@ my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit
 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
index 21601e9..ba10332 100755 (executable)
@@ -931,7 +931,7 @@ if ( $op eq "addbiblio" ) {
     );
     # 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 ) {
@@ -1037,14 +1037,19 @@ elsif ( $op eq "delete" ) {
         $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,
index cc2d01d..c97ca7a 100755 (executable)
@@ -48,12 +48,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 #------------------------
 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');
 
index f906c23..c4d68e3 100755 (executable)
@@ -18,7 +18,7 @@
 use strict;
 use warnings;
 
-use C4::Output qw(setlanguagecookie);
+use C4::Templates;
 use CGI;
 
 my $query    = new CGI;
@@ -26,4 +26,4 @@ my $language = $query->param('language');
 my $url      = $query->referer();
 
 #warn "Language : $query // $language // $url";
-setlanguagecookie( $query, $language, $url );
+C4::Templates::setlanguagecookie( $query, $language, $url );
index 3efc407..3918698 100644 (file)
@@ -103,7 +103,7 @@ InstallAuth - Authenticates Koha users for Install process
     authenticated page.
 
     More information on the C<gettemplate> sub can be found in the
-    Output.pm module.
+    Templates.pm module.
 
 =cut
 
index 26a8066..3cf2e88 100644 (file)
@@ -133,4 +133,15 @@ a.tagnum {
 .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
index 36cef19..8b2b8f5 100644 (file)
@@ -1896,9 +1896,6 @@ img.spinner {
     vertical-align: middle;
     padding-right: 0.3em;
 }
-#cataloguing_additem_itemlist div {
-       overflow : scroll;
-}
 ul.budget_hierarchy {
     margin-left: 0px;
     padding-left: 0px;
index 129bd66..cf5a675 100644 (file)
@@ -63,7 +63,6 @@
        [% 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&amp;modules=MEMBERS&amp;modules=circulation&amp;object=[% borrowernumber %]&amp;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>
index 39be1be..8d5e3b8 100644 (file)
@@ -65,7 +65,6 @@ in the global namespace %]
        [% 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&amp;modules=MEMBERS&amp;modules=circulation&amp;object=[% borrower.borrowernumber %]&amp;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>
index a7b77e2..cadd1cb 100644 (file)
@@ -8,7 +8,6 @@
        [% 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&amp;modules=MEMBERS&amp;action=MODIFY&amp;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>
index baa84c7..91d926e 100644 (file)
@@ -254,9 +254,9 @@ function GetZ3950Terms(){
 }
 
 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
@@ -776,7 +776,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
                        <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 ) %]
index 2bd5ab5..efdda6a 100644 (file)
@@ -178,12 +178,10 @@ function set_to_today(id, force) {
  &rsaquo; <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>
 
@@ -218,7 +216,11 @@ function set_to_today(id, force) {
         </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 %]" />
@@ -273,17 +275,16 @@ function set_to_today(id, force) {
     [% 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' %]
index 4224ab1..2a9b47e 100644 (file)
@@ -109,8 +109,8 @@ function Dopop(link) {
 
 [% 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 %]
@@ -150,6 +150,9 @@ function Dopop(link) {
 
     [% 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>
@@ -188,10 +191,18 @@ function Dopop(link) {
     [% 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&amp;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&amp;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">
@@ -208,10 +219,13 @@ function Dopop(link) {
        [% 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&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a></caption>
@@ -236,11 +250,11 @@ function Dopop(link) {
     <!-- 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 %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt
deleted file mode 100644 (file)
index 2980a53..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; [% 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> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; [% 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' %]
index 2bce08a..4a6753e 100644 (file)
                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> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; 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>
index 24baefe..9a9f332 100644 (file)
@@ -280,7 +280,7 @@ $(document).ready(function() { calcNewsuggTotal(); });
     [% 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>
index 3076af5..9c6c307 100644 (file)
                    </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">
diff --git a/members/messaging.pl b/members/messaging.pl
deleted file mode 100755 (executable)
index 8791dcf..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/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;
index 088d5a8..7955581 100755 (executable)
@@ -56,7 +56,9 @@ $template->param( %{$borrower} );
 $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;
 
index 03b65b4..a72d6a6 100755 (executable)
@@ -28,12 +28,12 @@ BEGIN {
     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;
 
@@ -70,7 +70,7 @@ exit unless( @messages );
 
 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) {
index 4ac916c..d6236d2 100755 (executable)
@@ -13,7 +13,6 @@ BEGIN {
 }
 
 use C4::Context;
-use C4::Output;  # contains gettemplate
 use C4::Biblio;
 use C4::Auth;
 my $outfile = $ARGV[0];
index 0cfbca4..1c3ee8e 100755 (executable)
@@ -17,7 +17,7 @@
 
 use strict;
 use warnings;
-use C4::Output qw(setlanguagecookie);
+use C4::Templates;
 use CGI;
 
 my $query    = new CGI;
@@ -25,4 +25,4 @@ my $language = $query->param('language');
 my $url      = $query->referer();
 
 # warn "Language : $query // $language // $url";
-setlanguagecookie( $query, $language, $url );
+C4::Templates::setlanguagecookie( $query, $language, $url );
index 177d812..ff71006 100755 (executable)
@@ -54,33 +54,7 @@ $template->param(
 
 # 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;
index dfe4d74..ff437da 100755 (executable)
@@ -373,7 +373,7 @@ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_
 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 ($) { 
index 4a09868..4b3e3f5 100755 (executable)
@@ -20,7 +20,7 @@
 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