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 |
- |
|
|