[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-04-09 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #24 from David Cook  ---
This is an interesting one...

I was going to say "It's too bad the KohaOpacLanguage cookie is httponly.
Otherwise, we could've used Javascript to read the cookie and then set
Accept-Language on the API call."

But that would come with its own complications...

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-04-09 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #23 from Katrin Fischer  ---
Can we please consider backport to 24.11?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-30 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #22 from Katrin Fischer  ---
Pushed for 25.05!

Well done everyone, thank you!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-30 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Katrin Fischer  changed:

   What|Removed |Added

 Version(s)||25.05.00
released in||
 Status|Passed QA   |Pushed to main

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-30 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #21 from Katrin Fischer  ---
I had asked for support from topic expert Tomas on this one. Thanks! :)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-28 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #20 from Tomás Cohen Arazi (tcohen)  ---
Created attachment 177269
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=177269&action=edit
Bug 38630: (QA follow-up) Fixing few calls of getTranslatedLanguages

The fourth parameter is now removed and was never used.
Also replacing the 'both' interface by passing no interface to make
it consistent with call in additional-contents.
Resolving warn for empty interface or theme on Languages.pm L128.

Test plan:
Run t/db_dependent/Languages.t

Signed-off-by: Marcel de Rooy 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-28 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #19 from Tomás Cohen Arazi (tcohen)  ---
Created attachment 177268
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=177268&action=edit
Bug 38630: (QA follow-up) Two typos

Prefered and chose.

Signed-off-by: Marcel de Rooy 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-28 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #18 from Tomás Cohen Arazi (tcohen)  ---
Created attachment 177267
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=177267&action=edit
Bug 38630: (QA follow-up) Add copyright, license and/or POD

Signed-off-by: Marcel de Rooy 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-28 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Tomás Cohen Arazi (tcohen)  changed:

   What|Removed |Added

 Attachment #176617|0   |1
is obsolete||
 Attachment #176618|0   |1
is obsolete||
 Attachment #176619|0   |1
is obsolete||
 Attachment #176620|0   |1
is obsolete||

--- Comment #17 from Tomás Cohen Arazi (tcohen)  ---
Created attachment 177266
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=177266&action=edit
Bug 38630: Make the REST API respect KohaOpacLanguage cookie

The REST API can return translated strings to the opac or staff
interface, so it should respect the KohaOpacLanguage cookie and return
translations in the same language than the interface.

Test plan:
1. Do not apply patch yet
2. Log in to koha staff interface
3. Use the browser's devtools to get the value of CGISESSID cookie
4. Make sure you have at least 2 languages installed ('en' + another
   one - I'll use 'fr-FR' as an example in this test plan)
5. Find an item and note its itemnumber and itemtype
6. Go translate this itemtype's description (admin » item types » edit
   item type » translate). Add a translation for 'en' and another one
   for your language.
7. Close your browser tab (do not logout) and restart Koha to flush the
   memory cache.
