mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Merge remote-tracking branch 'origin/master' into 1636-objects-are-missing-creator-and-updator-strings
This commit is contained in:
commit
2d93932d92
11 changed files with 163 additions and 16 deletions
|
@ -24,9 +24,9 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
|
|||
|
||||
confirmed = params[:confirmed] ? true : false
|
||||
action = if confirmed
|
||||
@registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
|
||||
else
|
||||
@registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}")
|
||||
else
|
||||
@registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
|
||||
end
|
||||
|
||||
fail_msg = t("registrant_domain_delete_#{confirmed ? 'confirmed' : 'rejected'}_failed".to_sym)
|
||||
|
@ -36,9 +36,9 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
|
|||
(render 'show' && return) unless action
|
||||
|
||||
if confirmed
|
||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) && return
|
||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
||||
else
|
||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) unless confirmed
|
||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -57,7 +57,8 @@ module Concerns::Domain::Transferable
|
|||
|
||||
def transfer_domain_contacts(new_registrar)
|
||||
copied_ids = []
|
||||
contacts.each do |contact|
|
||||
domain_contacts.each do |dc|
|
||||
contact = Contact.find(dc.contact_id)
|
||||
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
|
||||
|
||||
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
|
||||
|
@ -66,7 +67,11 @@ module Concerns::Domain::Transferable
|
|||
oc = contact.transfer(new_registrar)
|
||||
end
|
||||
|
||||
domain_contacts.where(contact_id: contact.id).update_all({ contact_id: oc.id }) # n+1 workaround
|
||||
if domain_contacts.find_by(contact_id: oc.id, domain_id: id, type: dc.type).present?
|
||||
dc.destroy
|
||||
else
|
||||
dc.update(contact_id: oc.id)
|
||||
end
|
||||
copied_ids << contact.id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Concerns
|
|||
|
||||
def as_directo_json
|
||||
invoice = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
||||
invoice['customer_code'] = buyer.accounting_customer_code
|
||||
invoice['customer'] = compose_directo_customer
|
||||
invoice['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
||||
invoice['transaction_date'] = account_activity
|
||||
.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
||||
|
@ -21,6 +21,14 @@ module Concerns
|
|||
subtotal, precision: 2, separator: '.'
|
||||
) }].as_json
|
||||
end
|
||||
|
||||
def compose_directo_customer
|
||||
{
|
||||
'code': buyer.accounting_customer_code,
|
||||
'destination': buyer_country_code,
|
||||
'vat_reg_no': buyer_vat_no,
|
||||
}.as_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module Concerns
|
|||
|
||||
invoice = {
|
||||
'number': 1,
|
||||
'customer_code': accounting_customer_code,
|
||||
'customer': compose_directo_customer,
|
||||
'language': language == 'en' ? 'ENG' : '', 'currency': activities.first.currency,
|
||||
'date': month.end_of_month.strftime('%Y-%m-%d')
|
||||
}.as_json
|
||||
|
@ -109,6 +109,14 @@ module Concerns
|
|||
}
|
||||
end
|
||||
|
||||
def compose_directo_customer
|
||||
{
|
||||
'code': accounting_customer_code,
|
||||
'destination': address_country_code,
|
||||
'vat_reg_no': vat_no,
|
||||
}.as_json
|
||||
end
|
||||
|
||||
def load_price(account_activity)
|
||||
@pricelists ||= {}
|
||||
return @pricelists[account_activity.price_id] if @pricelists.key? account_activity.price_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue