From dd16b8f2a8bf2ae3f41e9c901a474be2de33df24 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sat, 20 Oct 2007 23:36:58 +0000 Subject: 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 --- LedgerSMB/Form.pm | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'LedgerSMB') 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 - - - -- cgit v1.2.3