+sub _set_cvar_validity {
+ my ($self) = @_;
+
+ my $flags = {
+ map { split m/=/, $_, 2 }
+ split m/:/, ($self->config->flags || '')
+ };
+
+ # nothing to do to set valid
+ return if !$flags->{defaults_to_invalid};
+
+ my $all_parts = SL::DB::Manager::Part->get_all(where => [ or => [ obsolete => 0, obsolete => undef ] ]);
+ foreach my $part (@{ $all_parts }) {
+ SL::DB::CustomVariableValidity->new(config_id => $self->config->id, trans_id => $part->id)->save;
+ }
+}
+
+sub setup_list_action_bar {
+ my ($self) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Add'),
+ link => $self->url_for(action => 'new', module => $self->module),
+ ],
+ );
+ }
+}
+
+sub setup_form_action_bar {
+ my ($self) = @_;
+
+ my $is_new = !$self->config->id;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ combobox => [
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => 'CustomVariableConfig/' . ($is_new ? 'create' : 'update') } ],
+ checks => [ 'check_prerequisites' ],
+ accesskey => 'enter',
+ ],
+
+ action => [
+ t8('Save as new'),
+ submit => [ '#form', { action => 'CustomVariableConfig/create'} ],
+ checks => [ 'check_prerequisites' ],
+ not_if => $is_new,
+ ],
+ ], # end of combobox "Save"
+
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => 'CustomVariableConfig/destroy' } ],
+ confirm => t8('Do you really want to delete this object?'),
+ disabled => $is_new ? t8('This object has not been saved yet.') : undef,
+ ],
+
+ 'separator',
+
+ link => [
+ t8('Abort'),
+ link => $self->url_for(action => 'list', module => $self->module),
+ ],
+ );
+ }
+}
+