Bug 14589: Adjust authorities_merge_ajax and replace some indirect syntax
This patch does the following:
[1] Adjust authorities_merge_ajax just as in bug 14588.
[2] Replace some indirect syntax for fetch GGI::Cookie.
[3] Along the way replace some new CGI's. Note that I am not aiming to
replace them Koha wide. The "fetch class" variant is less readable.
NOTE: The changes to tools/upload-file.pl and upload-file-progress.pl
are moved to report 14321.
Test plan:
[1] Run the URL authorities/merge_ajax.pl in staff.
[2] Upload a file with Stage MARC records for import.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
[1] It runs, but also before patch
[2] File uploads without problem
No errors
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
We could certainly remove 1 or 2 call to CGI->new in tools/background-job-progress.pl
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
ce23235ec5
commit
298733cb1e
|
|
@ -30,7 +30,7 @@ my $input = new CGI;
|
|||
print $input->header('application/json');
|
||||
|
||||
# Check the user's permissions
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID');
|
||||
my ($auth_status, $auth_sessid) = C4::Auth::check_cookie_auth($sessid, {acquisition => 'order_manage'});
|
||||
if ($auth_status ne "ok") {
|
||||
|
|
|
|||
|
|
@ -4,23 +4,21 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use CGI qw ( -utf8 );
|
||||
use CGI::Session;
|
||||
use CGI::Cookie; # need to check cookies before CGI parses the POST request
|
||||
use JSON;
|
||||
|
||||
use C4::Context;
|
||||
use C4::Auth qw/check_cookie_auth/;
|
||||
use C4::AuthoritiesMarc;
|
||||
use JSON;
|
||||
use CGI::Cookie; # need to check cookies before
|
||||
# having CGI parse the POST request
|
||||
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
|
||||
my $reply = CGI->new;
|
||||
if ($auth_status ne "ok") {
|
||||
my $reply = CGI->new("");
|
||||
print $reply->header(-type => 'text/html');
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $reply = new CGI;
|
||||
my $framework = $reply->param('frameworkcode');
|
||||
my $tagslib = GetTagsLabels(1, $framework);
|
||||
print $reply->header(-type => 'text/html');
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ unless (C4::Context->preference('OPACpatronimages')) {
|
|||
}
|
||||
|
||||
my $needed_flags;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my $sessid = $cookies{'CGISESSID'}->value;
|
||||
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
|
||||
my $borrowernumber = C4::Context->userenv->{'number'};
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ exit;
|
|||
# a ratings specific ajax return sub, returns CGI object, and an 'auth_success' value
|
||||
sub ajax_auth_cgi {
|
||||
my $needed_flags = shift;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my $input = CGI->new;
|
||||
my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID');
|
||||
my ( $auth_status, $auth_sessid ) =
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ my @globalErrorIndexes = ();
|
|||
|
||||
sub ajax_auth_cgi { # returns CGI object
|
||||
my $needed_flags = shift;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my $input = CGI->new;
|
||||
my $sessid = $cookies{'CGISESSID'}->value;
|
||||
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ my $needed_flags = { tools => 'moderate_tags' }; # FIXME: replace when more spec
|
|||
|
||||
sub ajax_auth_cgi ($) { # returns CGI object
|
||||
my $needed_flags = shift;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my $input = CGI->new;
|
||||
my $sessid = $cookies{'CGISESSID'}->value;
|
||||
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ use C4::BackgroundJob;
|
|||
use CGI::Cookie; # need to check cookies before
|
||||
# having CGI parse the POST request
|
||||
|
||||
my $input = new CGI;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my $input = CGI->new;
|
||||
my %cookies = CGI::Cookie->fetch;
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
|
||||
if ($auth_status ne "ok") {
|
||||
my $reply = CGI->new("");
|
||||
|
|
@ -51,7 +51,7 @@ if (defined $job) {
|
|||
$job_status = $job->status();
|
||||
}
|
||||
|
||||
my $reply = CGI->new("");
|
||||
my $reply = CGI->new;
|
||||
print $reply->header(-type => 'text/html');
|
||||
# response will be sent back as JSON
|
||||
print '{"progress":"' . $reported_progress . '","job_size":"' . $job_size . '","job_status":"' . $job_status . '"}';
|
||||
|
|
|
|||
Loading…
Reference in New Issue