[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6153] trunk
- Subject: SF.net SVN: ledger-smb:[6153] trunk
- From: ..hidden..
- Date: Wed, 23 Oct 2013 06:40:56 +0000
Revision: 6153
http://sourceforge.net/p/ledger-smb/code/6153
Author: einhverfr
Date: 2013-10-23 06:40:56 +0000 (Wed, 23 Oct 2013)
Log Message:
-----------
Perl and SQL errors in sequence screen corrected
Modified Paths:
--------------
trunk/LedgerSMB/Scripts/configuration.pm
trunk/LedgerSMB/Setting/Sequence.pm
trunk/UI/Configuration/sequence.html
trunk/sql/modules/Settings.sql
Modified: trunk/LedgerSMB/Scripts/configuration.pm
===================================================================
--- trunk/LedgerSMB/Scripts/configuration.pm 2013-10-23 05:57:41 UTC (rev 6152)
+++ trunk/LedgerSMB/Scripts/configuration.pm 2013-10-23 06:40:56 UTC (rev 6153)
@@ -249,6 +249,10 @@
sub sequence_screen {
my ($request) = @_;
@{$request->{sequence_list}} = LedgerSMB::Setting::Sequence->list();
+ for my $subset (@default_settings){
+ @{$request->{setting_keys}} = $subset->{items}
+ if $subset->{title} eq $locale->text('Next in Sequence');
+ }
LedgerSMB::Template->new_UI(
user => $LedgerSMB::App_State::User,
locale => $locale,
Modified: trunk/LedgerSMB/Setting/Sequence.pm
===================================================================
--- trunk/LedgerSMB/Setting/Sequence.pm 2013-10-23 05:57:41 UTC (rev 6152)
+++ trunk/LedgerSMB/Setting/Sequence.pm 2013-10-23 06:40:56 UTC (rev 6153)
@@ -23,6 +23,7 @@
use LedgerSMB::Setting;
use Carp;
use Moose;
+with 'LedgerSMB::DBObject_Moose';
=head1 DESCRIPTION
@@ -93,11 +94,11 @@
my ($self, $label, $setting_key) = @_;
if (defined $label){
- my ($ref) = $self->call_procedure(procname => 'sequence__get', args => [$label]);
+ my ($ref) = __PACKAGE__->call_procedure(procname => 'sequence__get', args => [$label]);
croak 'Sequence does not exist: ' . $label unless $ref;
return $self->new(%$ref);
} elsif (defined $setting_key){
- my ($ref) = $self->call_procedure(procname => 'setting_get', args => [$setting_key]);
+ my ($ref) = __PACKAGE__->call_procedure(procname => 'setting_get', args => [$setting_key]);
croak 'Setting does not exist: ' . $setting_key unless $ref;
return LedgerSMB::Setting->new($ref);
} else {
@@ -116,11 +117,11 @@
my ($self, $setting_key) = $_;
my @setting_list;
if (defined $setting_key){
- @setting_list = $self->call_procedure(
+ @setting_list = __PACKAGE__->call_procedure(
procname => 'sequence__list_by_key', args => [$setting_key]
);
} else {
- @setting_list = $self->call_procedure(procname => 'sequence__list');
+ @setting_list = __PACKAGE__->call_procedure(procname => 'sequence__list');
}
for my $s (@setting_list){
$s = $self->new(%$s);
@@ -160,7 +161,7 @@
$label = $val1;
$vars = $val2;
}
- my ($ref) = $self->call_procedure(procname => 'sequence__increment',
+ my ($ref) = __PACKAGE__->call_procedure(procname => 'sequence__increment',
args => [$label]);
my ($value) = values %$ref;
@@ -176,7 +177,7 @@
sub delete {
my ($self, $label) = @_;
- return $self->call_procedure(procname => 'sequence__delete',
+ return __PACKAGE__->call_procedure(procname => 'sequence__delete',
args => [$label]);
}
Modified: trunk/UI/Configuration/sequence.html
===================================================================
--- trunk/UI/Configuration/sequence.html 2013-10-23 05:57:41 UTC (rev 6152)
+++ trunk/UI/Configuration/sequence.html 2013-10-23 06:40:56 UTC (rev 6153)
@@ -1,5 +1,6 @@
<?lsmb INCLUDE 'ui-header.html';
PROCESS 'elements.html';
+
?>
<body class="<?lsmb dojo_theme ?>">
<form action="configuration.pl" action="post">
@@ -34,6 +35,8 @@
name = 'setting_key_' _ count
options = setting_keys
default_values = [seq.setting_key]
+ text_attr = 'label',
+ value_attr = 'name'
} ?></td>
<td><?lsmb PROCESS input element_data = {
name = 'prefix_' _ count
Modified: trunk/sql/modules/Settings.sql
===================================================================
--- trunk/sql/modules/Settings.sql 2013-10-23 05:57:41 UTC (rev 6152)
+++ trunk/sql/modules/Settings.sql 2013-10-23 06:40:56 UTC (rev 6153)
@@ -149,12 +149,12 @@
$$;
CREATE OR REPLACE FUNCTION sequence__list() RETURNS SETOF lsmb_sequence
-LANGAUGE SQL AS
+LANGUAGE SQL AS
$$
SELECT * FROM lsmb_sequence order by label;
$$;
-CREATE OR REPLACE FUNCTION sequence__get(in_label) RETURNS LSMB_SEQUENCE
+CREATE OR REPLACE FUNCTION sequence__get(in_label text) RETURNS LSMB_SEQUENCE
LANGUAGE SQL AS
$$
SELECT * FROM lsmb_sequence WHERE label = $1;
@@ -169,30 +169,36 @@
CREATE OR REPLACE FUNCTION sequence__save
(in_label text, in_setting_key text, in_prefix text, in_suffix text,
in_sequence text, in_accept_input bool)
-RETURNS lsmb_sequence LANGUAGE sql AS
+RETURNS lsmb_sequence LANGUAGE plpgsql AS
$$
+DECLARE retval lsmb_sequence;
+BEGIN
UPDATE lsmb_sequence
- SET prefix = coalesce(in_prefix, DEFAULT),
- suffix = coalecce(in_suffix, DEFAULT),
- sequence = coalesce(in_sequence, DEFAULT),
- setting_ley = in_setting_key,
+ SET prefix = coalesce(in_prefix, ''),
+ suffix = coalesce(in_suffix, ''),
+ sequence = coalesce(in_sequence, '1'),
+ setting_key = in_setting_key,
accept_input = in_accept_input
WHERE label = in_label;
-IF FOUND THEN RETURN sequence__get(in_label);
+IF FOUND THEN
+ retval := sequence__get(in_label);
+ RETURN retval;
END IF;
INSERT INTO lsmb_sequence(label, setting_key, prefix, suffix, sequence,
accept_input)
VALUES (in_label, in_setting_ley,
- coalesce(prefix, default),
- coalesce(suffix, default),
- coalesce(sequence, default),
+ coalesce(prefix, ''),
+ coalesce(suffix, ''),
+ coalesce(sequence, '1'),
in_accept_input
);
-return sequence__get(in_label);
-
+retval := sequence__get(in_label);
+RETURN retval;
+
+end;
$$;
CREATE OR REPLACE FUNCTION sequence__increment(in_label text)
@@ -221,7 +227,7 @@
$$
DELETE FROM lsmb_sequence where label = $1;
-RETURN NULL;
+SELECT NULL::lsmb_sequence;
$$;
COMMIT;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits