dorsale 3.8.1 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +5 -1
  4. data/app/commands/dorsale/flyboy/task_commands.rb +1 -1
  5. data/app/controllers/concerns/dorsale/flyboy/tasks_summary_concern.rb +0 -1
  6. data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -2
  7. data/app/controllers/dorsale/application_controller.rb +0 -1
  8. data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -2
  9. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +9 -22
  10. data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -1
  11. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -4
  12. data/app/controllers/dorsale/comments_controller.rb +3 -2
  13. data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +0 -1
  14. data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -1
  15. data/app/controllers/dorsale/customer_vault/links_controller.rb +22 -12
  16. data/app/controllers/dorsale/customer_vault/origins_controller.rb +0 -1
  17. data/app/controllers/dorsale/customer_vault/people_controller.rb +2 -3
  18. data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -1
  19. data/app/controllers/dorsale/expense_gun/expenses_controller.rb +0 -1
  20. data/app/controllers/dorsale/flyboy/task_comments_controller.rb +0 -1
  21. data/app/controllers/dorsale/flyboy/tasks_controller.rb +28 -21
  22. data/app/controllers/dorsale/users_controller.rb +0 -1
  23. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +9 -5
  24. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +2 -2
  25. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
  26. data/app/helpers/dorsale/billing_machine/application_helper.rb +6 -6
  27. data/app/helpers/dorsale/context_helper.rb +1 -1
  28. data/app/helpers/dorsale/flyboy/application_helper.rb +4 -5
  29. data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +0 -1
  30. data/app/mailers/dorsale/flyboy/task_mailer.rb +0 -1
  31. data/app/mailers/dorsale/user_mailer.rb +0 -1
  32. data/app/models/dorsale/address.rb +2 -2
  33. data/app/models/dorsale/alexandrie/attachment_type.rb +0 -1
  34. data/app/models/dorsale/billing_machine.rb +1 -2
  35. data/app/models/dorsale/billing_machine/invoice.rb +19 -30
  36. data/app/models/dorsale/billing_machine/invoice_line.rb +2 -2
  37. data/app/models/dorsale/billing_machine/quotation.rb +11 -17
  38. data/app/models/dorsale/billing_machine/quotation_line.rb +2 -3
  39. data/app/models/dorsale/comment.rb +1 -1
  40. data/app/models/dorsale/customer_vault/corporation.rb +11 -10
  41. data/app/models/dorsale/customer_vault/event.rb +2 -2
  42. data/app/models/dorsale/customer_vault/individual.rb +4 -2
  43. data/app/models/dorsale/customer_vault/person.rb +14 -4
  44. data/app/models/dorsale/customer_vault/person_data.rb +1 -2
  45. data/app/models/dorsale/expense_gun/expense.rb +2 -5
  46. data/app/models/dorsale/expense_gun/expense_line.rb +2 -2
  47. data/app/models/dorsale/flyboy/task.rb +17 -18
  48. data/app/models/dorsale/flyboy/task_comment.rb +1 -1
  49. data/app/models/dorsale/users/active.rb +1 -1
  50. data/app/models/dorsale/users/avatar.rb +2 -1
  51. data/app/models/dorsale/users/password_generation.rb +0 -1
  52. data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +1 -1
  53. data/app/pdfs/dorsale/application_pdf.rb +7 -0
  54. data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +52 -47
  55. data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +94 -205
  56. data/app/pdfs/dorsale/prawn_helpers.rb +107 -0
  57. data/app/policies/dorsale/application_policy.rb +2 -4
  58. data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +0 -1
  59. data/app/policies/dorsale/flyboy/task_policy_helper.rb +3 -3
  60. data/app/policies/dorsale/policy_checker.rb +11 -18
  61. data/app/services/dorsale/billing_machine/invoice/copy.rb +2 -2
  62. data/app/services/dorsale/billing_machine/pdf_file_generator.rb +7 -2
  63. data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
  64. data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +10 -7
  65. data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
  66. data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -2
  67. data/app/views/dorsale/billing_machine/invoices/_form.html.slim +4 -11
  68. data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +1 -1
  69. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +1 -1
  70. data/config/locales/alexandrie.en.yml +0 -4
  71. data/config/locales/alexandrie.fr.yml +0 -4
  72. data/config/locales/billing_machine.en.yml +0 -41
  73. data/config/locales/billing_machine.fr.yml +0 -41
  74. data/config/routes.rb +0 -1
  75. data/db/migrate/20161119064536_delete_id_cards.rb +9 -0
  76. data/features/billing_machine_invoices.feature +0 -1
  77. data/features/billing_machine_multiple_vat.feature +0 -1
  78. data/features/billing_machine_quotations.feature +0 -1
  79. data/features/step_definitions/billing_machine_invoices_steps.rb +73 -79
  80. data/features/step_definitions/billing_machine_multiple_vat.rb +5 -6
  81. data/features/step_definitions/billing_machine_payment_terms_steps.rb +2 -2
  82. data/features/step_definitions/billing_machine_quotations_steps.rb +45 -80
  83. data/features/step_definitions/common_steps.rb +0 -4
  84. data/features/step_definitions/customer_vault_activity_types_steps.rb +1 -1
  85. data/features/step_definitions/customer_vault_corporations_steps.rb +27 -23
  86. data/features/step_definitions/customer_vault_individuals_steps.rb +8 -9
  87. data/features/step_definitions/customer_vault_invoices_steps.rb +1 -1
  88. data/features/step_definitions/customer_vault_links_steps.rb +6 -6
  89. data/features/step_definitions/customer_vault_origins_steps.rb +1 -1
  90. data/features/step_definitions/customer_vault_people_steps.rb +2 -1
  91. data/features/step_definitions/expense_gun_categories_steps.rb +2 -2
  92. data/features/step_definitions/expense_gun_expenses_steps.rb +6 -6
  93. data/features/step_definitions/flyboy_tasks_steps.rb +4 -7
  94. data/features/step_definitions/tasks_summary_steps.rb +3 -3
  95. data/features/support/env.rb +3 -2
  96. data/lib/dorsale/engine.rb +8 -8
  97. data/lib/dorsale/file_loader.rb +1 -1
  98. data/lib/dorsale/simple_form.rb +3 -3
  99. data/lib/dorsale/simple_form_bootstrap.rb +46 -46
  100. data/lib/dorsale/version.rb +1 -1
  101. data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +3 -3
  102. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -1
  103. data/spec/controllers/dorsale/comments_controller_spec.rb +1 -1
  104. data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +9 -9
  105. data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +15 -19
  106. data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -2
  107. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +43 -19
  108. data/spec/factories/alexandrie_attachment_types.rb +1 -1
  109. data/spec/factories/alexandrie_attachments.rb +1 -1
  110. data/spec/factories/billing_machine_invoice_lines.rb +1 -1
  111. data/spec/factories/billing_machine_invoices.rb +1 -2
  112. data/spec/factories/billing_machine_payment_terms.rb +1 -1
  113. data/spec/factories/billing_machine_quotation_lines.rb +1 -2
  114. data/spec/factories/billing_machine_quotations.rb +1 -2
  115. data/spec/factories/customer_vault_activity_types.rb +1 -1
  116. data/spec/factories/customer_vault_corporations.rb +1 -1
  117. data/spec/factories/customer_vault_event.rb +1 -1
  118. data/spec/factories/customer_vault_individuals.rb +2 -2
  119. data/spec/factories/customer_vault_links.rb +1 -1
  120. data/spec/factories/customer_vault_origins.rb +1 -1
  121. data/spec/factories/dorsale_addresses.rb +1 -1
  122. data/spec/factories/dorsale_comments.rb +1 -1
  123. data/spec/factories/expense_gun_categories.rb +2 -2
  124. data/spec/factories/expense_gun_expense_lines.rb +8 -8
  125. data/spec/factories/expense_gun_expenses.rb +2 -3
  126. data/spec/factories/flyboy_task_comments.rb +1 -1
  127. data/spec/factories/flyboy_tasks.rb +1 -1
  128. data/spec/mailers/user_mailer.rb +5 -6
  129. data/spec/models/dorsale/address_spec.rb +26 -26
  130. data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +6 -6
  131. data/spec/models/dorsale/billing_machine/invoice_spec.rb +37 -23
  132. data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +9 -10
  133. data/spec/models/dorsale/billing_machine/quotation_spec.rb +26 -28
  134. data/spec/models/dorsale/billing_machine_spec.rb +0 -1
  135. data/spec/models/dorsale/comment_spec.rb +0 -1
  136. data/spec/models/dorsale/customer_vault/corporation_spec.rb +20 -20
  137. data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
  138. data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -2
  139. data/spec/models/dorsale/customer_vault/link_spec.rb +0 -1
  140. data/spec/models/dorsale/customer_vault/person_spec.rb +7 -6
  141. data/spec/models/dorsale/expense_gun/category_spec.rb +2 -2
  142. data/spec/models/dorsale/expense_gun/expense_line_spec.rb +14 -14
  143. data/spec/models/dorsale/expense_gun/expense_spec.rb +23 -13
  144. data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -6
  145. data/spec/models/dorsale/flyboy/task_spec.rb +66 -42
  146. data/spec/models/dorsale/users_spec.rb +3 -5
  147. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +6 -11
  148. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +7 -11
  149. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +6 -11
  150. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +7 -14
  151. data/spec/rails_helper.rb +1 -1
  152. data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -1
  153. data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -1
  154. data/spec/routing/dorsale/comments_routing_spec.rb +0 -2
  155. data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -1
  156. data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -1
  157. data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -1
  158. data/spec/routing/dorsale/users_routing_spec.rb +1 -1
  159. data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +2 -2
  160. data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +13 -17
  161. data/spec/services/dorsale/flyboy/task/copy_spec.rb +1 -2
  162. data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +3 -3
  163. data/spec/spec_helper.rb +1 -0
  164. metadata +5 -43
  165. data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -106
  166. data/app/models/dorsale/billing_machine/id_card.rb +0 -14
  167. data/app/policies/dorsale/billing_machine/id_card_policy_helper.rb +0 -7
  168. data/app/views/dorsale/billing_machine/id_cards/_form.html.slim +0 -42
  169. data/app/views/dorsale/billing_machine/id_cards/_index_actions.html.slim +0 -2
  170. data/app/views/dorsale/billing_machine/id_cards/_list.html.slim +0 -27
  171. data/app/views/dorsale/billing_machine/id_cards/edit.html.slim +0 -1
  172. data/app/views/dorsale/billing_machine/id_cards/index.html.slim +0 -11
  173. data/app/views/dorsale/billing_machine/id_cards/new.html.slim +0 -1
  174. data/features/billing_machine_id_cards.feature +0 -19
  175. data/features/step_definitions/billing_machine_id_cards_steps.rb +0 -53
  176. data/features/support/ajax.rb +0 -20
  177. data/features/support/database_cleaner.rb +0 -12
  178. data/features/support/factory_girl.rb +0 -1
  179. data/features/support/fix_referrer.rb +0 -9
  180. data/features/support/message_delivery.rb +0 -1
  181. data/features/support/poltergeist.rb +0 -22
  182. data/features/support/rails.rb +0 -1
  183. data/features/support/rspec.rb +0 -6
  184. data/features/support/screenshots.rb +0 -5
  185. data/features/support/sign_in.rb +0 -17
  186. data/features/support/simplecov.rb +0 -1
  187. data/features/support/turbolinks.rb +0 -30
  188. data/spec/factories/billing_machine_id_cards.rb +0 -26
  189. data/spec/models/dorsale/billing_machine/id_card_spec.rb +0 -12
