$self->{shipto}->save(cascade => 1);
}
- if ($self->is_customer && any { $self->{additional_billing_address}->$_ ne '' } @ADDITIONAL_BILLING_ADDRESS_COLUMNS) {
+ if ($self->is_customer && any { $self->{additional_billing_address}->$_ ne '' } grep { $_ ne 'default_address' } @ADDITIONAL_BILLING_ADDRESS_COLUMNS) {
$self->{additional_billing_address}->customer_id($self->{cv}->id);
$self->{additional_billing_address}->save(cascade => 1);
--- /dev/null
+-- @tag: customer_remove_empty_additional_billing_addresses
+-- @description: Leere »zusätzliche Rechnungsadressen« entfernen
+-- @depends: customer_additional_billing_addresses
+DELETE
+FROM additional_billing_addresses
+WHERE (coalesce(name, '') = '')
+ AND (coalesce(department_1, '') = '')
+ AND (coalesce(department_2, '') = '')
+ AND (coalesce(contact, '') = '')
+ AND (coalesce(street, '') = '')
+ AND (coalesce(zipcode, '') = '')
+ AND (coalesce(city, '') = '')
+ AND (coalesce(country, '') = '')
+ AND (coalesce(email, '') = '')
+ AND (coalesce(phone, '') = '')
+ AND (coalesce(fax, '') = '');