From 444d4a615be41cf244f3968b551059a8a2121e24 Mon Sep 17 00:00:00 2001 From: jresinas Date: Tue, 4 Sep 2018 11:05:12 +0200 Subject: [PATCH] Add development mode option to avoid FacturaPlus integration --- app/views/settings/_facturaplus_settings.html.erb | 9 +++++++-- config/locales/en.yml | 7 +++++-- config/locales/es.yml | 5 ++++- lib/facturaplus/fp.rb | 6 +++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/views/settings/_facturaplus_settings.html.erb b/app/views/settings/_facturaplus_settings.html.erb index 13fc4a0..d2a7f87 100644 --- a/app/views/settings/_facturaplus_settings.html.erb +++ b/app/views/settings/_facturaplus_settings.html.erb @@ -229,11 +229,16 @@

- - <%=l(:"facturaplus.label_emails")%> +
+ <%=l(:"facturaplus.label_others")%>

<%= text_field_tag 'settings[emails]', @settings['emails'] %>

+
+

+ + <%= check_box_tag 'settings[devel_mode]', 1, @settings['devel_mode'] %> +

\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 240597a..b4304c8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,13 +24,16 @@ en: label_default_content: Default content label_default_clients: Default clients label_endpoints: Endpoints - label_get_clients: Get clientes + label_protocol: Protocol + label_domain: Domain + label_get_clients: Get clients label_set_order: Set order delete_order: Delete order label_set_delivery_note: Set delivery note delete_delivery_note: Delete delivery note - label_emails: Emails + label_others: Others label_email_list: Email list + label_devel_mode: Development mode email_subject: Error while synchronize with FacturaPlus email_subject: Bill changes diff --git a/config/locales/es.yml b/config/locales/es.yml index 8f568bf..a0d5a96 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -24,13 +24,16 @@ es: label_default_content: Contenido por defecto label_default_clients: Clientes por defecto label_endpoints: Endpoints + label_protocol: Protocolo + label_domain: Dominio label_get_clients: Obtener clientes label_set_order: Crear pedido cliente delete_order: Eliminar pedido de cliente label_set_delivery_note: Crear albarán de cliente delete_delivery_note: Eliminar albarán de cliente - label_emails: Emails + label_others: Otros label_email_list: Lista de emails + label_devel_mode: Modo de desarrollo email_subject: Error durante la sincronización con FacturaPlus email_subject: Cambios en facturas diff --git a/lib/facturaplus/fp.rb b/lib/facturaplus/fp.rb index add498f..f51f795 100644 --- a/lib/facturaplus/fp.rb +++ b/lib/facturaplus/fp.rb @@ -243,7 +243,11 @@ def self.get_endpoint(action) def self.facturaplus_request(url, parameters, method) begin - if url.present? + if Setting.plugin_redmine_facturaplus['devel_mode'].present? + code = 200 + result = true + body = {} + elsif url.present? uri = URI.parse(url) case method