Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a6ce2c7f

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID a6ce2c7f3f7ae10f7065fb86121c8d11049617ee
  • Vorgänger 01ce6afc
  • Nachfolger 87e1fb0d

ActionBar: alte Funktionen zum E-Mail-Versand entfernt

Unterschiede anzeigen:

bin/mozilla/do.pl
1177 1177
  $main::lxdebug->leave_sub();
1178 1178
}
1179 1179

  
1180
sub e_mail {
1181
  $main::lxdebug->enter_sub();
1182

  
1183
  check_do_access();
1184

  
1185
  $::form->mtime_ischanged('delivery_orders','mail');
1186

  
1187
  $::form->{print_and_save} = 1;
1188

  
1189
  my $saved_form = save_form();
1190

  
1191
  save();
1192

  
1193
  restore_form($saved_form, 0, qw(id ordnumber quonumber));
1194

  
1195
  edit_e_mail();
1196

  
1197
  $main::lxdebug->leave_sub();
1198
}
1199

  
1200 1180
sub calculate_stock_in_out {
1201 1181
  $main::lxdebug->enter_sub();
1202 1182

  
......
1736 1716
  my $form     = $main::form;
1737 1717
  my $locale   = $main::locale;
1738 1718

  
1739
  foreach my $action (qw(update print e_mail save transfer_out transfer_out_default sort
1719
  foreach my $action (qw(update print save transfer_out transfer_out_default sort
1740 1720
                         transfer_in transfer_in_default mark_closed save_as_new invoice delete)) {
1741 1721
    if ($form->{"action_${action}"}) {
1742 1722
      call_sub($action);
bin/mozilla/io.pl
1026 1026
  quotation();
1027 1027
}
1028 1028

  
1029
sub edit_e_mail {
1030
  $main::lxdebug->enter_sub();
1031

  
1032
  my $form     = $main::form;
1033
  my %myconfig = %main::myconfig;
1034
  my $locale   = $main::locale;
1035

  
1036
  _check_io_auth();
1037

  
1038
  if ($form->{second_run}) {
1039
    $form->{print_and_post} = 0;
1040
    $form->{resubmit}       = 0;
1041
  }
1042

  
1043
  $form->{email} = $form->{shiptoemail} if $form->{shiptoemail} && $form->{formname} =~ /(pick|packing|bin)_list/;
1044

  
1045
  if ($form->{"cp_id"}) {
1046
    CT->get_contact(\%myconfig, $form);
1047
    $form->{"email"} = $form->{"cp_email"} if $form->{"cp_email"};
1048
  }
1049

  
1050
  $form->{language} = $form->get_template_language(\%myconfig);
1051
  $form->{language} = "_" . $form->{language} if $form->{language};
1052

  
1053
  my $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
1054

  
1055
  $form->{oldmedia} = $form->{media};
1056
  $form->{media}    = "email";
1057

  
1058
  my $global_bcc = AM->get_defaults()->{global_bcc};
1059

  
1060
  $form->{bcc} = join ', ', grep $_, $form->{bcc}, $global_bcc;
1061

  
1062
  my $attachment_filename = $form->generate_attachment_filename();
1063
  my $subject             = $form->{subject} || $form->generate_email_subject();
1064

  
1065
  $form->header;
1066

  
1067
  my (@dont_hide_key_list, %dont_hide_key, @hidden_keys);
1068
  @dont_hide_key_list = qw(action email cc bcc subject message sendmode format header override login password);
1069
  @dont_hide_key{@dont_hide_key_list} = (1) x @dont_hide_key_list;
1070
  @hidden_keys = sort grep { !$dont_hide_key{$_} } grep { !ref $form->{$_} } keys %$form;
1071

  
1072
  my (@files, @vc_files, @part_files, $has_document);
1073

  
1074
  if ($::instance_conf->get_doc_storage) {
1075
    @files = SL::File->get_all_versions(object_id => $form->{id}, object_type => $form->{type}, file_type => 'document');
1076
    $has_document = 1 if scalar(@files) > 0;
1077
    @files = SL::File->get_all(object_id => $form->{id}, object_type => $form->{type}, file_type => 'attachment');
1078
    @vc_files = SL::File->get_all(object_id => $form->{"$form->{vc}_id"}, object_type => $form->{vc})
1079
      if $form->{vc} && $form->{"$form->{vc}_id"};
1080

  
1081
    my %part_id_map = map { $_->{id} => $_ } grep { $_->{id} } map {
1082
      {
1083
        'id'       => $form->{"id_$_"},
1084
        'partname' => $form->{"partnumber_$_"}
1085
      }
1086
    } (1 .. $form->{rowcount});
1087

  
1088
    foreach my $partid (keys %part_id_map) {
1089
      my @pfiles = SL::File->get_all(object_id => $partid, object_type => 'part');
1090
      push @part_files, map { $_->{partname} = $part_id_map{$partid}->{partname}; $_ } @pfiles;
1091
    }
1092
  }
1093

  
1094
  print $form->parse_html_template('generic/edit_email',
1095
                                   { title         => $title,
1096
                                     a_filename    => $attachment_filename,
1097
                                     subject       => $subject,
1098
                                     has_document  => $has_document,
1099
                                     print_options => print_options('inline' => 1),
1100
                                     action        => 'send_email',
1101
                                     FILES         => \@files,
1102
                                     VC_FILES      => \@vc_files,
1103
                                     PART_FILES    => \@part_files,
1104
                                     HIDDEN        => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
1105
                                     SHOW_BCC      => $::auth->assert('email_bcc', 'may fail') });
1106

  
1107
  $main::lxdebug->leave_sub();
1108
}
1109

  
1110
sub send_email {
1111
  $main::lxdebug->enter_sub();
1112

  
1113
  my $form     = $main::form;
1114
  my %myconfig = %main::myconfig;
1115

  
1116
  _check_io_auth();
1117

  
1118
  my $callback = $form->{script} . "?action=edit";
1119
  map({ $callback .= "\&${_}=" . E($form->{$_}); } qw(type id));
1120
  if ( $form->{action_oldfile} || $form->{action_nofile} ) {
1121
    if (!$form->{email} || $form->{email} =~ /^\s*$/) {
1122
      flash('error', $::locale->text('E-mail address missing!'));
1123
    }
1124
    else {
1125
      $form->send_email(\%myconfig,'pdf');
1126
    }
1127
  }
1128
  else {
1129
    print_form("return");
1130
    $form->{addition} = "SCREENED";
1131
    $form->save_history;
1132
    $form->{addition} = "MAILED";
1133
  }
1134

  
1135
  flash_later('info' , $::locale->text('E-Mail is sent to #1', $form->{email})) if !$form->{emailerr};
1136
  flash_later('error', $::locale->text($form->{emailerr})) if $form->{emailerr};
1137

  
1138
  delete $form->{emailerr};
1139

  
1140
  Common->save_email_status(\%myconfig, $form);
1141
  ##TODO andere SAVE HISTORY
1142

  
1143
  $form->{callback} = $callback;
1144
  $form->redirect();
1145

  
1146
  $main::lxdebug->leave_sub();
1147
}
1148

  
1149 1029
sub print_options {
1150 1030
  $::lxdebug->enter_sub();
1151 1031

  
bin/mozilla/is.pl
1188 1188
  $::form->error($::locale->text('Cannot delete invoice!'));
1189 1189
}
1190 1190

  
1191
sub post_and_e_mail {
1192
  e_mail();
1193
};
1194

  
1195
sub e_mail {
1196
  $main::lxdebug->enter_sub();
1197

  
1198
  my $form     = $main::form;
1199

  
1200
  $main::auth->assert('invoice_edit');
1201

  
1202
  if (!$form->{id}) {
1203
    $form->{no_redirect_after_post} = 1;
1204

  
1205
    my $saved_form = save_form();
1206

  
1207
    post();
1208

  
1209
    restore_form($saved_form, 0, qw(id invnumber));
1210
  }
1211

  
1212
  edit_e_mail();
1213

  
1214
  $main::lxdebug->leave_sub();
1215
}
1216

  
1217 1191
sub dispatcher {
1218 1192
  for my $action (qw(
1219
    print update ship_to e_mail storno post_payment use_as_new credit_note
1193
    print update ship_to storno post_payment use_as_new credit_note
1220 1194
    delete post order preview post_and_e_mail print_and_post
1221 1195
    mark_as_paid
1222 1196
  )) {
bin/mozilla/oe.pl
2003 2003
  delivery_order();
2004 2004
}
2005 2005

  
2006
sub e_mail {
2007
  $main::lxdebug->enter_sub();
2008

  
2009
  my $form     = $main::form;
2010

  
2011
  check_oe_access();
2012

  
2013
  $form->mtime_ischanged('oe','mail');
2014
  $form->{print_and_save} = 1;
2015

  
2016
  my $saved_form = save_form();
2017

  
2018
  save();
2019

  
2020
  restore_form($saved_form, 0, qw(id ordnumber quonumber));
2021

  
2022
  edit_e_mail();
2023

  
2024
  $main::lxdebug->leave_sub();
2025
}
2026

  
2027 2006
sub yes {
2028 2007
  call_sub($main::form->{yes_nextsub});
2029 2008
}
......
2239 2218
}
2240 2219

  
2241 2220
sub dispatcher {
2242
  foreach my $action (qw(delete delivery_order e_mail invoice print purchase_order quotation
2221
  foreach my $action (qw(delete delivery_order invoice print purchase_order quotation
2243 2222
                         request_for_quotation sales_order save save_and_close save_as_new ship_to update)) {
2244 2223
    if ($::form->{"action_${action}"}) {
2245 2224
      call_sub($action);

Auch abrufbar als: Unified diff