From: Sven Schöling Date: Tue, 11 Jan 2011 14:37:17 +0000 (+0100) Subject: Kategorie bei Flash prüfen. X-Git-Tag: release-2.7.0beta2~5^2~12 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=aa7f51db81934e47ff7bac0a15cef97572d4c6f2;p=kivitendo-erp.git Kategorie bei Flash prüfen. --- diff --git a/SL/Helper/Flash.pm b/SL/Helper/Flash.pm index 78a94e34f..f55366c17 100644 --- a/SL/Helper/Flash.pm +++ b/SL/Helper/Flash.pm @@ -7,6 +7,11 @@ our @ISA = qw(Exporter); our @EXPORT = qw(flash flash_later); our @EXPORT_OK = qw(render_flash); +my %valid_categories = ( + map({$_ => 'info'} qw(information message)), + map({$_ => $_} qw(info error warning)), +); + # # public functions # @@ -29,8 +34,7 @@ sub render_flash { sub _store_flash { my $store = shift || { }; - my $category = shift; - $category = 'info' if $category eq 'information'; + my $category = _check_category(+shift); $store ||= { }; $store->{ $category } ||= [ ]; @@ -39,6 +43,12 @@ sub _store_flash { return $store; } +sub _check_category { + my ($c) = @_; + return $valid_categories{$c} + || die 'invalid category for flash'; +} + 1; __END__