]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Artikel nicht löschen können, wenn in Preisregeln verwendet.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 9 Nov 2018 11:30:41 +0000 (12:30 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 9 Nov 2018 11:34:04 +0000 (12:34 +0100)
behebt #353
"Preisregeln Wenn Artikel gelöscht wird"

SL/Controller/Part.pm
locale/de/all
locale/en/all

index 27a23daa80a912ac6040ce236199744aca2b695b..804ad159032f0dd46e187b86443121d26a638bb2 100644 (file)
@@ -6,6 +6,7 @@ use parent qw(SL::Controller::Base);
 use Clone qw(clone);
 use SL::DB::Part;
 use SL::DB::PartsGroup;
+use SL::DB::PriceRuleItem;
 use SL::DB::Shop;
 use SL::Controller::Helper::GetModels;
 use SL::Locale::String qw(t8);
@@ -1266,7 +1267,8 @@ sub parse_add_items_to_objects {
 sub _setup_form_action_bar {
   my ($self) = @_;
 
-  my $may_edit = $::auth->assert('part_service_assembly_edit', 'may fail');
+  my $may_edit           = $::auth->assert('part_service_assembly_edit', 'may fail');
+  my $used_in_pricerules = !!SL::DB::Manager::PriceRuleItem->get_all_count(where => [type => 'part', value_int => $self->part->id]);
 
   for my $bar ($::request->layout->get('actionbar')) {
     $bar->add(
@@ -1292,6 +1294,7 @@ sub _setup_form_action_bar {
         disabled => !$self->part->id       ? t8('This object has not been saved yet.')
                   : !$may_edit             ? t8('You do not have the permissions to access this function.')
                   : !$self->part->orphaned ? t8('This object has already been used.')
+                  : $used_in_pricerules    ? t8('This object is used in price rules.')
                   :                          undef,
       ],
 
index b433df548ef71e3c5927045205180b7c15c4d865..e99d817a7b0f2fe17bc1a0b0a93442a668a2af61 100755 (executable)
@@ -3503,6 +3503,7 @@ $self->{texts} = {
   'This module can help you identify and correct such entries by analyzing the general ledger and presenting you likely solutions but also allowing you to fix problems yourself.' => 'Dieses Modul kann Ihnen helfen, problematische Einträge im Hauptbuch zu identifizieren und teilweise zu beheben. Dabei werden je nach Problem mögliche Lösungen aufgezeigt, wobei Sie die entscheiden können, welche Probleme automatisch gelöst werden sollen.',
   'This object has already been used.' => 'Dieses Objekt wird bereits verwendet.',
   'This object has not been saved yet.' => 'Das Objekt wurde noch nicht gespeichert.',
+  'This object is used in price rules.' => 'Dieses Objekt wird in Preisregeln verwendet.',
   'This option controls the inventory system.' => 'Dieser Parameter legt die Warenbuchungsmethode fest.',
   'This option controls the method used for determining the startdate for the balance report.' => 'Diese Option bestimmt, wie das Startdatum für den Bilanzbericht ermittelt wird',
   'This option controls the method used for profit determination.' => 'Dieser Parameter legt die Berechnungsmethode für die Gewinnermittlung fest.',
index 6a0002908970d11cbf37d6691760d160cf413de2..6b8c4f8028d29943c348d03648e2857ce611e66f 100644 (file)
@@ -3502,6 +3502,7 @@ $self->{texts} = {
   'This module can help you identify and correct such entries by analyzing the general ledger and presenting you likely solutions but also allowing you to fix problems yourself.' => '',
   'This object has already been used.' => '',
   'This object has not been saved yet.' => '',
+  'This object is used in price rules.' => '',
   'This option controls the inventory system.' => '',
   'This option controls the method used for determining the startdate for the balance report.' => '',
   'This option controls the method used for profit determination.' => '',