From 3c4eae4a4d983b82633fe312730e6be49b9d4c7c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 20 Aug 2020 15:53:28 +0000 Subject: [PATCH] Bug 25317: Move translatable strings out of additem.js.inc This patch moves the definition of translatable strings out of additem.js.inc and into additem.js using the new JS i81n function. additem.js.inc is removed, being obsolete. To test: When creating an order: - Go to Administration -> System preferences and set "AcqCreateItem" to "when placing an order." - Apply the patch and go to Acquisitions -> Vendor -> Add to basket -> From a new (empty) record. - In the "Item" section, confirm that the buttons at the bottom of the form are correct: "Add item," "Clear," and "Add multiple items." - Click "Add multiple items." The placeholder in the revealed form field should read "Number of items to add." The corresponding button should be labeled "Add." - You should see a note, "NOTE: Fields listed in the 'UniqueItemsFields' system preference will not be copied." - Fill out the item entry form and add a number to the "multiple items" field. Click "Add." - A table of items should be displayed with "Edit" and "Delete" buttons for each new item. - Click one of the "Edit" buttons. The item form should be populated with the item's data, with an "Update item" button at the bottom. When receiving an order: - Go to Administration -> System preferences and set "AcqCreateItem" to "when receiving an order." - Go to Acquisitions -> Vendor -> Receive shipments. - Select or create an invoice. - Click "Receive" on an order which has a quantity greater than 1. - Add two items, duplicating in each at least one value which is marked as unique by the "UniqueItemFields" system preference (e.g. fill in the same barcode number for each item). - Click "Save." You should get an alert about duplicated values, and there should be an alert message on the page, "barcode 'XXX' is duplicated." - Edit one of the two items and change the barcode to one which already exists in your database. - Click "Save." An alert message should be shown on the page, "barcode 'XXX' already exists in the database." - Note: I was unable to find out how to trigger this error, "You can't receive any more items." It may be obsolete. TESTING TRANSLATABILITY - Update a translation, e.g. fr-FR: > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for JavaScript strings, e.g. misc/translator/po/fr-FR-messages-js.po - Locate strings pulled from koha-tmpl/intranet-tmpl/prog/js/additem.js for translation, e.g.: msgid "Add multiple items" msgstr "" - Edit the "msgstr" string however you want (it's just for testing). - Install the updated translation: > perl translate install fr-FR - Switch to your newly translated language in the staff client and repeat the test plan above. The translated strings should appear. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 9d056d0364cfdc96e5c8fc6a84f933db970ffbd0) Signed-off-by: Lucas Gass --- .../prog/en/includes/additem.js.inc | 16 ---------- .../prog/en/modules/acqui/neworderempty.tt | 1 - .../prog/en/modules/acqui/orderreceive.tt | 1 - koha-tmpl/intranet-tmpl/prog/js/additem.js | 29 +++++++++---------- 4 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc deleted file mode 100644 index 12f5be7a1a..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 1aa9241296..7a7df3e265 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -504,7 +504,6 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") | $raw %] [% Asset.js("js/acq.js") | $raw %] - [% INCLUDE 'additem.js.inc' %] [% Asset.js("js/additem.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] [% INCLUDE 'calendar.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index c9161e48a9..fb228f65d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -371,7 +371,6 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") | $raw %] [% INCLUDE 'calendar.inc' %] - [% INCLUDE 'additem.js.inc' %] [% Asset.js("js/additem.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %]