diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-20 23:36:58 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-20 23:36:58 +0000 |
commit | dd16b8f2a8bf2ae3f41e9c901a474be2de33df24 (patch) | |
tree | 348e874cbb42005f13922dc5564437a9a7edc1e6 | |
parent | f8c886e6c14a09e7e21be08706342a1927b78b96 (diff) |
Add a form function to just extract the language list
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1800 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | LedgerSMB/Form.pm | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 5cc3b258..7cceffea 100644 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -61,7 +61,6 @@ use strict; use Math::BigFloat lib => 'GMP'; use LedgerSMB::Sysconfig; use List::Util qw(first); -use LedgerSMB::Mailer; use Time::Local; use Cwd; use File::Copy; @@ -2024,6 +2023,36 @@ sub all_departments { $self->all_years($myconfig); } +=item $form->all_languages($myconfig); + +Set $form->{all_language} to be a reference to a list of hashrefs describing +languages using the form {'code' => code, 'description' => description}. + +=cut + +sub all_languages { + + my ( $self ) = @_; + + my $dbh = $self->{dbh}; + + my $query = qq| + SELECT code, description + FROM language + ORDER BY description|; + + my $sth = $dbh->prepare($query); + $sth->execute || $self->dberror($query); + + $self->{all_language} = []; + + while ( my $ref = $sth->fetchrow_hashref('NAME_lc') ) { + push @{ $self->{all_language} }, $ref; + } + + $sth->finish; +} + =item $form->all_years($myconfig[, $dbh2]); Populates the hash $form->{all_month} with a mapping between a two-digit month @@ -3529,6 +3558,3 @@ sub audittrail { =back - - - |