From c34eb3c95032b9ae54c04a55a5935bdc9691804c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 27 Mar 2020 10:38:04 +0000 Subject: [PATCH] Bug 17268: (follow-up) Fix translatability This patch moves the error messages to translatable strings Also includes capitalization fixes and POD adjustment Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- Koha/AdvancedEditorMacro.pm | 2 +- Koha/AdvancedEditorMacros.pm | 6 ++- .../parameters/advancededitormacro.json | 2 +- .../prog/en/includes/cateditor-ui.inc | 49 ++++++++++++++++--- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Koha/AdvancedEditorMacro.pm b/Koha/AdvancedEditorMacro.pm index aeae1a805e..975f850fa9 100644 --- a/Koha/AdvancedEditorMacro.pm +++ b/Koha/AdvancedEditorMacro.pm @@ -24,7 +24,7 @@ use base qw(Koha::Object); =head1 NAME -Koha::AdvancedEditorMacro - Koha Advanced Editor Macro Object class +Koha::AdvancedEditorMacro - Koha Advanced editor macro object class =head1 API diff --git a/Koha/AdvancedEditorMacros.pm b/Koha/AdvancedEditorMacros.pm index 4246947e88..4fdf25ba9f 100644 --- a/Koha/AdvancedEditorMacros.pm +++ b/Koha/AdvancedEditorMacros.pm @@ -26,7 +26,7 @@ use base qw(Koha::Objects); =head1 NAME -Koha::AdvancedEditorMacros - Koha Advanced Editor Macro Object set class +Koha::AdvancedEditorMacros - Koha Advanced editor macro object set class =head1 API @@ -42,6 +42,10 @@ sub _type { return 'AdvancedEditorMacro'; } +=head3 object_class + +=cut + sub object_class { return 'Koha::AdvancedEditorMacro'; } diff --git a/api/v1/swagger/parameters/advancededitormacro.json b/api/v1/swagger/parameters/advancededitormacro.json index 482e0bc917..e4fd0debf3 100644 --- a/api/v1/swagger/parameters/advancededitormacro.json +++ b/api/v1/swagger/parameters/advancededitormacro.json @@ -2,7 +2,7 @@ "advancededitormacro_id_pp": { "name": "advancededitormacro_id", "in": "path", - "description": "Advanced Editor Macro internal identifier", + "description": "Advanced editor macro internal identifier", "required": true, "type": "integer" } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index 9b0c857988..08ad36a44e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -715,7 +715,15 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr showSavedMacros(); }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to delete macro:") + err.responseText, { className: 'humanError' } ); + var err_message; + if( err.status == "404" ){ + err_message = "Macro not found"; + } else if ( err.status == "403" ){ + err_message = _("You do not have permission to delete this macro"); + } else { + err_message = _("There was a problem, please check the logs"); + } + humanMsg.displayAlert( _("Failed to delete macro: " + err_message), { className: 'humanError' } ); }); } @@ -761,7 +769,15 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr macroEditor.activeMacroShared = result.shared; }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to load macros:") + err.responseText, { className: 'humanError' } ); + var err_message; + if( err.status == "404" ){ + err_message = "Macro not found"; + } else if ( err.status == "403" ){ + err_message = _("You do not have permission to access this macro"); + } else { + err_message = _("There was a problem, please check the logs"); + } + humanMsg.displayAlert( _("Failed to load macros: ") + err_message, { className: 'humanError' } ); }); } @@ -796,7 +812,13 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to create macro:") + err.responseText, { className: 'humanError' } ); + var err_message; + if( err.status == "403" ){ + err_message = _("You do not have permission to create this macro"); + } else { + err_message = _("There was a problem, please check the logs"); + } + humanMsg.displayAlert( _("Failed to create macro: ") + err_message, { className: 'humanError' } ); }); } ); } @@ -833,7 +855,8 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr }); }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to load macros:") + err.responseText, { className: 'humanError' } ); + var err_message = _("There was a problem, please check the logs"); + humanMsg.displayAlert( _("Failed to load macros: ") + err_message, { className: 'humanError' } ); }); var $new_li = $( '
  • ' + _("New macro...") + '
  • ' ); $new_li.click( function() { @@ -859,7 +882,13 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr loadMacro( result.name, result.macro_id ); }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to create macro:") + err.responseText, { className: 'humanError' } ); + var err_message; + if( err.status == "403" ){ + err_message = _("You do not have permission to access this macro"); + } else { + err_message = _("There was a problem, please check the logs"); + } + humanMsg.displayAlert( _("Failed to create macro: ") + err_message, { className: 'humanError' } ); }); } ); $('#macro-list').append($new_li); @@ -895,7 +924,15 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr showSavedMacros(); }) .fail(function(err) { - humanMsg.displayAlert( _("Failed to save macro:") + err.responseText, { className: 'humanError' } ); + var err_message; + if( err.status == "404" ){ + err_message = _("Macro not found"); + } else if ( err.status ="403" ){ + err_message = _("You do not have permission to access this macro"); + } else { + err_message = _("There was a problem, please check the logs"); + } + humanMsg.displayAlert( _("Failed to save macro: ") + err_message, { className: 'humanError' } ); }); } -- 2.39.5