@@ -0,0 +1,107 @@
1
+ require "prawn"
2
+ require "prawn/measurement_extensions"
3
+
4
+ module Dorsale::PrawnHelpers
5
+ include Dorsale::AllHelpers
6
+ include ActionView::Helpers::NumberHelper
7
+
8
+ def draw_debug_bounds?
9
+ false
10
+ end
11
+
12
+ def draw_debug_bounds!
13
+ transparent(0.5) { stroke_bounds } if draw_debug_bounds?
14
+ end
15
+
16
+ def t(*args)
17
+ I18n.t(*args)
18
+ end
19
+
20
+ def page_height
21
+ page.dimensions[3]
22
+ end
23
+
24
+ def page_width
25
+ page.dimensions[2]
26
+ end
27
+
28
+ def bb(options = {}, &block)
29
+ outer_box_left = options.fetch(:left, bounds.left)
30
+ outer_box_top = options.fetch(:top, bounds.top)
31
+ outer_box_width = options.fetch(:width, bounds.width)
32
+ outer_box_height = options.fetch(:height, bounds.height)
33
+ padding = options.fetch(:padding, 0)
34
+ radius = options.fetch(:radius, 0)
35
+ rectangle = options.fetch(:rectangle, false)
36
+ background = options.fetch(:background, false)
37
+
38
+ if rectangle
39
+ stroke do
40
+ rounded_rectangle [outer_box_left, outer_box_top], outer_box_width, outer_box_height, radius
41
+ end
42
+ end
43
+
44
+ if background
45
+ previous_fill_color = fill_color
46
+ fill_color background
47
+ fill_rounded_rectangle [outer_box_left, outer_box_top], outer_box_width, outer_box_height, radius
48
+ fill_color previous_fill_color
49
+ end
50
+
51
+ bounding_box [outer_box_left, outer_box_top], width: outer_box_width, height: outer_box_height do
52
+ draw_debug_bounds!
53
+
54
+ inner_box_left = bounds.left + padding
55
+ inner_box_top = bounds.top - padding
56
+ inner_box_width = bounds.width - (padding * 2)
57
+ inner_box_height = bounds.height - (padding * 2)
58
+
59
+ bounding_box [inner_box_left, inner_box_top], width: inner_box_width, height: inner_box_height do
60
+ draw_debug_bounds!
61
+
62
+ block&.call
63
+ end
64
+ end
65
+ end
66
+
67
+ def tb(text, options = {})
68
+ box_left = options[:left] || bounds.left
69
+ box_top = options[:top] || bounds.top
70
+ box_width = options[:width] || bounds.width
71
+ box_height = options[:height] || bounds.height
72
+
73
+ options = {
74
+ :at => [box_left, box_top],
75
+ :width => box_width,
76
+ :height => box_height,
77
+ :overflow => :shrink_to_fit,
78
+ :inline_format => true,
79
+ }.merge(options)
80
+
81
+ text_box(text.to_s, options)
82
+ end
83
+
84
+ def btb(text, options = {})
85
+ bb(options) do
86
+ tb(text)
87
+ end
88
+ end
89
+
90
+ def get_image(obj)
91
+ return if obj.blank?
92
+
93
+ if ApplicationUploader.storage.to_s.end_with?("File") # Local
94
+ obj.path
95
+ elsif ApplicationUploader.storage.to_s.end_with?("Fog") # Amazon S3
96
+ open(obj.url)
97
+ else
98
+ raise NotImplementedError
99
+ end
100
+ end
101
+
102
+ def placeholder(method)
103
+ return unless Rails.env.development?
104
+
105
+ "You can override this text in <b>##{method}</b> method, otherwise it will not be displayed in other environments."
106
+ end
107
+ end
@@ -24,16 +24,14 @@ class Dorsale::ApplicationPolicy
24
24
 
