--- /dev/null
+# TODO list helper functions
+
+package TODO;
+
+use SL::DBUtils;
+
+sub get_user_config {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ my $myconfig = \%main::myconfig;
+ my $form = $main::form;
+
+ my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+
+ $form->error('Need params: id or login') if (!$params{id} && !$params{login});
+
+ if ($params{login}) {
+ ($params{id}) = selectfirst_array_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $params{login});
+
+ if (!$params{id}) {
+ $main::lxdebug->leave_sub();
+ return ();
+ }
+
+ } else {
+ ($params{login}) = selectfirst_array_query($form, $dbh, qq|SELECT login FROM employee WHERE id = ?|, conv_i($params{id}));
+ }
+
+ my $cfg = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM todo_user_config WHERE employee_id = ?|, conv_i($params{id}));
+
+ if (!$cfg) {
+ # Standard configuration: enable all
+
+ $cfg = { map { $_ => 1 } qw(show_after_login show_follow_ups show_follow_ups_login show_overdue_sales_quotations show_overdue_sales_quotations_login) };
+ }
+
+ if (! $main::auth->check_right($params{login}, 'sales_quotation_edit')) {
+ map { delete $cfg->{$_} } qw(show_overdue_sales_quotations show_overdue_sales_quotations_login);
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return %{ $cfg };
+}
+
+sub save_user_config {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ Common::check_params(\%params, qw(login));
+
+ my $myconfig = \%main::myconfig;
+ my $form = $main::form;
+
+ my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+
+ my $query = qq|SELECT id FROM employee WHERE login = ?|;
+
+ my ($id) = selectfirst_array_query($form, $dbh, $query, $params{login});
+
+ if (!$id) {
+ $main::lxdebug->leave_sub();
+ return;
+ }
+
+ $query =
+ qq|SELECT show_after_login
+ FROM todo_user_config
+ WHERE employee_id = ?|;
+
+ if (! selectfirst_hashref_query($form, $dbh, $query, $id)) {
+ do_query($form, $dbh, qq|INSERT INTO todo_user_config (employee_id) VALUES (?)|, $id);
+ }
+
+ $query =
+ qq|UPDATE todo_user_config SET
+ show_after_login = ?,
+ show_follow_ups = ?,
+ show_follow_ups_login = ?,
+ show_overdue_sales_quotations = ?,
+ show_overdue_sales_quotations_login = ?
+
+ WHERE employee_id = ?|;
+
+ my @values = map { $params{$_} ? 't' : 'f' } qw(show_after_login show_follow_ups show_follow_ups_login show_overdue_sales_quotations show_overdue_sales_quotations_login);
+ push @values, $id;
+
+ do_query($form, $dbh, $query, @values);
+
+ $dbh->commit();
+
+ $main::lxdebug->leave_sub();
+}
+
+1;
use SL::User;
use SL::USTVA;
use SL::Iconv;
+use SL::TODO;
use CGI::Ajax;
use CGI;
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
$form->{"menustyle_$myconfig{menustyle}"} = 1;
$form->{CAN_CHANGE_PASSWORD} = $auth->can_change_password();
+ $form->{todo_cfg} = { TODO->get_user_config('login' => $form->{login}) };
$form->{title} = $locale->text('Edit Preferences for #1', $form->{login});
$form->{stylesheet} = $form->{usestylesheet};
+ TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } });
+
$form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, $webdav));
$form->error($locale->text('Cannot save preferences!'));
$locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode});
- $form->{todo_list} = create_todo_list();
+ $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list});
$form->{stylesheet} = $myconfig{stylesheet};
$form->{title} = $locale->text('About');
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#######################################################################
+use SL::TODO;
+
sub create_todo_list {
$lxdebug->enter_sub();
+ my %params = @_;
+ my $postfix = '_login' if ($params{login_screen});
+
+ my %todo_cfg = TODO->get_user_config('login' => $form->{login});
+
+ if ($params{login_screen} && !$todo_cfg{show_after_login}) {
+ $lxdebug->leave_sub();
+ return '';
+ }
+
my (@todo_items, $todo_list);
- push @todo_items, todo_list_follow_ups();
- push @todo_items, todo_list_overdue_sales_quotations();
+ push @todo_items, todo_list_follow_ups() if ($todo_cfg{"show_follow_ups${postfix}"});
+ push @todo_items, todo_list_overdue_sales_quotations() if ($todo_cfg{"show_overdue_sales_quotations${postfix}"});
@todo_items = grep { $_ } @todo_items;
$todo_list = join("", @todo_items);
'<%total%> -- Amount payable' => '<%total%> -- Noch zu bezahlender Betrag',
'<%total_wo_skonto%> -- Amount payable less discount' => '<%total_wo_skonto%> -- Noch zu bezahlender Betrag abzüglich Skonto',
'*/' => '*/',
+ '...after loggin in' => '...nach dem Anmelden',
'...done' => '...fertig',
+ '...on the TODO list' => '...auf der Aufgabenliste',
'1. Quarter' => '1. Quartal',
'2. Quarter' => '2. Quartal',
'3. Quarter' => '3. Quartal',
'Company' => 'Firma',
'Company Name' => 'Firmenname',
'Compare to' => 'Gegenüberstellen zu',
+ 'Configuration of individual TODO items' => 'Konfiguration für die einzelnen Aufgabenlistenpunkte',
'Confirm!' => 'Bestätigen Sie!',
'Confirmation' => 'Auftragsbestätigung',
'Contact' => 'Kontakt',
'Show TODO list' => 'Aufgabenliste anzeigen',
'Show by default' => 'Standardmäßig anzeigen',
'Show details' => 'Details anzeigen',
+ 'Show follow ups...' => 'Zeige Wiedervorlagen...',
'Show old dunnings' => 'Alte Mahnungen anzeigen',
+ 'Show overdue sales quotations...' => 'Zeige überfällige Angebote...',
+ 'Show your TODO list after loggin in' => 'Aufgabenliste nach dem Anmelden anzeigen',
'Signature' => 'Unterschrift',
'Skip' => 'Überspringen',
'Skonto' => 'Skonto',
'Superuser name' => 'Datenbankadministrator',
'System' => 'System',
'TODO list' => 'Aufgabenliste',
+ 'TODO list options' => 'Aufgabenlistenoptionen',
'TOP100' => 'Top 100',
'Tax' => 'Steuer',
'Tax Consultant' => 'Steuerberater/-in',
[Programm--Version]
module=login.pl
action=company_logo
+no_todo_list=1
#################################
--- /dev/null
+-- @tag: todo_config
+-- @description: Benutzerkonfiguration zur Aufgabenliste
+-- @depends: release_2_4_3
+
+CREATE TABLE todo_user_config (
+ employee_id integer NOT NULL,
+ show_after_login boolean DEFAULT TRUE,
+ show_follow_ups boolean DEFAULT TRUE,
+ show_follow_ups_login boolean DEFAULT TRUE,
+ show_overdue_sales_quotations boolean DEFAULT TRUE,
+ show_overdue_sales_quotations_login boolean DEFAULT TRUE,
+
+ FOREIGN KEY (employee_id) REFERENCES employee (id)
+);
<li class="selected"><a href="#" rel="page_personal_settings">Persönliche Einstellungen</a></li>
<li><a href="#" rel="page_display_options">Anzeigeoptionen</a></li>
<li><a href="#" rel="page_print_options">Druckoptionen</a></li>
+ <li><a href="#" rel="page_todo_list_options">Aufgabenlistenoptionen</a></li>
</ul>
<input type="hidden" name="type" value="preferences">
<br style="clear: left" />
</div>
+
+ <div id="page_todo_list_options" class="tabcontent">
+
+ <table>
+ <tr>
+ <th align="right">Aufgabenliste nach dem Anmelden anzeigen</th>
+ <td colspan="2">
+ <input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_1" value="1"[% IF todo_cfg.show_after_login %] checked[% END %]>
+ <label for="todo_cfg_show_after_login_1">Ja</label>
+ <input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_0" value="0"[% IF !todo_cfg.show_after_login %] checked[% END %]>
+ <label for="todo_cfg_show_after_login_0">Nein</label>
+ </td>
+ </tr>
+
+ <tr class="listheading">
+ <th colspan="3">Konfiguration für die einzelnen Aufgabenlistenpunkte</th>
+ </tr>
+
+ <tr>
+ <th align="right">Zeige Wiedervorlagen...</th>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_follow_ups" id="todo_cfg_show_follow_ups" value="1"[% IF todo_cfg.show_follow_ups %] checked[% END %]>
+ <label for="todo_cfg_show_follow_ups">...auf der Aufgabenliste</label>
+ </td>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_follow_ups_login" id="todo_cfg_show_follow_ups_login" value="1"[% IF todo_cfg.show_follow_ups_login %] checked[% END %]>
+ <label for="todo_cfg_show_follow_ups_login">...nach dem Anmelden</label>
+ </td>
+ </tr>
+
+ [%- IF AUTH_RIGHTS_SALES_QUOTATION_EDIT %]
+ <tr>
+ <th align="right">Zeige überfällige Angebote...</th>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_overdue_sales_quotations" id="todo_cfg_show_overdue_sales_quotations" value="1"[% IF todo_cfg.show_overdue_sales_quotations %] checked[% END %]>
+ <label for="todo_cfg_show_overdue_sales_quotations">...auf der Aufgabenliste</label>
+ </td>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_overdue_sales_quotations_login" id="todo_cfg_show_overdue_sales_quotations_login" value="1"[% IF todo_cfg.show_overdue_sales_quotations_login %] checked[% END %]>
+ <label for="todo_cfg_show_overdue_sales_quotations_login">...nach dem Anmelden</label>
+ </td>
+ </tr>
+ [%- END %]
+ </table>
+
+ <br style="clear: left" />
+ </div>
</div>
<p><input type="submit" class="submit" name="action" value="Speichern"></p>
<li class="selected"><a href="#" rel="page_personal_settings"><translate>Personal settings</translate></a></li>
<li><a href="#" rel="page_display_options"><translate>Display options</translate></a></li>
<li><a href="#" rel="page_print_options"><translate>Print options</translate></a></li>
+ <li><a href="#" rel="page_todo_list_options"><translate>TODO list options</translate></a></li>
</ul>
<input type="hidden" name="type" value="preferences">
<br style="clear: left" />
</div>
+
+ <div id="page_todo_list_options" class="tabcontent">
+
+ <table>
+ <tr>
+ <th align="right"><translate>Show your TODO list after loggin in</translate></th>
+ <td colspan="2">
+ <input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_1" value="1"[% IF todo_cfg.show_after_login %] checked[% END %]>
+ <label for="todo_cfg_show_after_login_1"><translate>Yes</translate></label>
+ <input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_0" value="0"[% IF !todo_cfg.show_after_login %] checked[% END %]>
+ <label for="todo_cfg_show_after_login_0"><translate>No</translate></label>
+ </td>
+ </tr>
+
+ <tr class="listheading">
+ <th colspan="3"><translate>Configuration of individual TODO items</translate></th>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Show follow ups...</translate></th>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_follow_ups" id="todo_cfg_show_follow_ups" value="1"[% IF todo_cfg.show_follow_ups %] checked[% END %]>
+ <label for="todo_cfg_show_follow_ups"><translate>...on the TODO list</translate></label>
+ </td>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_follow_ups_login" id="todo_cfg_show_follow_ups_login" value="1"[% IF todo_cfg.show_follow_ups_login %] checked[% END %]>
+ <label for="todo_cfg_show_follow_ups_login"><translate>...after loggin in</translate></label>
+ </td>
+ </tr>
+
+ [%- IF AUTH_RIGHTS_SALES_QUOTATION_EDIT %]
+ <tr>
+ <th align="right"><translate>Show overdue sales quotations...</translate></th>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_overdue_sales_quotations" id="todo_cfg_show_overdue_sales_quotations" value="1"[% IF todo_cfg.show_overdue_sales_quotations %] checked[% END %]>
+ <label for="todo_cfg_show_overdue_sales_quotations"><translate>...on the TODO list</translate></label>
+ </td>
+ <td>
+ <input type="checkbox" name="todo_cfg.show_overdue_sales_quotations_login" id="todo_cfg_show_overdue_sales_quotations_login" value="1"[% IF todo_cfg.show_overdue_sales_quotations_login %] checked[% END %]>
+ <label for="todo_cfg_show_overdue_sales_quotations_login"><translate>...after loggin in</translate></label>
+ </td>
+ </tr>
+ [%- END %]
+ </table>
+
+ <br style="clear: left" />
+ </div>
</div>
<p><input type="submit" class="submit" name="action" value="<translate>Save</translate>"></p>