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

[bug] some invoices does not have the name of the user

This commit is contained in:
Sylvain 2021-05-14 17:07:38 +02:00
parent 7251298334
commit 0992999a32
4 changed files with 14 additions and 2 deletions

View File

@ -16,6 +16,7 @@
- Fix a bug: "about" page shows a non-functional menu icon
- Fix a bug: responsiveness of the "about" page title
Fix a bug: unable to change the slots durations for a new availability
- Fix a bug: some invoices does not have the name of the user
- Fix a security issue: updated underscore to 1.12.1 to fix [CVE-2021-23358](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358)
- Fix a security issue: updated lodash to 4.17.21 to fix [CVE-2021-23337](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337)
- Fix a security issue: updated url-parse to 1.5.1 to fix [CVE-2021-27515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27515)
@ -23,6 +24,7 @@
- Fix a security issue: updated codemirror to 5.58.2 to fix [CVE-2020-7760](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7760)
- Fix a security issue: updated rails to 5.2.6 to fix [CVE-2021-22904](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22904)
- Fix a security issue: updated react-i18next to 11.8.15 to fix [CVE-2021-23346](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23346)
- [TODO DEPLOY] `rails fablab:fix:invoices_without_names`
## v4.7.8 2021 April 02
- Updated mimemagic to 0.3.10 to fix [a build issue](https://github.com/mimemagicrb/mimemagic/issues/139)

View File

@ -12,7 +12,7 @@ class Profile < ApplicationRecord
validates :last_name, presence: true, length: { maximum: 30 }
validates_numericality_of :phone, only_integer: true, allow_blank: false, if: -> { Setting.get('phone_required') }
after_commit :update_invoicing_profile, if: :invoicing_data_was_modified?, on: [:update]
after_commit :update_invoicing_profile, if: :invoicing_data_was_modified?
def full_name
# if first_name or last_name is nil, the empty string will be used as a temporary replacement

View File

@ -438,7 +438,9 @@ class User < ApplicationRecord
raise NoProfileError if invoicing_profile.nil?
invoicing_profile.update_attributes(
email: email
email: email,
first_name: first_name,
last_name: last_name
)
end
end

View File

@ -187,5 +187,13 @@ namespace :fablab do
end
end
end
desc '[release 4.7.9] fix invoicing profiles without names'
task invoices_without_names: :environment do
InvoicingProfile.where('(first_name IS NULL OR last_name IS NULL) AND user_id IS NOT NULL').each do |ip|
ip.update_attribute('first_name', ip.user.profile.first_name)
ip.update_attribute('last_name', ip.user.profile.last_name)
end
end
end
end