25
25
  def self.define_subject_accessor!
26
26
  # Dorsale::BillingMachine::InvoicePolicy -> :invoice
27
- object_type = self.to_s.demodulize.gsub("Policy", "").underscore.to_sym
27
+ object_type = to_s.demodulize.gsub("Policy", "").underscore.to_sym
28
28
 
29
29
  # Avoid user/subject conflict
30
30
  object_type = :other_user if object_type == :user
31
31
 
32
- self.send(:define_method, object_type) { subject }
32
+ send(:define_method, object_type) { subject }
33
33
  end
34
34
 
35
- private
36
-
37
35
  class Scope
38
36
  attr_reader :user, :scope
39
37
 
@@ -35,5 +35,4 @@ module Dorsale::ExpenseGun::ExpensePolicyHelper
35
35
  return false unless expense.may_go_to_canceled?
36
36
  super
37
37
  end
38
-
39
38
  end
@@ -30,9 +30,9 @@ module Dorsale::Flyboy::TaskPolicyHelper
30
30
  private
31
31
 
32
32
  def cannot_read_taskable?
33
- return false unless task.is_a?(::Dorsale::Flyboy::Task)
34
- return false unless task.taskable.present?
33
+ return false if task == Dorsale::Flyboy::Task
34
+ return false if task.taskable.blank?
35
35
 
