521 |
521 |
# Permissions:
|
522 |
522 |
# - Always return invoices & AR transactions for projects the employee has "view invoices" permissions for, no matter what the other rules say.
|
523 |
523 |
# - Exclude AR transactions if no permissions for them exist.
|
524 |
|
# - Limit to own invoices unless may edit all invoices.
|
525 |
|
# - If may edit all, allow filtering by employee/salesman.
|
|
524 |
# - Limit to own invoices unless may edit all invoices or view invoices is allowed.
|
|
525 |
# - If may edit all or view invoices is allowed, allow filtering by employee/salesman.
|
526 |
526 |
my (@permission_where, @permission_values);
|
527 |
527 |
|
528 |
|
if ($::auth->assert('invoice_edit', 1)) {
|
|
528 |
if ($::auth->assert('invoice_edit', 1) || $::auth->assert('sales_invoice_view', 1)) {
|
529 |
529 |
if (!$::auth->assert('show_ar_transactions', 1) ) {
|
530 |
530 |
push @permission_where, "NOT invoice = 'f'"; # remove ar transactions from Sales -> Reports -> Invoices
|
531 |
531 |
}
|
532 |
532 |
|
533 |
|
if (!$::auth->assert('sales_all_edit', 1)) {
|
|
533 |
if (!$::auth->assert('sales_all_edit', 1) && !$::auth->assert('sales_invoice_view', 1)) {
|
534 |
534 |
# only show own invoices
|
535 |
535 |
push @permission_where, "a.employee_id = ?";
|
536 |
536 |
push @permission_values, SL::DB::Manager::Employee->current->id;
|
... | ... | |
547 |
547 |
}
|
548 |
548 |
}
|
549 |
549 |
|
550 |
|
if (@permission_where || !$::auth->assert('invoice_edit', 1)) {
|
|
550 |
if (@permission_where || (!$::auth->assert('invoice_edit', 1) && !$::auth->assert('sales_invoice_view', 1))) {
|
551 |
551 |
my $permission_where_str = @permission_where ? "OR (" . join(" AND ", map { "($_)" } @permission_where) . ")" : "";
|
552 |
552 |
$where .= qq|
|
553 |
553 |
AND ( (a.globalproject_id IN (
|
Recht: Ansehen von Verkaufsrechnungen berücksichtigen