["part_service_assembly_details", $locale->text("Show details and reports of parts, services, assemblies")],
["project_edit", $locale->text("Create and edit projects")],
["--ar", $locale->text("AR")],
+ ["requirement_spec_edit", $locale->text("Create and edit requirement specs")],
["sales_quotation_edit", $locale->text("Create and edit sales quotations")],
["sales_order_edit", $locale->text("Create and edit sales orders")],
["sales_delivery_order_edit", $locale->text("Create and edit sales delivery orders")],
Nothing here yet.
=head1 AUTHOR
-
+pp
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
=cut
sub setup {
my ($self) = @_;
- $::auth->assert('sales_quotation_edit');
+ $::auth->assert('requirement_spec_edit');
$::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
$::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery);
$self->init_visible_section;
sub check_auth {
my ($self) = @_;
- $::auth->assert('sales_quotation_edit');
+ $::auth->assert('requirement_spec_edit');
}
sub load_requirement_spec_item {
sub action_create {
my ($self) = @_;
+ if (!$::auth->assert($::form->{quotation} ? 'sales_quotation_edit' : 'sales_order_edit', 1)) {
+ return $self->js->flash('error', t8("You do not have the permissions to access this function."))->render($self);
+ }
+
# 1. Update sections with selected part IDs.
my $section_attrs = $::form->{sections} || [];
my $sections = SL::DB::Manager::RequirementSpecItem->get_all(where => [ id => [ map { $_->{id} } @{ $section_attrs } ] ]);
my $order = $self->rs_order->order;
my $sections = $self->requirement_spec->sections_sorted;
+ if (!$::auth->assert($order->quotation ? 'sales_quotation_edit' : 'sales_order_edit', 1)) {
+ return $self->js->flash('error', t8("You do not have the permissions to access this function."))->render($self);
+ }
+
my (@orderitems, %sections_seen);
foreach my $item (@{ $order->items_sorted }) {
my $section = first { my $num = $_->fb_number; $item->description =~ m{\b\Q${num}\E\b} && !$sections_seen{ $_->id } } @{ $sections };
sub setup {
my ($self) = @_;
- $::auth->assert('sales_quotation_edit');
+ $::auth->assert('requirement_spec_edit');
$::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec autocomplete_part);
$::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu client_js requirement_spec);
'scalar --get_set_init' => [ qw(predefined_texts js picture) ],
);
+__PACKAGE__->run_before('check_auth');
__PACKAGE__->run_before('load_requirement_spec_text_block', only => [qw(ajax_edit ajax_update ajax_delete ajax_flag dragged_and_dropped ajax_copy ajax_add_picture)]);
#
# filters
#
+sub check_auth {
+ my ($self) = @_;
+ $::auth->assert('requirement_spec_edit');
+}
+
sub load_requirement_spec_text_block {
my ($self) = @_;
$self->text_block(SL::DB::RequirementSpecTextBlock->new(id => $::form->{id})->load || die "No such requirement spec text block");
sub check_auth {
my ($self, %params) = @_;
- $::auth->assert('sales_quotation_edit');
+ $::auth->assert('requirement_spec_edit');
}
#
'Create and edit projects' => 'Projekte erfassen und bearbeiten',
'Create and edit purchase delivery orders' => 'Lieferscheine von Lieferanten erfassen und bearbeiten',
'Create and edit purchase orders' => 'Lieferantenaufträge erfassen und bearbeiten',
+ 'Create and edit requirement specs' => 'Pflichtenhefte erstellen und bearbeiten',
'Create and edit sales delivery orders' => 'Lieferscheine für Kunden erfassen und bearbeiten',
'Create and edit sales orders' => 'Auftragsbestätigungen erfassen und bearbeiten',
'Create and edit sales quotations' => 'Angebote erfassen und bearbeiten',
'You cannot create an invoice for delivery orders for different customers.' => 'Sie können keine Rechnung zu Lieferscheinen für verschiedene Kunden erstellen.',
'You cannot create an invoice for delivery orders from different vendors.' => 'Sie können keine Rechnung aus Lieferscheinen von verschiedenen Lieferanten erstellen.',
'You cannot paste function blocks or sub function blocks if there is no section.' => 'Sie können keine Funktionsblöcke oder Unterfunktionsblöcke einfügen, wenn es noch keinen Abschnitt gibt.',
- 'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.',
+ 'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.',
'You have entered or selected the following shipping address for this customer:' => 'Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:',
'You have never worked with currencies.' => 'Sie haben noch nie mit Währungen gearbeitet.',
'You have not added bank accounts yet.' => 'Sie haben noch keine Bankkonten angelegt.',
action=Project/new
[Master Data--Add Requirement Spec Template]
-ACCESS=project_edit
+ACCESS=requirement_spec_edit
module=controller.pl
action=RequirementSpec/new
is_template=1
filter.valid=valid
[Master Data--Reports--Requirement Spec Templates]
+ACCESS=requirement_spec_edit
module=controller.pl
action=RequirementSpec/list
is_template=1
[AR]
[AR--Add Requirement Spec]
+ACCESS=requirement_spec_edit
module=controller.pl
action=RequirementSpec/new
submenu=1
[AR--Reports--Requirement Specs]
+ACCESS=requirement_spec_edit
module=controller.pl
action=RequirementSpec/list
--- /dev/null
+# @tag: requirement_spec_rights
+# @description: Neues Gruppenrecht für Pflichtenhefte
+# @depends: release_3_0_0
+package SL::DBUpgrade2::requirement_spec_rights;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::DBUtils;
+
+sub run {
+ my ($self) = @_;
+
+ my $groups = $::auth->read_groups;
+
+ foreach my $group (values %{$groups}) {
+ $group->{rights}->{requirement_spec_edit} = $group->{rights}->{sales_quotation_edit} ? 1 : 0;
+ $::auth->save_group($group);
+ }
+
+ return 1;
+}
+
+1;