36
- ! policy(task.taskable).read?
36
+ !policy(task.taskable).read?
37
37
  end
38
38
  end
@@ -8,7 +8,6 @@ class Dorsale::PolicyChecker
8
8
 
9
9
  check_policy! "Dorsale::Alexandrie::AttachmentPolicy"
10
10
  check_policy! "Dorsale::Alexandrie::AttachmentTypePolicy"
11
- check_policy! "Dorsale::BillingMachine::IdCardPolicy"
12
11
  check_policy! "Dorsale::BillingMachine::InvoicePolicy"
13
12
  check_policy! "Dorsale::BillingMachine::PaymentTermPolicy"
14
13
  check_policy! "Dorsale::BillingMachine::QuotationPolicy"
@@ -37,28 +36,24 @@ class Dorsale::PolicyChecker
37
36
  private
38
37
 
39
38
  def check_policy!(policy)
40
- begin
41
- policy_klass = policy.constantize
42
- rescue NameError
39
+ if (policy_klass = policy.safe_constantize).nil?
43
40
  errors << "#{policy} does not exist"
44
41
  return
45
42
  end
46
43
 
47
- begin
48
- helper_klass = "#{policy}Helper".constantize
49
- rescue NameError
44
+ if (helper_klass = "#{policy}Helper".safe_constantize).nil?
50
45
  errors << "#{policy}Helper does not exist"
