Koha/admin/ill_batch_statuses.pl
Pedro Amorim fc83fb3ebb
Bug 30719: (QA follow-up) Squash:
This is a squash of 25 QA patches located at:
    https://github.com/PTFS-Europe/koha/commits/new_30719

Bug 30719: (QA follow-up) Batch column should be hidden by default
Bug 30719: (QA follow-up) Fix wrong tt filter type
Bug 30719: (QA follow-up) Make atomicupdate idempotent
Bug 30719: (QA follow-up) Use COMMENT syntax in database files
Bug 30719: (QA follow-up) Fix tiny boolean is_system
Bug 30719: (QA follow-up) Add missing CONSTRAINT entries from kohastructure.sql to the atomicupdate file
Bug 30719: (QA follow-up) Add missing koha_object_class and
koha_objects_class methods
Bug 30719: (QA follow-up) Swap search to find
Bug 30719: (QA follow-up) Fix tests
Bug 30719: (QA follow-up) API terminology - id -> batch_id
Bug 30719: (QA follow-up) API terminology - borrowernumber -> patron_id
Bug 30719: (QA follow-up) API terminology - branchcode -> library_id
Bug 30719: (QA follow-up) Make mandatory illbatch_statuses translatable
Bug 30719: (QA follow-up) Improve translatability
Bug 30719: (QA follow-up) Fix capitalization of Interlibrary Loan
Bug 30719: (QA follow-up) Change Branch to Library in ILL batches table
Bug 30719: (QA follow-up) Add template WRAPPER to batch statuses breadrcrumbs
Bug 30719: (QA follow-up) Utilize patron_to_html function to display patron info in batches table
Bug 30719: (QA follow-up) Add mandatory batch statuses to the atomicupdate
Bug 30719: (QA follow-up) Add page-section to the batch statuses list page
Bug 30719: (QA follow-up) Style Save button on batch status edit page
Bug 30719: (QA follow-up) Add question mark to label string, rephrase new ILL batch button
Bug 30719: (QA follow-up) Add noExport class to action columns in batch list table and batch modal table
Bug 30719: (QA follow-up) Add page-section and headers to ILL batch table
Bug 30719: (QA follow-up) Perltidy

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:18 -03:00

98 lines
2.6 KiB
Perl
Executable file

#! /usr/bin/perl
# Copyright 2019 Koha Development Team
#
# 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 3 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, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use Try::Tiny qw( catch try );
use C4::Context;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha::IllbatchStatus;
use Koha::IllbatchStatuses;
my $input = CGI->new;
my $code = $input->param('code');
my $op = $input->param('op') || 'list';
my @messages;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "admin/ill_batch_statuses.tt",
query => $input,
type => "intranet",
flagsrequired => { parameters => 'ill' },
}
);
my $status;
if ($code) {
$status = Koha::IllbatchStatuses->find( { code => $code } );
}
if ( $op eq 'add_form' ) {
if ($status) {
$template->param( status => $status );
}
} elsif ( $op eq 'add_validate' ) {
my $name = $input->param('name');
my $code = $input->param('code');
if ( not defined $status ) {
$status = Koha::IllbatchStatus->new(
{
name => $name,
code => $code
}
);
}
try {
if ( $status->id ) {
$status->update_and_log( { name => $name } );
} else {
$status->create_and_log;
}
push @messages, { type => 'message', code => 'success_on_saving' };
} catch {
push @messages, { type => 'error', code => 'error_on_saving' };
};
$op = 'list';
} elsif ( $op eq 'delete' ) {
try {
$status->delete_and_log;
push @messages, { code => 'success_on_delete', type => 'message' };
} catch {
push @messages, { code => 'error_on_delete', type => 'alert' };
};
$op = 'list';
}
if ( $op eq 'list' ) {
my $statuses = Koha::IllbatchStatuses->search();
$template->param( statuses => $statuses );
}
$template->param(
messages => \@messages,
op => $op,
);
output_html_with_http_headers $input, $cookie, $template->output;