[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4911] trunk
- Subject: SF.net SVN: ledger-smb:[4911] trunk
- From: ..hidden..
- Date: Mon, 18 Jun 2012 11:58:25 +0000
Revision: 4911
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4911&view=rev
Author: einhverfr
Date: 2012-06-18 11:58:25 +0000 (Mon, 18 Jun 2012)
Log Message:
-----------
Moving settings to new framework
Modified Paths:
--------------
trunk/LedgerSMB/Setting.pm
trunk/sql/modules/Settings.sql
Added Paths:
-----------
trunk/configuration.pl
Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm 2012-06-18 10:19:16 UTC (rev 4910)
+++ trunk/LedgerSMB/Setting.pm 2012-06-18 11:58:25 UTC (rev 4911)
@@ -53,11 +53,10 @@
sub get {
my $self = shift;
my ($key) = @_;
- if ($key){
- $self->{key} = $key;
- }
- my ($hashref) = $self->exec_method( funcname => 'setting_get' ) ;
- $self->{value} = $hashref->{value};
+ $key ||= $self->{key};
+ my ($hashref) = $self->call_procedure( procname => 'setting_get',
+ args => [$key]) ;
+ $self->{value} = $hashref->{value} if $self->{key};
return $self->{value};
}
@@ -65,13 +64,16 @@
my $self = shift;
my $myconfig = shift;
+ my $key = shift;
+ $key ||= $self->{key};
# Long-run, we may want to run this via Parse::RecDescent, but this is
# at least a start for here. Chris T.
# Replaces Form::UpdateDefaults
- my ($retval) = $self->exec_method('funcname' => 'setting_increment');
+ my ($retval) = $self->call_procedure(procname => 'setting_increment',
+ args => [$key]) ;
my $value = $retval->{setting_increment};
# check for and replace
# <?lsmb DATE ?>, <?lsmb YYMMDD ?>, <?lsmb YEAR ?>, <?lsmb MONTH ?>, <?lsmb DAY ?> or variations of
@@ -160,7 +162,7 @@
}
}
- $self->{value} = $var;
+ $self->{value} = $var if $self->{key};
$var;
}
@@ -170,4 +172,18 @@
@{$self->{currencies}} = $self->_parse_array($data[0]->{setting__get_currencies});
return @{$self->{currencies}};
}
-
+
+sub set {
+ my ($self, $key, $value) = @_;
+ $key ||= $self->{key};
+ $value ||= $self->{value};
+ $self->call_procedure(procname => 'setting__set',
+ args => [$key, $value]);
+}
+
+sub accounts_by_link {
+ my ($self, $link) = @_;
+ @results = $self->call_procedure(procname => 'account__get_by_link_desc',
+ args => [$link]);
+ return ..hidden..;
+}
Copied: trunk/configuration.pl (from rev 4904, trunk/employee.pl)
===================================================================
--- trunk/configuration.pl (rev 0)
+++ trunk/configuration.pl 2012-06-18 11:58:25 UTC (rev 4911)
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+
+use FindBin;
+BEGIN {
+ lib->import($FindBin::Bin) unless $ENV{mod_perl}
+}
+require "lsmb-request.pl";
Modified: trunk/sql/modules/Settings.sql
===================================================================
--- trunk/sql/modules/Settings.sql 2012-06-18 10:19:16 UTC (rev 4910)
+++ trunk/sql/modules/Settings.sql 2012-06-18 11:58:25 UTC (rev 4911)
@@ -6,7 +6,7 @@
-- Docstrings already added to this file.
-CREATE OR REPLACE FUNCTION setting_set (in_key varchar, in_value varchar)
+CREATE OR REPLACE FUNCTION setting__set (in_key varchar, in_value varchar)
RETURNS BOOL AS
$$
BEGIN
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.