51
46
  return
52
47
  end
53
48
 
54
- begin
55
- scope_klass = "#{policy}::Scope".constantize
56
-
57
- unless scope_klass.public_instance_methods.include?(:resolve)
58
- errors << "#{policy}::Scope#resolve is not defined"
59
- end
60
- rescue NameError
49
+ if (scope_klass = "#{policy}::Scope".constantize).nil?
61
50
  errors << "#{policy}::Scope does not exist"
51
+ return
52
+ end
53
+
54
+ if scope_klass.public_instance_methods.exclude?(:resolve)
55
+ errors << "#{policy}::Scope#resolve is not defined"
56
+ return
62
57
  end
63
58
 
64
59
  unless policy_klass < helper_klass
@@ -67,11 +62,9 @@ class Dorsale::PolicyChecker
67
62
  end
68
63
 
69
64
  helper_klass::POLICY_METHODS.each do |method|
70
- unless policy_klass.public_instance_methods(false).include?(method)
65
+ if policy_klass.public_instance_methods(false).exclude?(method)
71
66
  errors << "#{policy_klass}##{method} is not defined"
72
- next
73
67
  end
74
68
  end
75
- end
76
-
69
+ end # def check_policy
77
70
  end
@@ -12,8 +12,8 @@ class Dorsale::BillingMachine::Invoice::Copy < ::Dorsale::Service
12
12
  @copy.lines << line.dup
13
13
  end
14
14
 
