-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::Employee;
use strict;
use SL::DB::MetaSetup::Employee;
+use SL::DB::Manager::Employee;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
1;
--- /dev/null
+package SL::DB::Manager::Employee;
+
+use strict;
+
+use SL::DB::Helpers::Manager;
+use base qw(SL::DB::Helpers::Manager);
+
+sub object_class { 'SL::DB::Employee' }
+
+__PACKAGE__->make_manager_methods;
+
+sub current {
+ return undef unless $::form && $::form->{login};
+ return shift->find_by(login => $::form->{login});
+}
+
+1;
$::auth->set_session_value('login', $::form->{login}, 'password', $::form->{password});
$::auth->create_or_refresh_session;
+ $::auth->delete_session_value('FLASH')->save_session();
delete $::form->{password};
if ($action) {
--- /dev/null
+package SL::Helper::Flash;
+
+use strict;
+
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(flash flash_later);
+our @EXPORT_OK = qw(render_flash);
+
+#
+# public functions
+#
+
+sub flash {
+ $::form->{FLASH} = _store_flash($::form->{FLASH}, @_);
+}
+
+sub flash_later {
+ $::auth->set_session_value(FLASH => _store_flash($::auth->get_session_value('FLASH'), @_))->save_session();
+}
+
+sub render_flash {
+ return $::form->parse_html_template('common/flash');
+}
+
+#
+# private functions
+#
+
+sub _store_flash {
+ my $store = shift || { };
+ my $category = shift;
+ $category = 'info' if $category eq 'information';
+
+ $store ||= { };
+ $store->{ $category } ||= [ ];
+ push @{ $store->{ $category } }, @_;
+
+ return $store;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+SL::Helpers::Flash - helper functions for storing messages to be
+displayed to the user
+
+=head1 SYNOPSIS
+
+The flash is a store for messages that should be displayed to the
+user. Each message has a category which is usually C<information>,
+C<warning> or C<error>. The messages in each category are grouped and
+displayed in colors appropriate for their severity (e.g. errors in
+red).
+
+Messages are rendered either by calling the function C<render_flash>
+or by including the flash sub-template from a template with the
+following code:
+
+ [%- INCLUDE 'common/flash.html' %]
+
+=head1 EXPORTS
+
+The functions L</flash> and L</flash_later> are always exported.
+
+The function L</render_flash> is only exported upon request.
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item C<flash $category, @messages>
+
+Stores messages for the given category. The category can be either
+C<information>, C<warning> or C<error>. C<info> can also be used as an
+alias for C<information>.
+
+=item C<flash_later $category, @messages>
+
+Stores messages for the given category for the next request. The
+category can be either C<information>, C<warning> or C<error>. C<info>
+can also be used as an alias for C<information>.
+
+The messages are stored in the user's session and restored upon the
+next request. Can be used for transmitting information over HTTP
+redirects.
+
+=item C<render_flash>
+
+Outputs the flash message by parsing the C<common/flash.html> template
+file.
+
+This function is not exported by default.
+
+=back
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
$form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1;
$form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1;
-
+
$form->{"lastcost_$i"} = $form->parse_amount($myconfig, $form->{"lastcost_$i"});
# set values to 0 if nothing entered
use SL::DBUtils;
use SL::Form;
use SL::MoreCommon;
+use SL::Helper::Flash;
use strict;
height:0;
visibility:hidden;
}
+
+.flash_message_error {
+ background-color:#FFD6D6;
+ border: 1px solid #AE0014;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ padding: 5px;
+}
+
+.flash_message_warning {
+ background-color:#FFE8C7;
+ border: 1px solid #FF6600;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ padding: 5px;
+}
+
+.flash_message_info {
+ background-color:#DCF2FF;
+ border: 1px solid #4690FF;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ padding: 5px;
+}
'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung',
'Warehouse saved.' => 'Lager gespeichert.',
'Warehouses' => 'Lager',
+ 'Warning' => 'Warnung',
'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen',
'WebDAV link' => 'WebDAV-Link',
'Weight' => 'Gewicht',
--- /dev/null
+[%- USE HTML -%][%- USE LxERP %]
+[%- IF FLASH %]
+ [%- BLOCK output %]
+ <div class="flash_message_[% type %]">
+ [%- title %]:
+ [% FOREACH message = messages %]
+ [%- HTML.escape(message) %]
+ [%- UNLESS loop.last %]<br>[% END %]
+ [%- END %]
+ </div>
+ [%- END %]
+ [%- IF FLASH.error && FLASH.error.size %]
+ [%- PROCESS output title=LxERP.t8('Error') type='error' messages = FLASH.error %]
+ [%- END %]
+ [%- IF FLASH.warning && FLASH.warning.size %]
+ [%- PROCESS output title=LxERP.t8('Warning') type='warning' messages = FLASH.warning %]
+ [%- END %]
+ [%- IF FLASH.info && FLASH.info.size %]
+ [%- PROCESS output title=LxERP.t8('Information') type='info' messages = FLASH.info %]
+ [%- END %]
+[%- END %]
<div class="listtop">[% title %]</div>
+[%- INCLUDE 'common/flash.html' %]
+
[%- IF ERRORS && ERRORS.size %]
<p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
[%- END %]
<p><div class="listtop" width="100%">[% title %]</div></p>
+[%- INCLUDE 'common/flash.html' %]
+
<table width="100%">
<tr>
<td valign="top">
<p>[% saved_message %]</p>
+[%- INCLUDE 'common/flash.html' %]
+
<table width="100%">
<tr>
<td valign="top">
<div class="listtop">[% title %]</div>
+[%- INCLUDE 'common/flash.html' %]
+
<table width="100%">
<tr height="5"></tr>
<tr>