Bugzilla – Attachment 72895 Details for
Bug 12020
Allow translating label-edit-batch hardcoded strings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12020: Allow translating label-edit-batch hardcoded strings
Bug-12020-Allow-translating-label-edit-batch-hardc.patch (text/plain), 5.42 KB, created by
Mark Tompsett
on 2018-03-14 17:44:07 UTC
(
hide
)
Description:
Bug 12020: Allow translating label-edit-batch hardcoded strings
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-03-14 17:44:07 UTC
Size:
5.42 KB
patch
obsolete
>From 4eb16f958369377f79c6e0cfeb5e0882d71e52ca Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@joensuu.fi> >Date: Mon, 12 Mar 2018 13:20:06 +0200 >Subject: [PATCH] Bug 12020: Allow translating label-edit-batch hardcoded > strings > >Move the hardcoded error strings in the batch label edit into the template, >so they can be translated. > >Test plan: >1) Apply patch >2) Go to Home -> Tools -> Label edit >3) Create a new batch with some items in it >4) Try to trigger any of the errors, check that the error > messages look correct >5) Update a language xx-YY >5) Check that the error messages show up in xx-YY-staff-prog.po > >Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi> > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > .../prog/en/modules/labels/label-edit-batch.tt | 18 +++++++++++++++++- > labels/label-edit-batch.pl | 14 +++++++------- > 2 files changed, 24 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >index 417024a..9799992 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >@@ -191,8 +191,24 @@ > <div class="yui-b"> > [% INCLUDE 'labels-toolbar.inc' %] > [% IF ( err ) %] >+ [% BLOCK xlate_errtype %] >+ [% SWITCH errtype %] >+ [% CASE 'ITEM_NOT_REMOVED' %] >+ <span>Item(s) not removed from batch [% batch_id %].</span> >+ [% CASE 'BATCH_NOT_DELETED' %] >+ <span>Batch [% batch_id %] was not deleted.</span> >+ [% CASE 'ITEM_NOT_ADDED' %] >+ <span>Item(s) not added to batch [% batch_id %].</span> >+ [% CASE 'BRANCH_NOT_SET' %] >+ <span>Branch is not set, please set your branch before adding items to a batch.</span> >+ [% CASE 'BATCH_NOT_DEDUP' %] >+ <span>Batch [% batch_id %] not fully de-duplicated.</span> >+ [% CASE %] >+ <span>Unknown error type [% errtype %].</span> >+ [% END %] >+ [% END %] > <div class="dialog alert"> >- <strong>WARNING:</strong> An error was encountered and [% errstr %] Please have your system administrator check the error log for details. >+ <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details. > </div> > [% ELSIF ( duplicate_message ) %] > <div class="dialog message"> >diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl >index 664c0b5..6875359 100755 >--- a/labels/label-edit-batch.pl >+++ b/labels/label-edit-batch.pl >@@ -42,7 +42,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > ); > > my $err = 0; >-my $errstr = undef; >+my $errtype = undef; > my $duplicate_count = undef; > my $duplicate_message = undef; > my $db_rows = {}; >@@ -72,14 +72,14 @@ if ($op eq 'remove') { > foreach my $label_id (@label_ids) { > $err = $batch->remove_item($label_id); > } >- $errstr = "item(s) not removed from batch $batch_id." if $err; >+ $errtype = 'ITEM_NOT_REMOVED' if $err; > # Something like this would be nice to avoid problems with the browser's 'refresh' button, but it needs an error handling mechanism... > # print $cgi->redirect("label-edit-batch.pl?op=edit&batch_id=$batch_id"); > # exit; > } > elsif ($op eq 'delete') { > $err = C4::Labels::Batch::delete(batch_id => $batch_id, branch_code => $branch_code); >- $errstr = "batch $batch_id was not deleted." if $err; >+ $errtype = 'BATCH_NOT_DELETED' if $err; > } > elsif ($op eq 'add') { > if ($number_list) { >@@ -103,11 +103,11 @@ elsif ($op eq 'add') { > $err = $batch->add_item($item_number); > } > $batch_id = $batch->get_attr('batch_id') if $batch_id == 0; #update batch_id if we added to a new batch >- $errstr = "item(s) not added to batch $batch_id." if $err; >+ $errtype = 'ITEM_NOT_ADDED' if $err; > } > else { > $err = 1; >- $errstr = "items(s) not added, the error was: Branch is not set, you please set your branch before adding items to a batch"; >+ $errtype = 'BRANCH_NOT_SET'; > } > } > elsif ($op eq 'new') { >@@ -118,7 +118,7 @@ elsif ($op eq 'de_duplicate') { > $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); > $duplicate_count = $batch->remove_duplicates(); > $duplicate_message = 1 if $duplicate_count != -1; >- $errstr = "batch $batch_id not fully de-duplicated." if $duplicate_count == -1; >+ $errtype = 'BATCH_NOT_DEDUP' if $duplicate_count == -1; > } > else { # edit > $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); >@@ -131,7 +131,7 @@ my $table = html_table($display_columns, $db_rows); > > $template->param( > err => $err, >- errstr => $errstr, >+ errtype => $errtype, > ) if ($err ne 0); > > $template->param( >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12020
:
72730
|
72895
|
73111