[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4050] branches/1.3/LedgerSMB/Form.pm
- Subject: SF.net SVN: ledger-smb:[4050] branches/1.3/LedgerSMB/Form.pm
- From: ..hidden..
- Date: Thu, 24 Nov 2011 13:14:56 +0000
Revision: 4050
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4050&view=rev
Author: einhverfr
Date: 2011-11-24 13:14:56 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
New API in LedgerSMB/Form.pm convert_date() to be used to resolve bug 3437585
Modified Paths:
--------------
branches/1.3/LedgerSMB/Form.pm
Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm 2011-11-24 12:45:13 UTC (rev 4049)
+++ branches/1.3/LedgerSMB/Form.pm 2011-11-24 13:14:56 UTC (rev 4050)
@@ -759,6 +759,29 @@
$sortorder;
}
+=item $form->convert_date($date, $myconfig)
+
+This takes a date in YYYY-MM-DD format and returns it in the format of the user.
+
+=cut
+
+sub convert_date {
+ my $self = shift @_;
+ my ($date, $myconfig) = @_;
+ my $newdate;
+ my $format = $myconfig->{dateformat};
+ my ($YYYY, $MM, $DD) = split /-/, $date;
+ $format =~ /(\w+)(\W)(\w+)\W(\w+)/;
+ my $first = $1;
+ my $sep = $2;
+ my $second = $3;
+ my $third = $4;
+
+ $newdate = "${$first}?${$second}?${$third}";
+ $newdate =~ s/\?/$sep/;
+ return $newdate;
+}
+
=item $form->format_amount($myconfig, $amount, $places, $dash);
Returns $amount as formatted in the form specified by $form->{numberformat}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.