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

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



Revision: 6422
          http://sourceforge.net/p/ledger-smb/code/6422
Author:   einhverfr
Date:     2014-01-08 07:03:25 +0000 (Wed, 08 Jan 2014)
Log Message:
-----------
Fixing Company->get_metadata() and Setting->get() so that they work better with addons

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/DBObject/Company.pm
    branches/1.3/LedgerSMB/Setting.pm

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2014-01-08 07:00:07 UTC (rev 6421)
+++ branches/1.3/Changelog	2014-01-08 07:03:25 UTC (rev 6422)
@@ -12,6 +12,7 @@
 * Fixing manually entered tax amounts ignored printing invoice (Chris T, 864)
 * Fixing deleting gl draft via gl screen fails (Chris T, 871)
 * Fixing receipts listing "to pay" for amount (Chris T, 892)
+* Setting->get() now works with named keys (Chris T)
 
 Chris T is Chris Travers
 Nick P is Nick Prater

Modified: branches/1.3/LedgerSMB/DBObject/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Company.pm	2014-01-08 07:00:07 UTC (rev 6421)
+++ branches/1.3/LedgerSMB/DBObject/Company.pm	2014-01-08 07:03:25 UTC (rev 6422)
@@ -443,13 +443,8 @@
     @{$self->{contact_class_list}} = 
          $self->exec_method(funcname => 'entity_list_contact_class');
     #HV was $country_setting , given it a more general name, not only for country
-    my $setting_module = LedgerSMB::Setting->new({base => $self, copy => 'base'});
-    $setting_module->{key} = 'default_country';
-    $setting_module->get;
-    $self->{default_country} = $setting_module->{value};
-    $setting_module->{key} = 'default_language';
-    $setting_module->get;
-    $self->{default_language} = $setting_module->{value};
+    $self->{default_country} = LedgerSMB::Setting->get('default_country');
+    $self->{default_language} = LedgerSMB::Setting->get('default_language');
 }
 
 =item save_contact

Modified: branches/1.3/LedgerSMB/Setting.pm
===================================================================
--- branches/1.3/LedgerSMB/Setting.pm	2014-01-08 07:00:07 UTC (rev 6421)
+++ branches/1.3/LedgerSMB/Setting.pm	2014-01-08 07:03:25 UTC (rev 6422)
@@ -53,12 +53,13 @@
 sub get {
     my $self = shift;
     my ($key) = @_;
-    if ($key){
-        $self->{key} = $key;
-    }
-    my ($hashref) = $self->exec_method( funcname => 'setting_get' ) ;
-    $self->{value} = $hashref->{value};
-    return $self->{value};
+    $key = $self->{key} unless $key;
+    my ($hashref) = __PACKAGE__->call_procedure( procname => 'setting_get' ,
+                                                  args => [$key]) ;
+    warn 'breakpoint';
+    $self->{value} = $hashref->{value} if ref $self;
+    warn 'breakpoint';
+    return $hashref->{value};
 }
 
 sub increment {

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


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits