Revision 0af1d584
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
41 | 41 |
use SL::Helper::UserPreferences::PositionsScrollbar; |
42 | 42 |
use SL::Helper::UserPreferences::UpdatePositions; |
43 | 43 |
|
44 |
use SL::DB::Helper::HardRecordLinks; |
|
45 |
|
|
44 | 46 |
use SL::Controller::Helper::GetModels; |
45 | 47 |
|
46 | 48 |
use List::Util qw(first sum0); |
... | ... | |
2416 | 2418 |
$has_final_invoice = any {'SL::DB::Invoice' eq ref $_ && "final_invoice" eq $_->type} @$lr; |
2417 | 2419 |
} |
2418 | 2420 |
|
2421 |
my $has_hard_links = SL::DB::Helper::HardRecordLinks->get_count($self->order); |
|
2422 |
|
|
2419 | 2423 |
my $right_for = { map { $_ => $_.'_edit' } @{$self->valid_types} }; |
2420 | 2424 |
$right_for->{ sales_order_intake_type() } = 'sales_order_edit'; |
2421 | 2425 |
$right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit'; |
... | ... | |
2656 | 2660 |
confirm => $::locale->text('Do you really want to delete this object?'), |
2657 | 2661 |
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') |
2658 | 2662 |
: !$self->order->id ? t8('This object has not been saved yet.') |
2663 |
: $has_hard_links ? t8('This object has hard links. Please delete them first.') |
|
2659 | 2664 |
: undef, |
2660 | 2665 |
only_if => $deletion_allowed, |
2661 | 2666 |
], |
SL/IS.pm | ||
---|---|---|
2848 | 2848 |
return $result; |
2849 | 2849 |
} |
2850 | 2850 |
|
2851 |
sub has_hard_links { |
|
2852 |
$main::lxdebug->enter_sub(); |
|
2853 |
my ($self, $myconfig, $form, $table) = @_; |
|
2854 |
$main::lxdebug->leave_sub() and return 0 unless ($form->{id}); |
|
2855 |
my $result = 0; |
|
2856 |
if ($table eq 'ap') { |
|
2857 |
require SL::DB::PurchaseInvoice; |
|
2858 |
my $record = SL::DB::PurchaseInvoice->new(id => $form->{id})->load; |
|
2859 |
$result = SL::DB::Helper::HardRecordLinks->get_count($record); |
|
2860 |
} |
|
2861 |
$main::lxdebug->leave_sub(); |
|
2862 |
|
|
2863 |
return $result; |
|
2864 |
} |
|
2865 |
|
|
2851 | 2866 |
sub is_storno { |
2852 | 2867 |
$main::lxdebug->enter_sub(); |
2853 | 2868 |
|
bin/mozilla/ap.pl | ||
---|---|---|
1388 | 1388 |
|
1389 | 1389 |
my $is_storno = IS->is_storno(\%::myconfig, $::form, 'ap', $::form->{id}); |
1390 | 1390 |
my $has_storno = IS->has_storno(\%::myconfig, $::form, 'ap'); |
1391 |
my $has_hard_links = IS->has_hard_links(\%::myconfig, $::form, 'ap'); |
|
1391 | 1392 |
|
1392 | 1393 |
my $may_edit_create = $::auth->assert('ap_transactions', 1); |
1393 | 1394 |
|
... | ... | |
1515 | 1516 |
: $change_never ? t8('Changing invoices has been disabled in the configuration.') |
1516 | 1517 |
: $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') |
1517 | 1518 |
: $has_storno ? t8('This invoice has been canceled already.') |
1519 |
: $has_hard_links ? t8('This invoice has hard links. Please delete them first.') |
|
1518 | 1520 |
: undef, |
1519 | 1521 |
], |
1520 | 1522 |
], # end of combobox "Storno" |
Auch abrufbar als: Unified diff
Deaktiviere Löschen-Button bei festen Verknüpfungen (order, ap)