[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6525] trunk
- Subject: SF.net SVN: ledger-smb:[6525] trunk
- From: ..hidden..
- Date: Sat, 18 Jan 2014 11:41:16 +0000
Revision: 6525
http://sourceforge.net/p/ledger-smb/code/6525
Author: einhverfr
Date: 2014-01-18 11:41:15 +0000 (Sat, 18 Jan 2014)
Log Message:
-----------
Removing some little or never used (and unneeded) functions from LedgerSMB.pm
Modified Paths:
--------------
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Setting.pm
trunk/LedgerSMB.pm
Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm 2014-01-18 10:55:54 UTC (rev 6524)
+++ trunk/LedgerSMB/Scripts/payment.pm 2014-01-18 11:41:15 UTC (rev 6525)
@@ -495,7 +495,7 @@
$_->{to_pay} = $contact_to_pay;
$payment->{grand_total} += $contact_total;
- my ($check_all) = $payment->get_default_value_by_key('check_payments');
+ my ($check_all) = LedgerSMB::Setting->get('check_payments');
if ($payment->{account_class} == 1 and $check_all){
$payment->{"id_$_->{contact_id}"} = $_->{contact_id};
}
@@ -1259,7 +1259,7 @@
rows => \@rows,
format_amount => sub {$Payment->format_amount(@_)}
};
- $Payment->{templates_path} = 'templates/'.$Payment->get_default_value_by_key('templates').'/';
+ $Payment->{templates_path} = 'templates/'.LedgerSMB::Setting::get('templates').'/';
my $template = LedgerSMB::Template->new(
user => $Payment->{_user},
locale => $Payment->{_locale},
Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm 2014-01-18 10:55:54 UTC (rev 6524)
+++ trunk/LedgerSMB/Setting.pm 2014-01-18 11:41:15 UTC (rev 6525)
@@ -55,7 +55,7 @@
my $self = shift;
my ($key) = @_;
$key = $self->{key} unless $key;
- my ($hashref) = $self->call_procedure( procname => 'setting_get',
+ my ($hashref) = __PACKAGE__->call_procedure( procname => 'setting_get',
args => [$key]) ;
$self->{value} = $hashref->{value} if ref $self !~ /hash/i;
return $hashref->{value};
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2014-01-18 10:55:54 UTC (rev 6524)
+++ trunk/LedgerSMB.pm 2014-01-18 11:41:15 UTC (rev 6525)
@@ -18,11 +18,6 @@
session/user credentials, as appropriate for the run mode. Finally, it sets up
the database connections for the user.
-=item date_to_number (user => $LedgerSMB::User, date => $string);
-
-This function takes the date in the format provided and returns a numeric
-string in YYMMDD format. This may be moved to User in the future.
-
=item unescape($var)
Unescapes the var, i.e. converts html entities back to their characters.
@@ -81,11 +76,6 @@
This function returns 1 if the user's roles include any of the roles in
@role_names.
-=item num_text_rows (string => $string, cols => $number, max => $number);
-
-This function determines the likely number of rows needed to hold text in a
-textbox. It returns either that number or max, which ever is lower.
-
=item merge ($hashref, keys => @list, index => $number);
This command merges the $hashref into the current object. If keys are
@@ -94,12 +84,6 @@
If an index is specified, the merged keys are given a form of
"$key" . "_$index", otherwise the key is used on both sides.
-=item redirect (msg => $string)
-
-This function redirects to the script and argument set determined by
-$self->{callback}, and if this is not set, goes to an info screen and prints
-$msg.
-
=item set (@attrs)
Copies the given key=>vars to $self. Allows for finer control of
@@ -110,11 +94,6 @@
Removes all elements starting with a . because these elements conflict with the
ability to hide the entire structure for things like CSV lookups.
-=item get_default_value_by_key($key)
-
-Retrieves a default value for the given key, it is just a wrapper on LedgerSMB::Setting;
-
-
=item call_procedure( procname => $procname, args => $args )
Function that allows you to call a stored procedure by name and map the appropriate argument to the function values.
@@ -524,53 +503,6 @@
$rc;
}
-sub num_text_rows {
- my $self = shift @_;
- my %args = @_;
- my $string = $args{string};
- my $cols = $args{cols};
- my $maxrows = $args{max};
-
- my $rows = 0;
-
- for ( split /\n/, $string ) {
- my $line = $_;
- while ( length($line) > $cols ) {
- my $fragment = substr( $line, 0, $cols + 1 );
- $fragment =~ s/^(.*)\W.*$/$1/;
- $line =~ s/$fragment//;
- if ( $line eq $fragment ) { # No word breaks!
- $line = "";
- }
- ++$rows;
- }
- ++$rows;
- }
-
- if ( !defined $maxrows ) {
- $maxrows = $rows;
- }
-
- return ( $rows > $maxrows ) ? $maxrows : $rows;
-
-}
-
-sub redirect {
- my $self = shift @_;
- my %args = @_;
- my $msg = $args{msg};
-
- if ( $self->{callback} || !$msg ) {
-
- main::redirect();
- die;
- }
- else {
-
- $self->info($msg);
- }
-}
-
# TODO: Either we should have an amount class with formats and such attached
# Or maybe we should move this into the user class...
sub format_amount {
@@ -757,63 +689,6 @@
return 0;
}
-# This should probably be moved to User too...
-sub date_to_number {
-
- #based on SQL-Ledger's Form::datetonum
- my $self = shift @_;
- my %args = @_;
- my $myconfig = $args{user};
- my $date = $args{date};
-
- $date = "" unless defined $date;
-
- my ( $yy, $mm, $dd );
- if ( $date ne "" && $date && $date =~ /\D/ ) {
-
- if ( $date =~ /^\d{4}-\d\d-\d\d$/ ) {
- ( $yy, $mm, $dd ) = split /\D/, $date;
- } elsif ( $myconfig->{dateformat} =~ /^yy/ ) {
- ( $yy, $mm, $dd ) = split /\D/, $date;
- } elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
- ( $mm, $dd, $yy ) = split /\D/, $date;
- } elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
- ( $dd, $mm, $yy ) = split /\D/, $date;
- }
-
- $dd *= 1;
- $mm *= 1;
- $yy += 2000 if length $yy == 2;
-
- $dd = substr( "0$dd", -2 );
- $mm = substr( "0$mm", -2 );
-
- $date = "$yy$mm$dd";
- }
-
- $date;
-}
-
-sub sanitize_for_display {
- my $self = shift;
- my $var = shift;
- $self->error('Untested API');
- if (!$var){
- $var = $self;
- }
- for my $k (keys %$var){
- my $type = ref($var);
- if (UNIVERSAL::isa($var->{$k}, 'Math::BigFloat')){
- $var->{$k} =
- $self->format_amount({amount => $var->{$k}});
- }
- elsif ($type == 'HASH'){
- $self->sanitize_for_display($var->{$k});
- }
- }
-
-}
-
sub finalize_request {
LedgerSMB::App_State->zero();
}
@@ -1104,16 +979,6 @@
return $return_hash;
}
-
-
-sub get_default_value_by_key
-{
- my ($self, $key) = @_;
- my $Settings = LedgerSMB::Setting->new({base => $self, copy => 'base'});
- $Settings->{key} = $key;
- $Settings->get;
- $Settings->{value};
-}
1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits