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

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



Revision: 1443
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1443&view=rev
Author:   tetragon
Date:     2007-07-26 13:42:18 -0700 (Thu, 26 Jul 2007)

Log Message:
-----------
Fix typo that stopped non-default currency order->invoice conversion to fail
Add more Pod to Form.pm

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

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-07-26 20:27:16 UTC (rev 1442)
+++ trunk/LedgerSMB/Form.pm	2007-07-26 20:42:18 UTC (rev 1443)
@@ -1071,6 +1071,15 @@
 
 # Database routines used throughout
 
+=item $form->db_init($myconfig);
+
+Connect to the database that $myconfig is set to use and initialise the base
+parameters.  The connection handle becomes $form->{dbh} and
+$form->{custom_db_fields} is populated.  The connection initiated has
+autocommit disabled.
+
+=cut
+
 sub db_init {
     my ( $self, $myconfig ) = @_;
     $self->{dbh} = $self->dbconnect_noauto($myconfig) || $self->dberror();
@@ -1198,6 +1207,12 @@
     @rc;
 }
 
+=item $form->dbconnect($myconfig);
+
+Returns an autocommit connection to the database specified in $myconfig.
+
+=cut
+
 sub dbconnect {
 
     my ( $self, $myconfig ) = @_;
@@ -1217,6 +1232,12 @@
     $dbh;
 }
 
+=item $form->dbconnect_noauto($myconfig);
+
+Returns a non-autocommit connection to the database specified in $myconfig.
+
+=cut
+
 sub dbconnect_noauto {
 
     my ( $self, $myconfig ) = @_;
@@ -1278,6 +1299,16 @@
     }
 }
 
+=item $form->update_exchangerate($dbh, $curr, $transdate, $buy, $sell);
+
+Updates the exchange rates $buy and $sell for the given $currency on $transdate.
+If there is not yet an exchange rate for $currency on $transdate, an entry is
+inserted.  This returns without doing anything if $curr eq ''.
+
+$dbh is not used, favouring $self->{dbh}.
+
+=cut
+
 sub update_exchangerate {
 
     my ( $self, $dbh, $curr, $transdate, $buy, $sell ) = @_;
@@ -1336,6 +1367,16 @@
 
 }
 
+=item $form->save_exchangerate($myconfig, $currency, $transdate, $rate, $fld);
+
+Saves the exchange rate $rate for the given $currency on $transdate for the
+provided purpose in $fld.  $fld can be either 'buy' or 'sell'.
+
+$myconfig is not used.  $self->update_exchangerate is used for the majority of
+the work.
+
+=cut
+
 sub save_exchangerate {
 
     my ( $self, $myconfig, $currency, $transdate, $rate, $fld ) = @_;
@@ -1349,6 +1390,16 @@
 
 }
 
+=item $form->get_exchangerate($dbh, $curr, $transdate, $fld);
+
+Returns the exchange rate in relation to the default currency for $currency on
+$transdate for the purpose indicated by $fld.  $fld can be either 'buy' or
+'sell' to get usable results.
+
+$dbh is not used, favouring $self->{dbh}.
+
+=cut
+
 sub get_exchangerate {
 
     my ( $self, $dbh, $curr, $transdate, $fld ) = @_;
@@ -1370,6 +1421,16 @@
     $exchangerate;
 }
 
+=item $form->check_exchangerate($myconfig, $currency, $transdate, $fld);
+
+Returns some true value when an entry for $currency on $transdate is true for
+the purpose indicated by $fld.  $fld can be either 'buy' or 'sell' to get
+usable results.  Returns false if $transdate is not set.
+
+$myconfig is not used.
+
+=cut
+
 sub check_exchangerate {
 
     my ( $self, $myconfig, $currency, $transdate, $fld ) = @_;
@@ -1382,7 +1443,7 @@
 		WHERE curr = ? AND transdate = ?|;
 
     my $sth = $self->{dbh}->prepare($query);
-    $sth->execute( $currenct, $transdate );
+    $sth->execute( $currency, $transdate );
     my ($exchangerate) = $sth->fetchrow_array;
 
     $sth->finish;


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