Bug 33856: Make inventory problems translatable

We should make the inventory 'problem' column translatable.

Test plan (assuming KTD):
1- Update po
    misc/translator/translate update LANG
    (for example LANG="fr-FR")
2- translate the new strings
    vim misc/translator/po/LANG-messages-js.po
    edit for example "wrong place" or "missing"
3- install the language
    koha-translate --install LANG --dev kohadev
4- use it for the UI and confirm that the CSV generated has 'problem' column translated
    a- Using the test language (activate it with sysprefStaffInterfaceLanguages)
    b- Go to Cataloging > Inventory
    c- Fill some barcode and some filter (for example a filter on callnumber)
    d- Select "Export to CSV file"
    e- Submit
    f- Open the CSV file generated, check that the colomn problem is now translated according to what you have filled in step 2

Signed-off-by: Marion Durand <marion.durand@biblibre.com>

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3e68067e7e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 6388bb3bee)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
This commit is contained in:
Jonathan Druart 2023-06-07 10:49:05 +02:00 committed by Baptiste Wojtkowski
parent acbe2fc9af
commit 71984a49dc
No known key found for this signature in database
GPG Key ID: 47A8A13E10BC0D40
1 changed files with 9 additions and 8 deletions

View File

@ -35,6 +35,7 @@ use C4::Circulation qw( barcodedecode AddReturn );
use C4::Reports::Guided qw( );
use C4::Charset qw( NormalizeString );
use Koha::I18N qw(__);
use Koha::Biblios;
use Koha::DateUtils qw( dt_from_string );
use Koha::Database::Columns;
@ -393,7 +394,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
my ( $table, $column ) = split '\.', $key;
push @translated_keys, NormalizeString($columns->{$table}->{$column} // '');
}
push @translated_keys, 'Problem' if $uploadbarcodes;
push @translated_keys, __('Problem') if $uploadbarcodes;
$csv->combine(@translated_keys);
print $csv->string, "\n";
@ -407,17 +408,17 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
my $errstr = '';
foreach my $key ( keys %{$item->{problems}} ) {
if( $key eq 'wrongplace' ) {
$errstr .= "wrong place,";
$errstr .= __("wrong place") . ",";
} elsif( $key eq 'changestatus' ) {
$errstr .= "unselected notforloan status $item->{notforloan},";
$errstr .= __("unselected notforloan status") . " $item->{notforloan},";
} elsif( $key eq 'not_scanned' ) {
$errstr .= "missing,";
$errstr .= __("missing") . ",";
} elsif( $key eq 'no_barcode' ) {
$errstr .= "no barcode,";
$errstr .= __("no barcode") . ",";
} elsif( $key eq 'checkedout' ) {
$errstr .= "checked out,";
$errstr .= __("checked out") . ",";
} elsif( $key eq 'out_of_order' ) {
$errstr .= "shelved out of order,";
$errstr .= __("shelved out of order") . ",";
}
}
$errstr =~ s/,$//;
@ -430,7 +431,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
my @line;
if ($error->{'ERR_BARCODE'}) {
push @line, map { $_ eq 'barcode' ? $error->{'barcode'} : ''} @keys;
push @line, "barcode not found";
push @line, __("barcode not found");
$csv->combine(@line);
print $csv->string, "\n";
}