15
- @copy.date = Time.zone.now.to_date
16
- @copy.due_date = Time.zone.now.to_date + 30.days
15
+ @copy.date = Date.current
16
+ @copy.due_date = Date.current + 30.days
17
17
  @copy.unique_index = nil
18
18
  @copy.paid = false
19
19
 
@@ -17,8 +17,13 @@ class Dorsale::BillingMachine::PdfFileGenerator < Dorsale::Service
17
17
  private
18
18
 
19
19
  def pdf_klass
20
- return ::Dorsale::BillingMachine.invoice_pdf_model if document.is_a?(::Dorsale::BillingMachine::Invoice)
21
- return ::Dorsale::BillingMachine.quotation_pdf_model if document.is_a?(::Dorsale::BillingMachine::Quotation)
20
+ if document.is_a?(::Dorsale::BillingMachine::Invoice)
21
+ return ::Dorsale::BillingMachine.invoice_pdf_model
22
+ end
23
+
24
+ if document.is_a?(::Dorsale::BillingMachine::Quotation)
25
+ return ::Dorsale::BillingMachine.quotation_pdf_model
26
+ end
22
27
  end
23
28
 
24
29
  def pdf_data
@@ -15,7 +15,7 @@ class Dorsale::BillingMachine::Quotation::Copy < ::Dorsale::Service
15
15
  @copy.unique_index = nil
16
16
  @copy.created_at = nil
17
17
  @copy.updated_at = nil
18
- @copy.date = Time.zone.now.to_date
18
+ @copy.date = Date.current
19
19
  @copy.state = ::Dorsale::BillingMachine::Quotation::STATES.first
20
20
 
21
21
  @copy.save!
@@ -9,9 +9,7 @@ class Dorsale::BillingMachine::Quotation::ToInvoice < ::Dorsale::Service
9
9
  @invoice = Dorsale::BillingMachine::Invoice.new
10
10
 
11
11
  quotation.attributes.each do |k, v|
12
- next if k.to_s == "id"
13
- next if k.to_s.match /index|tracking|state/
14
- next if k.to_s.end_with?("_at")
12
+ next if ignored_key?(k)
15
13
 
16
14
  if invoice.respond_to?("#{k}=")
17
15
  invoice.public_send("#{k}=", v)
@@ -22,9 +20,7 @@ class Dorsale::BillingMachine::Quotation::ToInvoice < ::Dorsale::Service
22
20
  invoice_line = invoice.lines.new
23
21
 
24
22
  quotation_line.attributes.each do |k, v|
25
- next if k.to_s == "id"
26
- next if k.to_s.match /index|tracking|state/
27
- next if k.to_s.end_with?("_at")
23
+ next if ignored_key?(k)
28
24
 
29
25
  if invoice_line.respond_to?("#{k}=")
30
26
  invoice_line.public_send("#{k}=", v)
@@ -32,8 +28,15 @@ class Dorsale::BillingMachine::Quotation::ToInvoice < ::Dorsale::Service
32
28
  end
33
29
  end
34
30
 
35
- invoice.date = Time.zone.now.to_date
31
+ invoice.date = Date.current
36
32
 
37
33
  invoice
38
34
  end
35
+
36
+ private
37
+
38
+ def ignored_key?(k)
39
+ k = k.to_s
40
+ k == "id" || k.match?(/index|tracking|state/) || k.end_with?("_at")
41
+ end
39
42
  end
@@ -36,7 +36,7 @@ class Dorsale::Flyboy::Task::Snoozer < ::Dorsale::Service
36
36
  private
37
37
 
38
38
  def current_date
39
- Time.zone.now.to_date
39
+ Date.current
40
40
  end
41
41
 
42
42
  def snooze_term_value
@@ -6,11 +6,10 @@
6
6
  .col-md-6
7
7
  .well
8
8
  = info document, :label
9
+ = info document, :date
9
10
 
10
11
  .col-md-6
11
12
  .well
