[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1800] trunk/LedgerSMB/Form.pm



Revision: 1800
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1800&view=rev
Author:   tetragon
Date:     2007-10-20 16:36:58 -0700 (Sat, 20 Oct 2007)

Log Message:
-----------
Add a form function to just extract the language list

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-10-20 23:34:56 UTC (rev 1799)
+++ trunk/LedgerSMB/Form.pm	2007-10-20 23:36:58 UTC (rev 1800)
@@ -61,7 +61,6 @@
 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 @@
     $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 @@
 =back
 
 
-
-
-


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.