Revision 09696cb9
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
51 | 51 |
use Rose::Object::MakeMethods::Generic |
52 | 52 |
( |
53 | 53 |
scalar => [ qw(item_ids_to_delete is_custom_shipto_to_delete) ], |
54 |
'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button part_picker_classification_ids) ], |
|
54 |
'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors |
|
55 |
search_cvpartnumber show_update_button |
|
56 |
part_picker_classification_ids |
|
57 |
is_final_version) ], |
|
55 | 58 |
); |
56 | 59 |
|
57 | 60 |
|
... | ... | |
451 | 454 |
sub action_save_and_show_email_dialog { |
452 | 455 |
my ($self) = @_; |
453 | 456 |
|
454 |
my $is_final_version = $::instance_conf->get_lock_oe_subversions ? # conf enabled |
|
455 |
$self->order->id ? # is saved |
|
456 |
$self->order->is_final_version : # is final |
|
457 |
undef : # is not final |
|
458 |
undef; # conf disabled |
|
459 |
|
|
460 |
if (!$is_final_version) { |
|
457 |
if (!$self->is_final_version) { |
|
461 | 458 |
my $errors = $self->save(); |
462 | 459 |
|
463 | 460 |
if (scalar @{ $errors }) { |
... | ... | |
514 | 511 |
is_customer => $self->cv eq 'customer', |
515 | 512 |
ALL_EMPLOYEES => \@employees_with_email, |
516 | 513 |
ALL_PARTNER_EMAIL_ADDRESSES => $all_partner_email_addresses, |
517 |
is_final_version => $is_final_version, |
|
514 |
is_final_version => $self->is_final_version,
|
|
518 | 515 |
); |
519 | 516 |
|
520 | 517 |
$self->js |
... | ... | |
527 | 524 |
sub action_send_email { |
528 | 525 |
my ($self) = @_; |
529 | 526 |
|
530 |
my $is_final_version = $::instance_conf->get_lock_oe_subversions ? # conf enabled |
|
531 |
$self->order->id ? # is saved |
|
532 |
$self->order->is_final_version : # is final |
|
533 |
undef : # is not final |
|
534 |
undef; # conf disabled |
|
535 |
|
|
536 |
if (!$is_final_version) { |
|
527 |
if (!$self->is_final_version) { |
|
537 | 528 |
my $errors = $self->save(); |
538 | 529 |
|
539 | 530 |
if (scalar @{ $errors }) { |
... | ... | |
592 | 583 |
print_variant => $::form->{formname}); |
593 | 584 |
} |
594 | 585 |
|
595 |
if ($is_final_version && $::form->{attachment_policy} eq 'old_file' && !$attfile) { |
|
586 |
if ($self->is_final_version && $::form->{attachment_policy} eq 'old_file' && !$attfile) {
|
|
596 | 587 |
$::form->error(t8('Re-sending a final version was requested, but the latest version of the document could not be found')); |
597 | 588 |
} |
598 | 589 |
|
599 |
if (!$is_final_version && $::form->{attachment_policy} ne 'no_file' && !($::form->{attachment_policy} eq 'old_file' && $attfile)) { |
|
590 |
if (!$self->is_final_version && $::form->{attachment_policy} ne 'no_file' && !($::form->{attachment_policy} eq 'old_file' && $attfile)) {
|
|
600 | 591 |
my $doc; |
601 | 592 |
my @errors = $self->generate_doc(\$doc, {media => $::form->{media}, |
602 | 593 |
format => $::form->{print_options}->{format}, |
... | ... | |
641 | 632 |
$self->order->update_attributes(intnotes => $intnotes); |
642 | 633 |
} |
643 | 634 |
|
644 |
if ($::instance_conf->get_lock_oe_subversions && !$is_final_version) { |
|
635 |
if ($::instance_conf->get_lock_oe_subversions && !$self->is_final_version) {
|
|
645 | 636 |
my $file_id; |
646 | 637 |
if ($::instance_conf->get_doc_storage && $::form->{attachment_policy} ne 'no_file') { |
647 | 638 |
# self is generated on the fly. form is a file from the dms |
... | ... | |
1566 | 1557 |
return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => [ $attribute => 1 ]) } ]; |
1567 | 1558 |
} |
1568 | 1559 |
|
1560 |
sub init_is_final_version { |
|
1561 |
# VALID States for current Sales Version |
|
1562 |
# 1. save create version without email_id -> open |
|
1563 |
# 2. send email set email_id for version 1 -> final |
|
1564 |
# 3. save and subversion new version without email_id -> open |
|
1565 |
# 4. send email set email_id for current subversion -> final |
|
1566 |
# for all versions > 1 set postfix -2 .. -n for recordnumber |
|
1567 |
return $::instance_conf->get_lock_oe_subversions ? # conf enabled |
|
1568 |
$_[0]->order->id ? # is saved |
|
1569 |
$_[0]->order->is_final_version : # is final |
|
1570 |
undef : # is not final |
|
1571 |
undef; # conf disabled |
|
1572 |
} |
|
1573 |
|
|
1569 | 1574 |
sub check_auth { |
1570 | 1575 |
my ($self) = @_; |
1571 | 1576 |
|
... | ... | |
2236 | 2241 |
my $right = $right_for->{ $self->type }; |
2237 | 2242 |
$right ||= 'DOES_NOT_EXIST'; |
2238 | 2243 |
my $may_edit_create = $::auth->assert($right, 'may fail'); |
2239 |
# VALID States for current Sales Version |
|
2240 |
# 1. save create version without email_id -> open |
|
2241 |
# 2. send email set email_id for version 1 -> final |
|
2242 |
# 3. save and subversion new version without email_id -> open |
|
2243 |
# 4. send email set email_id for current subversion -> final |
|
2244 |
# for all versions > 1 set postfix -2 .. -n for recordnumber |
|
2245 |
my $is_final_version = $::instance_conf->get_lock_oe_subversions ? # conf enabled |
|
2246 |
$self->order->id ? # is saved |
|
2247 |
$self->order->is_final_version : # is final |
|
2248 |
undef : # is not final |
|
2249 |
undef; # conf disabled |
|
2244 |
|
|
2245 |
my $is_final_version = $self->is_final_version; |
|
2250 | 2246 |
|
2251 | 2247 |
for my $bar ($::request->layout->get('actionbar')) { |
2252 | 2248 |
$bar->add( |
Auch abrufbar als: Unified diff
Unterversionen: Code zum Ermitteln, ob finale/gesperrte Version, als Methode