8. Execute the following commands (replace variables by the correct
   value):

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   If you do not have jq, it can be found in most distributions
   packages. Or you could inspect the JSON manually at the path
   /_strings/item_type_id/str

   Restart Koha again, and execute the same command but with your
   language set in KohaOpacLanguage cookie:

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=fr-FR; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   Depending on how Koha sort the languages (not sure how it's done),
   you should get either the 'en' one or the 'fr-FR' one, but the
   important thing is you should get the same translation, no matter
   what the value of KohaOpacLanguage is, which is the issue this patch
   is trying to fix.
9. Apply the patch and restart Koha
10. Repeat step 8. This time you should get the translation
corresponding to the language set in KohaOpacLanguage cookie

Side note:
* The need to restart Koha before each request is due to a bug (see bug
  38454). If already pushed when you're testing this one, you don't have
  to restart.

Signed-off-by: David Nind 

Signed-off-by: Marcel de Rooy 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-20 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #16 from Julian Maurice  ---
Thanks for the followup patches Marcel !

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=38904

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #14 from Marcel de Rooy  ---
Created attachment 176619
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176619&action=edit
Bug 38630: (QA follow-up) Two typos

Prefered and chose.

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #15 from Marcel de Rooy  ---
Created attachment 176620
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176620&action=edit
Bug 38630: (QA follow-up) Fixing few calls of getTranslatedLanguages

The fourth parameter is now removed and was never used.
Also replacing the 'both' interface by passing no interface to make
it consistent with call in additional-contents.
Resolving warn for empty interface or theme on Languages.pm L128.

Test plan:
Run t/db_dependent/Languages.t

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #13 from Marcel de Rooy  ---
Created attachment 176618
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176618&action=edit
Bug 38630: (QA follow-up) Add copyright, license and/or POD

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

 Attachment #176226|0   |1
is obsolete||

--- Comment #12 from Marcel de Rooy  ---
Created attachment 176617
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176617&action=edit
Bug 38630: Make the REST API respect KohaOpacLanguage cookie

The REST API can return translated strings to the opac or staff
interface, so it should respect the KohaOpacLanguage cookie and return
translations in the same language than the interface.

Test plan:
1. Do not apply patch yet
2. Log in to koha staff interface
3. Use the browser's devtools to get the value of CGISESSID cookie
4. Make sure you have at least 2 languages installed ('en' + another
   one - I'll use 'fr-FR' as an example in this test plan)
5. Find an item and note its itemnumber and itemtype
6. Go translate this itemtype's description (admin » item types » edit
   item type » translate). Add a translation for 'en' and another one
   for your language.
7. Close your browser tab (do not logout) and restart Koha to flush the
   memory cache.
8. Execute the following commands (replace variables by the correct
   value):

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   If you do not have jq, it can be found in most distributions
   packages. Or you could inspect the JSON manually at the path
   /_strings/item_type_id/str

   Restart Koha again, and execute the same command but with your
   language set in KohaOpacLanguage cookie:

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=fr-FR; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   Depending on how Koha sort the languages (not sure how it's done),
   you should get either the 'en' one or the 'fr-FR' one, but the
   important thing is you should get the same translation, no matter
   what the value of KohaOpacLanguage is, which is the issue this patch
   is trying to fix.
9. Apply the patch and restart Koha
10. Repeat step 8. This time you should get the translation
corresponding to the language set in KohaOpacLanguage cookie

Side note:
* The need to restart Koha before each request is due to a bug (see bug
  38454). If already pushed when you're testing this one, you don't have
  to restart.

Signed-off-by: David Nind 

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

   Patch complexity|--- |Small patch
 Status|BLOCKED |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

 Blocks||38903


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38903
[Bug 38903] getTranslatedLanguages is still called with wrong theme
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

 CC||f.demi...@tamil.fr,
   ||jonathan.dru...@gmail.com
  Component|Holidays|I18N/L10N

--- Comment #11 from Marcel de Rooy  ---
Changing Component. Holidays does not cover the load well :)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=29245

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #10 from Marcel de Rooy  ---
This reminds me of abandoned work on bug 29245 (from 2021) btw

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-10 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #9 from Marcel de Rooy  ---
Will continue on this report early next week. No need to change status.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-10 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #8 from Katrin Fischer  ---
(In reply to Marcel de Rooy from comment #7)
> The tidy stuff and a POD failure:
> 
>  WARN   C4/Languages.pm
>WARN   tidiness
> The file is less tidy than before (bad/messy lines before:
> 210, now: 212)
> 
>  FAIL   Koha/Language.pm
>FAIL   pod coverage
> POD is missing for get_requested_language
> POD is missing for set_requested_language
>WARN   tidiness
> The file is less tidy than before (bad/messy lines before:
> 0, now: 2)
> 
>  WARN   t/Languages.t
>WARN   tidiness
> The file is less tidy than before (bad/messy lines before:
> 10, now: 16)
> 
>  WARN   t/db_dependent/api/v1/items.t
>WARN   tidiness
> The file is less tidy than before (bad/messy lines before:
> 180, now: 184)

As we plan to tidy the whole codebase quite soon (January/February), I think
you can ignore the tidy warnings for now. POD should be checked of course.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-10 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #7 from Marcel de Rooy  ---
The tidy stuff and a POD failure:

 WARN   C4/Languages.pm
   WARN   tidiness
The file is less tidy than before (bad/messy lines before: 210,
now: 212)

 FAIL   Koha/Language.pm
   FAIL   pod coverage
POD is missing for get_requested_language
POD is missing for set_requested_language
   WARN   tidiness
The file is less tidy than before (bad/messy lines before: 0,
now: 2)

 WARN   t/Languages.t
   WARN   tidiness
The file is less tidy than before (bad/messy lines before: 10,
now: 16)

 WARN   t/db_dependent/api/v1/items.t
   WARN   tidiness
The file is less tidy than before (bad/messy lines before: 180,
now: 184)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-10 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Marcel de Rooy  changed:

   What|Removed |Added

 Status|Signed Off  |BLOCKED
 QA Contact|testo...@bugs.koha-communit |m.de.r...@rijksmuseum.nl
   |y.org   |
 CC||m.de.r...@rijksmuseum.nl

--- Comment #6 from Marcel de Rooy  ---
Looking here

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-08 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #5 from David Nind  ---
(In reply to Julian Maurice from comment #3)
> (In reply to David Nind from comment #2)

> Maybe you have SessionRestrictionByIP enabled and running the command from
> within KTD logged you out

I turned off SessionRestrictionByIP and StaffLoginLibraryBasedOnIP (both
enabled by default in KTD), and everything now works as per the test plan.

Thanks Julian!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-08 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

David Nind  changed:

   What|Removed |Added

 Attachment #175238|0   |1
is obsolete||

--- Comment #4 from David Nind  ---
Created attachment 176226
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176226&action=edit
Bug 38630: Make the REST API respect KohaOpacLanguage cookie

The REST API can return translated strings to the opac or staff
interface, so it should respect the KohaOpacLanguage cookie and return
translations in the same language than the interface.

Test plan:
1. Do not apply patch yet
2. Log in to koha staff interface
3. Use the browser's devtools to get the value of CGISESSID cookie
4. Make sure you have at least 2 languages installed ('en' + another
   one - I'll use 'fr-FR' as an example in this test plan)
5. Find an item and note its itemnumber and itemtype
6. Go translate this itemtype's description (admin » item types » edit
   item type » translate). Add a translation for 'en' and another one
   for your language.
7. Close your browser tab (do not logout) and restart Koha to flush the
   memory cache.
8. Execute the following commands (replace variables by the correct
   value):

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   If you do not have jq, it can be found in most distributions
   packages. Or you could inspect the JSON manually at the path
   /_strings/item_type_id/str

   Restart Koha again, and execute the same command but with your
   language set in KohaOpacLanguage cookie:

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=fr-FR; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   Depending on how Koha sort the languages (not sure how it's done),
   you should get either the 'en' one or the 'fr-FR' one, but the
   important thing is you should get the same translation, no matter
   what the value of KohaOpacLanguage is, which is the issue this patch
   is trying to fix.
9. Apply the patch and restart Koha
10. Repeat step 8. This time you should get the translation
corresponding to the language set in KohaOpacLanguage cookie

Side note:
* The need to restart Koha before each request is due to a bug (see bug
  38454). If already pushed when you're testing this one, you don't have
  to restart.

Signed-off-by: David Nind 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-08 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

David Nind  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #3 from Julian Maurice  ---
(In reply to David Nind from comment #2)
> I had a go at testing, but didn't have any luck with step 8.
> 
> 1. Are these commands issued from within the KTD shell, or your local
> machine? I tried both (with a restart after each command).
They should be run from the same machine that is running your browser (so
probably your local machine)

> 2. I get null as the result:
> 
> curl -sSL "127.0.0.1:8081/api/v1/items/578" \
> -H 'x-koha-embed: +strings' \
> -H "Cookie: KohaOpacLanguage=en; CGISESSID=f44da5bb4f1805fced9004f8dab49160"
> \
> | jq -r '._strings.item_type_id.str'
> null
Can you try to remove the '| jq ...' part to see the full JSON response ?

> 3. The session id keeps on changing. If I go to access the staff interface
> again, I get session time out, please log in again, and the session id is
> different (as expected ?).
Maybe you have SessionRestrictionByIP enabled and running the command from
within KTD logged you out

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2025-01-03 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

David Nind  changed:

   What|Removed |Added

 CC||da...@davidnind.com

--- Comment #2 from David Nind  ---
I had a go at testing, but didn't have any luck with step 8.

1. Are these commands issued from within the KTD shell, or your local machine?
I tried both (with a restart after each command).

2. I get null as the result:

curl -sSL "127.0.0.1:8081/api/v1/items/578" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=f44da5bb4f1805fced9004f8dab49160" \
| jq -r '._strings.item_type_id.str'
null

3. The session id keeps on changing. If I go to access the staff interface
again, I get session time out, please log in again, and the session id is
different (as expected ?).

Testing notes (using KTD):
1. Step 3: 
   - Chromium-based browsers: More tools > Developer tools > Application >
Storage > Cookies > [Select website] > CGISESSID
2. Step 4:
   - Install a translation: koha-translate --install fr-FR --dev kohadev
   - Koha administration > System preferences > I18/L10N > OPACLanguages and
StaffInterfaceLanguages [select languages to enable], opaclanguagedisplay -
allow
3. Step 8, from within KTD (also tried from local machine):
   - sudo apt-get install jq
   - first execution - result = null:
curl -sSL "127.0.0.1:8081/api/v1/items/578" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=f44da5bb4f1805fced9004f8dab49160" \
| jq -r '._strings.item_type_id.str'
null

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-09 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Jonathan Druart  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=38646

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

David Cook  changed:

   What|Removed |Added

 CC||dc...@prosentient.com.au

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Julian Maurice  changed:

   What|Removed |Added

 Status|ASSIGNED|Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Julian Maurice  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=38454

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

--- Comment #1 from Julian Maurice  ---
Created attachment 175238
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175238&action=edit
Bug 38630: Make the REST API respect KohaOpacLanguage cookie

The REST API can return translated strings to the opac or staff
interface, so it should respect the KohaOpacLanguage cookie and return
translations in the same language than the interface.

Test plan:
1. Do not apply patch yet
2. Log in to koha staff interface
3. Use the browser's devtools to get the value of CGISESSID cookie
4. Make sure you have at least 2 languages installed ('en' + another
   one - I'll use 'fr-FR' as an example in this test plan)
5. Find an item and note its itemnumber and itemtype
6. Go translate this itemtype's description (admin » item types » edit
   item type » translate). Add a translation for 'en' and another one
   for your language.
7. Close your browser tab (do not logout) and restart Koha to flush the
   memory cache.
8. Execute the following commands (replace variables by the correct
   value):

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=en; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   If you do not have jq, it can be found in most distributions
   packages. Or you could inspect the JSON manually at the path
   /_strings/item_type_id/str

   Restart Koha again, and execute the same command but with your
   language set in KohaOpacLanguage cookie:

curl -sSL "$KOHA_URL/api/v1/items/$ITEMNUMBER" \
-H 'x-koha-embed: +strings' \
-H "Cookie: KohaOpacLanguage=fr-FR; CGISESSID=$CGISESSID" \
| jq -r '._strings.item_type_id.str'

   Depending on how Koha sort the languages (not sure how it's done),
   you should get either the 'en' one or the 'fr-FR' one, but the
   important thing is you should get the same translation, no matter
   what the value of KohaOpacLanguage is, which is the issue this patch
   is trying to fix.
9. Apply the patch and restart Koha
10. Repeat step 8. This time you should get the translation
corresponding to the language set in KohaOpacLanguage cookie

Side note:
* The need to restart Koha before each request is due to a bug (see bug
  38454). If already pushed when you're testing this one, you don't have
  to restart.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 38630] Make the REST API respect KohaOpacLanguage cookie

2024-12-05 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630

Julian Maurice  changed:

   What|Removed |Added

   Assignee|koha-b...@lists.koha-commun |julian.maur...@biblibre.com
   |ity.org |
 Status|NEW |ASSIGNED

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/