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

SF.net SVN: ledger-smb:[3983] branches/1.3



Revision: 3983
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3983&view=rev
Author:   einhverfr
Date:     2011-11-11 08:05:07 +0000 (Fri, 11 Nov 2011)
Log Message:
-----------
Clearing up currency not found errors when generating sales orders

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/DBObject/Company.pm
    branches/1.3/LedgerSMB/PE.pm
    branches/1.3/UI/Contact/contact.html

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-11-11 06:40:34 UTC (rev 3982)
+++ branches/1.3/Changelog	2011-11-11 08:05:07 UTC (rev 3983)
@@ -11,6 +11,8 @@
 * Correcting warnings about HOME not set (Chris T)
 * Corrected debian-specific db creation issue (Pongracz I)
 * Corrected company name representation in timecard->sales order (Chris T)
+* Better error handling when currency not set (Chris T)
+* Exposed adding currency for customer/vendor to UI (Chris T)
 
 Chris T is Chris Travers
 Erik H is Erik Huelsmann

Modified: branches/1.3/LedgerSMB/DBObject/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Company.pm	2011-11-11 06:40:34 UTC (rev 3982)
+++ branches/1.3/LedgerSMB/DBObject/Company.pm	2011-11-11 08:05:07 UTC (rev 3983)
@@ -427,6 +427,14 @@
     @{$self->{country_list}} = 
          $self->exec_method(funcname => 'location_list_country');
 
+    ($self->{all_currencies}) =
+         $self->exec_method(funcname => 'setting__get_currencies');
+    $self->{all_currencies} = $self->{all_currencies}->{setting__get_currencies};
+
+    for my $curr (@{$self->{all_currencies}}){
+        $curr = { text => $curr };
+    }
+
     @{$self->{contact_class_list}} = 
          $self->exec_method(funcname => 'entity_list_contact_class');
     my $country_setting = LedgerSMB::Setting->new({base => $self, copy => 'base'});

Modified: branches/1.3/LedgerSMB/PE.pm
===================================================================
--- branches/1.3/LedgerSMB/PE.pm	2011-11-11 06:40:34 UTC (rev 3982)
+++ branches/1.3/LedgerSMB/PE.pm	2011-11-11 08:05:07 UTC (rev 3983)
@@ -1722,9 +1722,10 @@
     my $dbh   = $form->{dbh};
     my $query = qq|SELECT curr FROM entity_credit_account WHERE id = ?|;
     my $sth   = $dbh->prepare($query) || $form->dberror($query);
-    $sth->execute( $form->{customer_id} ) || $form->dberror($query);
-    my ($curr) = $sth->fetchrow_array || $form->dberror($query);
+    $sth->execute( $form->{customer_id} );# || $form->dberror($query);
+    my ($curr) = $sth->fetchrow_array;# || $form->dberror($query);
     $form->{currency} = $curr;
+    $curr || $form->error('No currency found');
 }
 
 =item PE::project_sales_order("", $myconfig, $form)

Modified: branches/1.3/UI/Contact/contact.html
===================================================================
--- branches/1.3/UI/Contact/contact.html	2011-11-11 06:40:34 UTC (rev 3982)
+++ branches/1.3/UI/Contact/contact.html	2011-11-11 08:05:07 UTC (rev 3983)
@@ -585,6 +585,15 @@
 			label = text('Taxforms') 
 			} ?> 
 	  </td>
+          <td> <?lsmb INCLUDE select element_data = {
+                        name = 'curr'
+                        options = all_currencies
+                        text_attr = 'text'
+                        value_attr = 'text'
+                        default_values = [curr]
+                        label = text('Currency')
+               } ?>
+           </td>
 
         </tr>
 

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