Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5a07eafc

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID 5a07eafc9d215ad427e1d0e1f1682294703f45ce
  • Vorgänger fa31a7e0
  • Nachfolger 43816cb7

"alle" E-Mail-Adressen per Anhaken als Empfänger hinzufügen können

Unterschiede anzeigen:

SL/Controller/Order.pm
446 446
    $user && !!trim($user->get_config_value('email'));
447 447
  } @{ SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]) };
448 448

  
449

  
450
  my $all_partner_email_addresses = $self->order->customervendor->get_all_email_addresses();
451

  
449 452
  my $dialog_html = $self->render('common/_send_email_dialog', { output => 0 },
450 453
                                  email_form    => $email_form,
451 454
                                  show_bcc      => $::auth->assert('email_bcc', 'may fail'),
452 455
                                  FILES         => \%files,
453 456
                                  is_customer   => $self->cv eq 'customer',
454 457
                                  ALL_EMPLOYEES => \@employees_with_email,
458
                                  ALL_PARTNER_EMAIL_ADDRESSES => $all_partner_email_addresses,
455 459
  );
456 460

  
457 461
  $self->js
......
477 481
  $self->js_reset_order_and_item_ids_after_save;
478 482

  
479 483
  my $email_form  = delete $::form->{email_form};
484

  
485
  if ($email_form->{additional_to}) {
486
    $email_form->{to} = join ', ', grep { $_ } $email_form->{to}, @{$email_form->{additional_to}};
487
    delete $email_form->{additional_to};
488
  }
489

  
480 490
  my %field_names = (to => 'email');
481 491

  
482 492
  $::form->{ $field_names{$_} // $_ } = $email_form->{$_} for keys %{ $email_form };
SL/DB/VC.pm
2 2

  
3 3
use strict;
4 4

  
5
require Exporter;
5
use List::MoreUtils qw(uniq);
6 6
use SL::DBUtils;
7 7

  
8
require Exporter;
9

  
8 10
our @ISA    = qw(Exporter);
9
our @EXPORT = qw(get_credit_remaining);
11
our @EXPORT = qw(get_credit_remaining get_all_email_addresses);
10 12

  
11 13
sub get_credit_remaining {
12 14
  my $vc               = shift;
......
50 52
  return $credit_remaining;
51 53
}
52 54

  
55
sub get_all_email_addresses {
56
  my ($self) = @_;
57

  
58
  my $is_sales = ref $self eq 'SL::DB::Customer';
59

  
60
  my @addresses;
61

  
62
  # billing address
63
  push @addresses, $self->$_ for qw(email cc bcc);
64
  if ($is_sales) {
65
    push @addresses, $self->$_ for qw(delivery_order_mail invoice_mail);
66
  }
67

  
68
  # additional billing addresses
69
  if ($is_sales) {
70
    foreach my $additional_billing_address (@{ $self->additional_billing_addresses }) {
71
      push @addresses, $additional_billing_address->$_ for qw(email);
72
    }
73
  }
74

  
75
  # contacts
76
  foreach my $contact (@{ $self->contacts }) {
77
    push @addresses, $contact->$_ for qw(cp_email cp_privatemail);
78
  }
79

  
80
  # shiptos
81
  foreach my $shipto (@{ $self->shipto }) {
82
    push @addresses, $shipto->$_ for qw(shiptoemail);
83
  }
84

  
85
  # remove empty ones and duplicates
86
  @addresses = grep { $_ } @addresses;
87
  @addresses = uniq @addresses;
88

  
89

  
90
  return \@addresses;
91
}
92

  
53 93
1;
bin/mozilla/io.pl
2145 2145
  };
2146 2146

  
2147 2147
  my %files = _get_files_for_email_dialog();
2148

  
2149
  my $all_partner_email_addresses;
2150
  $all_partner_email_addresses = SL::DB::Customer->load_cached($::form->{vc_id})->get_all_email_addresses() if 'customer' eq $::form->{vc};
2151
  $all_partner_email_addresses = SL::DB::Vendor  ->load_cached($::form->{vc_id})->get_all_email_addresses() if 'vendor'   eq $::form->{vc};
2152

  
2148 2153
  my $html  = $::form->parse_html_template("common/_send_email_dialog", {
2149 2154
    email_form      => $email_form,
2150 2155
    show_bcc        => $::auth->assert('email_bcc', 'may fail'),
......
2152 2157
    is_customer     => $::form->{vc} eq 'customer',
2153 2158
    is_invoice_mail => ($record_email && $::form->{type} eq 'invoice'),
2154 2159
    ALL_EMPLOYEES   => \@employees_with_email,
2160
    ALL_PARTNER_EMAIL_ADDRESSES => $all_partner_email_addresses,
2155 2161
  });
2156 2162

  
2157 2163
  print $::form->ajax_response_header, $html;
......
2165 2171
                  :                                                    'is.pl';
2166 2172

  
2167 2173
  my $email_form  = delete $::form->{email_form};
2174

  
2175
  if ($email_form->{additional_to}) {
2176
    $email_form->{to} = join ', ', grep { $_ } $email_form->{to}, @{$email_form->{additional_to}};
2177
    delete $email_form->{additional_to};
2178
  }
2179

  
2168 2180
  my %field_names = (to => 'email');
2169 2181

  
2170 2182
  $::form->{ $field_names{$_} // $_ } = $email_form->{$_} for keys %{ $email_form };
templates/webpages/common/_send_email_dialog.html
40 40
   </td>
41 41
  </tr>
42 42

  
43
  [%- IF ALL_PARTNER_EMAIL_ADDRESSES.size %]
44
   [%- FOREACH email = ALL_PARTNER_EMAIL_ADDRESSES %]
45
    <tr class="hidden" data-toggle-recipients="1">
46
     <th align="right" nowrap>
47
      [%- IF loop.first %]
48
       [% LxERP.t8("Other recipients") %]
49
      [%- END %]
50
     </th>
51
     <td>
52
       [% P.checkbox_tag("email_form.additional_to[]", label=email, value=email, checked="0") %]
53
     </td>
54
    </tr>
55
   [%- END %]
56
  [%- END %]
57

  
43 58
 [%- IF ALL_EMPLOYEES.size %]
44 59
  <tr class="hidden" data-toggle-recipients="1">
45 60
   <th align="right" nowrap>[% LxERP.t8("CC to Employee") %]</th>

Auch abrufbar als: Unified diff