]> wagnertech.de Git - mfinanz.git/blob - SL/InstanceState.pm
Merge branch 'master' of http://wagnertech.de/git/mfinanz
[mfinanz.git] / SL / InstanceState.pm
1 package SL::InstanceState;
2
3 use strict;
4
5 use SL::DB::Manager::Employee;
6
7 use parent qw(Rose::Object);
8
9
10 sub has_employee_project_invoices {
11   SL::DB::Manager::Employee->current && @{SL::DB::Manager::Employee->current->project_invoice_permissions};
12 }
13
14
15 1;
16
17 __END__
18
19 =pod
20
21 =encoding utf8
22
23 =head1 NAME
24
25 SL::InstanceState - Provides instance-specific status information
26
27 =head1 SYNOPSIS
28
29 While instance configuration settings are provided via C<SL::InstanceConf>,
30 this module provides non-configuration information of the instance.
31
32 The intention is to use the state information in the menu, e.g. to enable
33 or disable some menu entries if some condition is met.
34
35 Example: If a user has no right to see invoices, the menu entry for this report
36 was shown anyway, because the user may has the right to access project invoices.
37 Now, the display of the menu entry can be made dependent on the status.
38 See C<SL::Menu>.
39
40 =head1 FUNCTIONS
41
42 =over 4
43
44 =item C<has_employee_project_invoices>
45
46 Returns trueish if the current employee has the right to access
47 some project invoices.
48
49 =back
50
51 =head1 TODO
52
53 As for now, no global instance of this class is provided. If this information
54 should be used in e.g. templates or some other programm code, then a global
55 instance may should be provided.
56
57 =head1 BUGS
58
59 none so far
60
61 =head1 AUTHOR
62
63 Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
64
65 =cut