[wiaflos-devel] COMMIT - r287 - trunk/soap/Plugins
svn at linuxrulz.org
svn at linuxrulz.org
Sun May 17 09:05:49 GMT 2009
Author: nkukard
Date: 2009-05-17 09:05:49 +0000 (Sun, 17 May 2009)
New Revision: 287
Added:
trunk/soap/Plugins/YearEnd.pm
Log:
* Added YearEnd soap plugin
Added: trunk/soap/Plugins/YearEnd.pm
===================================================================
--- trunk/soap/Plugins/YearEnd.pm (rev 0)
+++ trunk/soap/Plugins/YearEnd.pm 2009-05-17 09:05:49 UTC (rev 287)
@@ -0,0 +1,94 @@
+# Year end procedures
+# Copyright (C) 2009, AllWorldIT
+# Copyright (C) 2008, LinuxRulz
+# Copyright (C) 2007 Nigel Kukard <nkukard at lbsd.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+package YearEnd;
+
+use strict;
+use warnings;
+
+use Auth;
+
+use wiaflos::constants;
+use wiaflos::soap;
+use wiaflos::server::YearEnd;
+
+
+# Plugin info
+our $pluginInfo = {
+ Name => "YearEnd",
+ Init => \&init,
+};
+
+
+# Initialize module
+sub init {
+ my $server = shift;
+
+
+ Auth::aclAdd('YearEnd','performYearEnd','YearEnd/Perform');
+}
+
+
+
+
+## @fn performYearEnd
+# Function to perform a yearend on the set of books
+#
+# @param data Parameter hash ref
+# @li StartDate - Optional yearend start date
+# @li EndDate - Optional yearend end date
+# @li REAccountNumber - Retained earnings account number
+sub performYearEnd {
+ my (undef,$data) = @_;
+
+
+ # Check params
+ if (!defined($data->{'StartDate'}) || $data->{'StartDate'} eq "") {
+ return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'StartDate' invalid");
+ }
+
+ if (!defined($data->{'EndDate'}) || $data->{'EndDate'} eq "") {
+ return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'EndDate' invalid");
+ }
+
+ if (!defined($data->{'REAccountNumber'}) || $data->{'REAccountNumber'} eq "") {
+ return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'REAccountNumber' invalid");
+ }
+
+ my $authInfo = Auth::sessionGetData();
+
+ # Do transaction
+ my $detail;
+ $detail->{'StartDate'} = $data->{'StartDate'};
+ $detail->{'EndDate'} = $data->{'EndDate'};
+ $detail->{'REAccountNumber'} = $data->{'REAccountNumber'};
+ my $res = wiaflos::server::YearEnd::performYearEnd($detail);
+
+ if ($res < 0) {
+ return SOAPResponse(RES_ERROR,$res,wiaflos::server::YearEnd::Error());
+ }
+
+ return SOAPResponse(RES_OK,$res);
+}
+
+
+
+1;
+# vim: ts=4
More information about the wiaflos-devel
mailing list