login nicht aus $::form nehmen. Teil 1
[kivitendo-erp.git] / bin / mozilla / todo.pl
1 #=====================================================================
2 # LX-Office ERP
3 # Copyright (C) 2004
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #
7 ######################################################################
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
10 #
11 #  Author: Dieter Simader
12 #   Email: dsimader@sql-ledger.org
13 #     Web: http://www.sql-ledger.org
14 #
15 #
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #######################################################################
29
30 use SL::TODO;
31
32 use strict;
33
34 sub create_todo_list {
35   $main::lxdebug->enter_sub();
36
37   $main::auth->assert('productivity');
38
39   my $form     = $main::form;
40
41   my %params   = @_;
42   my $postfix  = $params{login_screen} ? '_login' : '';
43
44   my %todo_cfg = TODO->get_user_config('login' => $::myconfig{login});
45
46   if ($params{login_screen} && !$todo_cfg{show_after_login}) {
47     $main::lxdebug->leave_sub();
48     return '';
49   }
50
51   my (@todo_items, $todo_list);
52
53   push @todo_items, todo_list_follow_ups()               if ($todo_cfg{"show_follow_ups${postfix}"});
54   push @todo_items, todo_list_overdue_sales_quotations() if ($todo_cfg{"show_overdue_sales_quotations${postfix}"});
55
56   @todo_items = grep { $_ } @todo_items;
57   $todo_list  = join("", @todo_items);
58
59   $main::lxdebug->leave_sub();
60
61   return $todo_list;
62 }
63
64 sub show_todo_list {
65   $main::lxdebug->enter_sub();
66
67   $main::auth->assert('productivity');
68
69   my $form     = $main::form;
70   my $locale   = $main::locale;
71
72   $form->{todo_list} = create_todo_list();
73   $form->{title}     = $locale->text('TODO list');
74
75   $form->header();
76   print $form->parse_html_template('todo/show_todo_list');
77
78   $main::lxdebug->leave_sub();
79 }
80
81 sub todo_list_follow_ups {
82   $main::lxdebug->enter_sub();
83
84   $main::auth->assert('productivity');
85
86   require "bin/mozilla/fu.pl";
87
88   my $content = report_for_todo_list();
89
90   $main::lxdebug->leave_sub();
91
92   return $content;
93 }
94
95 sub todo_list_overdue_sales_quotations {
96   $main::lxdebug->enter_sub();
97
98   $main::auth->assert('productivity');
99
100   require "bin/mozilla/oe.pl";
101
102   my $content = report_for_todo_list();
103
104   $main::lxdebug->leave_sub();
105
106   return $content;
107 }
108
109 1;