12
- = info document, :date
13
- hr
14
13
  - if document.customer.present?
15
14
  = document.customer
16
15
  br
@@ -11,19 +11,12 @@
11
11
 
12
12
  .row
13
13
  .col-md-6
14
- .well
15
- - if @id_cards.one?
16
- = f.hidden_field :id_card_id
17
- = info document, :id_card
18
- - else
19
- = f.association :id_card, collection: @id_cards
20
-
21
- = f.input :label
14
+ .well.well-sm
15
+ = f.input :label
16
+ = f.input :date, html5: true
22
17
 
23
18
  .col-md-6
24
- .well
25
- = f.input :date, html5: true
26
- hr
19
+ .well.well-sm
27
20
  = f.input :customer_guid, collection: @people.map{ |e| [e.to_s, e.guid] }, input_html: {class: "select2"}
28
21
 
29
22
  table#lines-table
@@ -15,7 +15,7 @@ data = [
15
15
  Dorsale::BillingMachine::Invoice.t(:total_including_taxes),
16
16
  Dorsale::BillingMachine::Invoice.t(:advance),
17
17
  Dorsale::BillingMachine::Invoice.t(:balance),
18
- ]
18
+ ],
19
19
  ]
20
20
 
21
21
  @invoices_without_pagination.each do |invoice|
@@ -5,7 +5,7 @@ data = [
5
5
  model.t(:name),
6
6
  model.t(:progress),
7
7
  model.t(:term),
8
- ]
8
+ ],
9
9
  ]
10
10
 
11
11
  @tasks_without_pagination.each do |task|
@@ -13,10 +13,6 @@ en:
13
13
  create_ok : "Category successfully created."
14
14
  update_ok : "Category successfully updated."
15
15
 
16
- id_cards:
17
- create_ok : "Card successfully created."
18
- update_ok : "Card successfully updated."
19
-
20
16
  payment_terms:
21
17
  create_ok : "Payment Term successfully created."
22
18
  update_ok : "Payment Term successfully updated."
@@ -13,10 +13,6 @@ fr:
13
13
  create_ok : "La Catégorie a été créée."
14
14
  update_ok : "La Catégorie a été modifiée."
15
15
 
16
- id_cards:
17
- create_ok : "La Carte a été créée."
18
- update_ok : "La Carte a été modifiée."
19
-
20
16
  payment_terms:
21
17
  create_ok : "La Paiement a été créé."
22
18
  update_ok : "La Paiement a été modifié."
@@ -2,41 +2,10 @@ en:
2
2
  actions:
3
3
  create_invoice: "Create invoice"
4
4
  new_payment_term: "New payment terms"
5
- new_id_card: "New Id Card"
6
5
 
7
6
  attributes:
8
7
  invoice: "Invoice"
9
8
  quotation: "Quotation"
10
- id_card: "Id Card"
11
- id_card_name: "Id Card name"
12
- entity_name: "Entity name"
13
- intracommunity_vat: "Intracommunity VAT"
14
- legal_form: "Legal form"
15
- registration_number: "Registration number"
16
- registration_city: "Registration city"
17
- contact_full_name: "Contact name"
18
- contact_fax: "Contact fax number"
19
- contact_email: "Contact email"
20
- contact_phone: "Contact phone"
21
- contact_address_1: "Contact address (1)"
22
- contact_address_2: "Contact address (2)"
23
- contact_zip: "Contact zip"
24
- contact_city: "Contact city"
25
- bank_name: "Bank name"
26
- bank_address: "Bank address"
27
- siret: "SIRET"
28
- capital: "Capital"
29
- iban: "IBAN"
30
- bic_swift: "BIC/SWIFT"
31
- ape_naf: "APE/NAF"
32
- custom_info_1: "Custom informations (1)"
33
- custom_info_2: "Custom informations (2)"
34
- custom_info_3: "Custom informations (3)"
35
- your_contact: "Your contact"
36
- contact_phone: "Phone"
37
- contact_email: "Email"
38
- contact_fax: "Fax"
39
- tracking_number: "Number"
40
9
  customer: "Customer"
