Revision d2a38472
Von Tamino Steinert vor 12 Monaten hinzugefügt
bin/mozilla/is.pl | ||
---|---|---|
54 | 54 |
use SL::DB::Invoice; |
55 | 55 |
use SL::DB::PaymentTerm; |
56 | 56 |
use SL::DB::Reclamation; |
57 |
use SL::DB::EmailJournal; |
|
57 | 58 |
use SL::DB::ValidityToken; |
58 | 59 |
use SL::Helper::QrBillFunctions qw(get_ref_number_formatted); |
59 | 60 |
|
... | ... | |
122 | 123 |
$main::lxdebug->leave_sub(); |
123 | 124 |
} |
124 | 125 |
|
126 |
sub add_from_email_journal { |
|
127 |
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id}); |
|
128 |
&add; |
|
129 |
} |
|
130 |
|
|
131 |
sub edit_with_email_journal_workflow { |
|
132 |
my ($self) = @_; |
|
133 |
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id}); |
|
134 |
$::form->{workflow_email_journal_id} = delete $::form->{email_journal_id}; |
|
135 |
$::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id}; |
|
136 |
|
|
137 |
&edit; |
|
138 |
} |
|
139 |
|
|
125 | 140 |
sub edit { |
126 | 141 |
$main::lxdebug->enter_sub(); |
127 | 142 |
|
... | ... | |
1212 | 1227 |
$form->save_history; |
1213 | 1228 |
} |
1214 | 1229 |
|
1230 |
if ($form->{email_journal_id} && $form->{id} ne "") { |
|
1231 |
my $invoice = SL::DB::Invoice->new(id => $form->{id})->load; |
|
1232 |
my $email_journal = SL::DB::EmailJournal->new( |
|
1233 |
id => delete $form->{email_journal_id} |
|
1234 |
)->load; |
|
1235 |
$email_journal->link_to_record_with_attachment($invoice, delete $::form->{email_attachment_id}); |
|
1236 |
} |
|
1237 |
|
|
1215 | 1238 |
if (!$form->{no_redirect_after_post}) { |
1216 | 1239 |
$form->{action} = 'edit'; |
1217 | 1240 |
$form->{script} = 'is.pl'; |
... | ... | |
1247 | 1270 |
|
1248 | 1271 |
$main::auth->assert('invoice_edit'); |
1249 | 1272 |
|
1273 |
$form->{email_journal_id} = delete $form->{workflow_email_journal_id}; |
|
1274 |
$form->{email_attachment_id} = delete $form->{workflow_email_attachment_id}; |
|
1275 |
|
|
1250 | 1276 |
delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked qr_unstructured_message)}; |
1251 | 1277 |
$form->{rowcount}--; |
1252 | 1278 |
$form->{paidaccounts} = 1; |
... | ... | |
1272 | 1298 |
|
1273 | 1299 |
$main::auth->assert('invoice_edit'); |
1274 | 1300 |
|
1301 |
$form->{email_journal_id} = delete $form->{workflow_email_journal_id}; |
|
1302 |
$form->{email_attachment_id} = delete $form->{workflow_email_attachment_id}; |
|
1303 |
|
|
1275 | 1304 |
delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)}; |
1276 | 1305 |
$form->{convert_from_ar_ids} = $form->{id}; |
1277 | 1306 |
$form->{id} = ''; |
... | ... | |
1296 | 1325 |
|
1297 | 1326 |
$main::auth->assert('invoice_edit'); |
1298 | 1327 |
|
1328 |
$form->{email_journal_id} = delete $form->{workflow_email_journal_id}; |
|
1329 |
$form->{email_attachment_id} = delete $form->{workflow_email_attachment_id}; |
|
1330 |
|
|
1299 | 1331 |
my $related_invoices = IS->_get_invoices_for_advance_payment($form->{id}); |
1300 | 1332 |
|
1301 | 1333 |
delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)}; |
... | ... | |
1368 | 1400 |
$form->{addition} = "STORNO"; |
1369 | 1401 |
$form->save_history; |
1370 | 1402 |
|
1403 |
my $email_journal_id = delete $form->{workflow_email_journal_id}; |
|
1404 |
my $email_attachment_id = delete $form->{workflow_email_attachment_id}; |
|
1371 | 1405 |
map({ my $key = $_; delete($form->{$key}) unless (grep({ $key eq $_ } qw(id login password type))); } keys(%{ $form })); |
1372 | 1406 |
|
1407 |
$form->{email_journal_id} = $email_journal_id; |
|
1408 |
$form->{email_attachment_id} = $email_attachment_id; |
|
1409 |
|
|
1373 | 1410 |
invoice_links(); |
1374 | 1411 |
prepare_invoice(); |
1375 | 1412 |
relink_accounts(); |
... | ... | |
1423 | 1460 |
|
1424 | 1461 |
$main::auth->assert('invoice_edit'); |
1425 | 1462 |
|
1463 |
$form->{email_journal_id} = delete $form->{workflow_email_journal_id}; |
|
1464 |
$form->{email_attachment_id} = delete $form->{workflow_email_attachment_id}; |
|
1465 |
|
|
1426 | 1466 |
$form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token; |
1427 | 1467 |
|
1428 | 1468 |
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig); |
Auch abrufbar als: Unified diff
Workflow: E-Mail → VK Rechnung/Gutschrift überarbeitet