Skip to content

Commit

Permalink
Allow to set a list of default clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jresinas committed Feb 2, 2017
1 parent 39ed686 commit b8d71ba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions app/views/settings/_facturaplus_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@

</script>
</fieldset>
</div>
<div class="splitcontentright">

<fieldset>
<legend><%=l(:"facturaplus.label_statuses")%></legend>
<p>
Expand All @@ -144,6 +143,15 @@

</script>
</fieldset>
</div>
<div class="splitcontentright">
<fieldset>
<legend><%=l(:"facturaplus.label_default_content")%></legend>
<p>
<label><%=l(:"facturaplus.label_default_clients")%></label>
<%= text_area_tag 'settings[default_clients]', @settings['default_clients'], :rows => 15 %>
</p>
</fieldset>

<fieldset>
<legend><%=l(:"facturaplus.label_endpoints")%></legend>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ en:
label_sync_client_field: Synchronize
label_statuses: Statuses
label_billed_statuses: Billed statuses
label_default_content: Default content
label_default_clients: Default clients
label_endpoints: Endpoints
label_get_clients: Get clientes
label_set_order: Set order
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ es:
label_sync_client_field: Sincronización
label_statuses: Estados
label_billed_statuses: Estados de facturación
label_default_content: Contenido por defecto
label_default_clients: Clientes por defecto
label_endpoints: Endpoints
label_get_clients: Obtener clientes
label_set_order: Crear pedido cliente
Expand Down
4 changes: 2 additions & 2 deletions lib/facturaplus/custom_fields_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def sync_client_field
res = Facturaplus::Fp.get_clients(client_field_id)

if res[:result]
client_field.possible_values=res[:options]
render :text => {:type => 'success', :message => l(:'facturaplus.text_sync_success'), :data => res[:options]}.to_json and return if client_field.save
client_field.possible_values = (Setting.plugin_redmine_facturaplus['default_clients'].split("\r\n") + res[:options])
render :text => {:type => 'success', :message => l(:'facturaplus.text_sync_success'), :data => client_field.possible_values}.to_json and return if client_field.save
end
end
render :text => {:type => 'error', :message => l(:'facturaplus.text_sync_fail')}.to_json
Expand Down

0 comments on commit b8d71ba

Please sign in to comment.