41
10
  designation: "Designation"
42
11
  quantity: "Quantity"
@@ -46,12 +15,6 @@ en:
46
15
  line_total: "Total"
47
16
  payment_term: "Payment terms"
48
17
  payment_terms: "Payment terms"
49
- iban: "IBAN"
50
- bic_swift: "BIC / SWIFT"
51
- info_phone: "Phone"
52
- info_fax: "Fax"
53
- registration: "Registration"
54
- siret: "SIRET"
55
18
  vat: "VAT"
56
19
  vat_amount: "VAT Amount"
57
20
  vat_rate: "VAT Rate"
@@ -81,10 +44,6 @@ en:
81
44
  one: "Quotation Line"
82
45
  other: "Quotation Lines"
83
46
 
84
- dorsale/billing_machine/id_card:
85
- one: "Id card"
86
- other: "Id cards"
87
-
88
47
  dorsale/billing_machine/payment_term:
89
48
  one: "Payment term"
90
49
  other: "Payment terms"
@@ -2,41 +2,10 @@ fr:
2
2
  actions:
3
3
  create_invoice: "Facturer"
4
4
  new_payment_term: "Nouvelles conditions de paiement"
5
- new_id_card: "Nouvelle carte d'identité"
6
5
 
7
6
  attributes:
8
7
  invoice: "Facture"
9
8
  quotation: "Devis"
10
- id_card: "Carte d'identité"
11
- id_card_name: "Nom de la carte"
12
- entity_name: "Nom de l'entité"
13
- intracommunity_vat: "TVA intracommunautaire"
14
- legal_form: "Forme juridique"
15
- registration_number: "Numéro d'immatriculation"
16
- registration_city: "Ville d'immatriculation"
17
- contact_full_name: "Nom du contact"
18
- contact_fax: "Fax du contact"
19
- contact_email: "Email du contact"
20
- contact_phone: "Téléphone du contact"
21
- contact_address_1: "Adresse du contact (1)"
22
- contact_address_2: "Adresse du contact (2)"
23
- contact_zip: "Code postal du contact"
24
- contact_city: "Ville du contact"
25
- bank_name: "Nom de la banque"
26
- bank_address: "Adresse de la banque"
27
- siret: "Siret"
28
- capital: "Capital"
29
- iban: "IBAN"
30
- bic_swift: "BIC/SWIFT"
31
- ape_naf: "APE/NAF"
32
- custom_info_1: "Information personalisées (1)"
33
- custom_info_2: "Information personalisées (2)"
34
- custom_info_3: "Information personalisées (3)"
35
- your_contact: "Votre contact"
36
- contact_phone: "Téléphone"
37
- contact_email: "Email"
38
- contact_fax: "Fax"
39
- tracking_number: "Numéro"
40
9
  customer: "Client"
41
10
  designation: "Désignation"
42
11
  quantity: "Qte"
@@ -46,12 +15,6 @@ fr:
46
15
  line_total: "TOTAL HT"
47
16
  payment_term: "Conditions de paiement"
48
17
  payment_terms: "Conditions de paiement"
49
- iban: "IBAN"
50
- bic_swift: "BIC / SWIFT"
51
- info_phone: "Tel."
52
- info_fax: "Fax"
53
- registration: "RCS"
54
- siret: "SIRET "
55
18
  vat: "TVA"
56
19
  vat_amount: "Montant TVA"
57
20
  vat_rate: "Taux TVA"
@@ -81,10 +44,6 @@ fr:
81
44
  one: "Ligne de devis"
82
45
  other: "Lignes de devis"
83
46
 
84
- dorsale/billing_machine/id_card:
85
- one: "Carte d'identité"
86
- other: "Cartes d'identité"
87
-
88
47
  dorsale/billing_machine/payment_term:
89
48
  one: "Condition de paiement"
90
49
  other: "Conditions de paiement"