1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

Fix a bug: unable to set user's invoicing profile names and email if active address required in create user form

This commit is contained in:
Du Peng 2022-03-29 17:08:35 +02:00
parent 043c5aafc5
commit 58f4ea4c15
3 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,8 @@
# Changelog Fab-manager
- Fix a bug: unable to show payment schedules list if active PayZen
- Fix a bug: unable to set user's invoicing profile names and email if active address required in create user form
- [TODO DEPLOY] `rails fablab:fix:invoices_without_names_and_email`
## v5.3.7 2022 March 28

View File

@ -469,6 +469,8 @@ class User < ApplicationRecord
first_name: first_name,
last_name: last_name
)
else
update_invoicing_profile
end
if wallet.nil?
ip ||= invoicing_profile

View File

@ -195,5 +195,14 @@ namespace :fablab do
ip.update_attribute('last_name', ip.user.profile.last_name)
end
end
desc '[release 5.3.8] fix invoicing profiles without names and email'
task invoices_without_names_and_email: :environment do
InvoicingProfile.where('(first_name IS NULL OR last_name IS NULL OR email 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)
ip.update_attribute('email', ip.user.email)
end
end
end
end