1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

hide organization custom field if value is empty in invoice

This commit is contained in:
Du Peng 2022-05-11 12:49:10 +02:00
parent 78076b7fba
commit d0f7be41a0

View File

@ -61,7 +61,11 @@ class PDF::Invoice < Prawn::Document
if invoice&.invoicing_profile&.organization
name = invoice.invoicing_profile.organization.name
full_name = "#{name} (#{invoice.invoicing_profile.full_name})"
others = invoice&.invoicing_profile&.user_profile_custom_fields&.includes(:profile_custom_field)&.map do |f|
others = invoice&.invoicing_profile&.user_profile_custom_fields&.joins(:profile_custom_field)
&.where('profile_custom_fields.actived' => true)
&.order('profile_custom_fields.id ASC')
&.select { |f| f.value.present? }
&.map do |f|
"#{f.profile_custom_field.label}: #{f.value}"
end
else