View | Details | Raw Unified | Return to bug 23276
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/blocking_errors.inc (+15 lines)
Line 0 Link Here
1
<div class="main">
2
    <div class="container-fluid">
3
        <div class="row-fluid">
4
            [% IF blocking_error %]
5
                [% SWITCH blocking_error %]
6
                [% CASE "tags_disabled" %]Sorry, tags are not enabled on this system.
7
                [% CASE %][%# Do not display the blocking error at the OPAC if not handled previously %]
8
                [% END %]
9
10
                [% INCLUDE 'opac-bottom.inc' %]
11
                [% STOP %] [%# Will stop gracefully without processing any more of the template document.%]
12
            [% END %]
13
        </div>
14
    </div>
15
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (+1 lines)
Lines 374-376 Link Here
374
            </div>
374
            </div>
375
        </form> <!-- /#auth -->
375
        </form> <!-- /#auth -->
376
    </div>  <!-- /#modalAuth  -->
376
    </div>  <!-- /#modalAuth  -->
377
    [% INCLUDE 'blocking_errors.inc' %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt (-3 / +1 lines)
Lines 54-62 Link Here
54
                            [% FOREACH ERROR IN ERRORS %]
54
                            [% FOREACH ERROR IN ERRORS %]
55
                                <div class="alert">
55
                                <div class="alert">
56
                                    There was a problem with this operation:
56
                                    There was a problem with this operation:
57
                                    [% IF ( ERROR.tagsdisabled ) %]
57
                                    [% IF ( ERROR.badparam ) %]
58
                                        Sorry, tags are not enabled on this system.
59
                                    [% ELSIF ( ERROR.badparam ) %]
60
                                        ERROR: illegal parameter [% ERROR.badparam | html %]
58
                                        ERROR: illegal parameter [% ERROR.badparam | html %]
61
                                    [% ELSIF ( ERROR.login ) %]
59
                                    [% ELSIF ( ERROR.login ) %]
62
                                        ERROR: You must log in to complete that action.
60
                                        ERROR: You must log in to complete that action.
(-)a/opac/opac-tags.pl (-20 / +19 lines)
Lines 38-44 use CGI::Cookie; # need to check cookies before having CGI parse the POST reques Link Here
38
use C4::Auth qw(:DEFAULT check_cookie_auth);
38
use C4::Auth qw(:DEFAULT check_cookie_auth);
39
use C4::Context;
39
use C4::Context;
40
use C4::Debug;
40
use C4::Debug;
41
use C4::Output qw(:html :ajax pagination_bar);
41
use C4::Output qw(:html :ajax output_and_exit );
42
use C4::Scrubber;
42
use C4::Scrubber;
43
use C4::Biblio;
43
use C4::Biblio;
44
use C4::Items qw(GetItemsInfo GetHiddenItemnumbers);
44
use C4::Items qw(GetItemsInfo GetHiddenItemnumbers);
Lines 86-109 sub ajax_auth_cgi { # returns CGI object Link Here
86
my $is_ajax = is_ajax();
86
my $is_ajax = is_ajax();
87
my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1;
87
my $openadds = C4::Context->preference('TagsModeration') ? 0 : 1;
88
my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new();
88
my $query = ($is_ajax) ? &ajax_auth_cgi({}) : CGI->new();
89
unless (C4::Context->preference('TagsEnabled')) {
89
foreach ($query->param) {
90
	push @errors, {+ tagsdisabled=>1 };
90
    if (/^newtag(.*)/) {
91
    push @globalErrorIndexes, $#errors;
91
        warn "marches";
92
} else {
92
        my $biblionumber = $1;
93
	foreach ($query->param) {
93
        unless ($biblionumber =~ /^\d+$/) {
94
		if (/^newtag(.*)/) {
94
            $debug and warn "$_ references non numerical biblionumber '$biblionumber'";
95
			my $biblionumber = $1;
95
            push @errors, {+'badparam' => $_ };
96
			unless ($biblionumber =~ /^\d+$/) {
96
            push @globalErrorIndexes, $#errors;
97
				$debug and warn "$_ references non numerical biblionumber '$biblionumber'";
97
            next;
98
				push @errors, {+'badparam' => $_ };
98
        }
99
                push @globalErrorIndexes, $#errors;
99
        $newtags{$biblionumber} = $query->param($_);
100
				next;
100
    } elsif (/^del(\d+)$/) {
101
			}
101
        push @deltags, $1;
102
			$newtags{$biblionumber} = $query->param($_);
102
    }
103
		} elsif (/^del(\d+)$/) {
104
			push @deltags, $1;
105
		}
106
	}
107
}
103
}
108
104
109
my $add_op = (scalar(keys %newtags) + scalar(@deltags)) ? 1 : 0;
105
my $add_op = (scalar(keys %newtags) + scalar(@deltags)) ? 1 : 0;
Lines 121-126 if ($is_ajax) { Link Here
121
	});
117
	});
122
}
118
}
123
119
120
121
output_and_exit( $query, $cookie, $template, 'tags_disabled' )
122
    unless C4::Context->preference('TagsEnabled');
123
124
if ($add_op) {
124
if ($add_op) {
125
	unless ($loggedinuser) {
125
	unless ($loggedinuser) {
126
		push @errors, {+'login' => 1 };
126
		push @errors, {+'login' => 1 };
127
- 

Return to bug 23276