[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5021] trunk
- Subject: SF.net SVN: ledger-smb:[5021] trunk
- From: ..hidden..
- Date: Fri, 20 Jul 2012 12:49:07 +0000
Revision: 5021
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5021&view=rev
Author: einhverfr
Date: 2012-07-20 12:49:06 +0000 (Fri, 20 Jul 2012)
Log Message:
-----------
Fixes for getting rid of Maybe's in Moose types. This includes deleting NULLS from resulting hashrefs in LedgerSMB->call_procedure.
Modified Paths:
--------------
trunk/LedgerSMB/Entity/Company.pm
trunk/LedgerSMB/Entity/Credit_Account.pm
trunk/LedgerSMB/Entity/Location.pm
trunk/LedgerSMB/Entity/Payroll/Wage.pm
trunk/LedgerSMB/Entity/Person/Employee.pm
trunk/LedgerSMB.pm
trunk/sql/modules/Company.sql
trunk/sql/modules/Employee.sql
Modified: trunk/LedgerSMB/Entity/Company.pm
===================================================================
--- trunk/LedgerSMB/Entity/Company.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB/Entity/Company.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -98,6 +98,7 @@
my ($ref) = __PACKAGE__->call_procedure(procname => 'company__get',
args => [$id]);
return undef unless $ref->{control_code};
+ $ref->{name} = $ref->{legal_name};
return __PACKAGE__->new(%$ref);
}
@@ -113,6 +114,7 @@
my ($ref) = __PACKAGE__->call_procedure(procname => 'company__get_by_cc',
args => [$cc]);
return undef unless $ref->{control_code};
+ $ref->{name} = $ref->{legal_name};
return __PACKAGE__->new(%$ref);
}
Modified: trunk/LedgerSMB/Entity/Credit_Account.pm
===================================================================
--- trunk/LedgerSMB/Entity/Credit_Account.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB/Entity/Credit_Account.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -126,7 +126,7 @@
=cut
-has 'current_debt' => (is => 'rw', isa => 'LedgerSMB::Moose::Number'.
+has 'current_debt' => (is => 'rw', isa => 'LedgerSMB::Moose::Number',
coerce => 1, lazy => 1, builder => 'get_current_debt');
=item terms
Modified: trunk/LedgerSMB/Entity/Location.pm
===================================================================
--- trunk/LedgerSMB/Entity/Location.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB/Entity/Location.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -49,7 +49,7 @@
=cut
-has 'inactive_date' => (is => 'rw', coerce => 1isa => 'LedgerSMB::Moose::Date');
+has 'inactive_date' => (is => 'rw', coerce=>1, isa => 'LedgerSMB::Moose::Date');
=item id
Modified: trunk/LedgerSMB/Entity/Payroll/Wage.pm
===================================================================
--- trunk/LedgerSMB/Entity/Payroll/Wage.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB/Entity/Payroll/Wage.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -41,7 +41,7 @@
=cut
-has type_id => (is => 'rw', isa => 'Int'. required => 1);
+has type_id => (is => 'rw', isa => 'Int', required => 1);
=item rate
Modified: trunk/LedgerSMB/Entity/Person/Employee.pm
===================================================================
--- trunk/LedgerSMB/Entity/Person/Employee.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB/Entity/Person/Employee.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -121,6 +121,8 @@
my ($ref) = __PACKAGE__->call_procedure(procname => 'employee__get',
args => [$id]);
return undef unless $ref->{control_code};
+ $ref->{entity_class} = 3;
+ $ref->{name} = "$ref->{first_name} $ref->{last_name}";
return __PACKAGE__->new(%$ref);
}
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/LedgerSMB.pm 2012-07-20 12:49:06 UTC (rev 5021)
@@ -732,6 +732,7 @@
if ($types[$_] == 91 or $types[$_] == 11){
$ref->{$names[$_]} = LedgerSMB::PGDate->from_db($ref->{$names[$_]}, 'date') if defined $ref->{$names[$_]};
}
+ delete $ref->{$names[$_]} unless defined $ref->{$names[$_]};
}
push @results, $ref;
}
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/sql/modules/Company.sql 2012-07-20 12:49:06 UTC (rev 5021)
@@ -10,6 +10,7 @@
CREATE TYPE company_entity AS(
entity_id int,
+ entity_class int,
legal_name text,
tax_id text,
sales_tax_id text,
@@ -595,7 +596,7 @@
CREATE OR REPLACE FUNCTION company__get (in_entity_id int)
RETURNS company_entity AS
$$
- SELECT c.entity_id, c.legal_name, c.tax_id, c.sales_tax_id,
+ SELECT c.entity_id, e.entity_class, c.legal_name, c.tax_id, c.sales_tax_id,
c.license_number, c.sic_code, e.control_code, e.country_id
FROM company c
JOIN entity e ON e.id = c.entity_id
@@ -608,7 +609,7 @@
CREATE OR REPLACE FUNCTION company__get_by_cc (in_control_code text)
RETURNS company_entity AS
$$
- SELECT c.entity_id, c.legal_name, c.tax_id, c.sales_tax_id,
+ SELECT c.entity_id, e.entity_class, c.legal_name, c.tax_id, c.sales_tax_id,
c.license_number, c.sic_code, e.control_code, e.country_id
FROM company c
JOIN entity e ON e.id = c.entity_id
Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql 2012-07-20 11:39:44 UTC (rev 5020)
+++ trunk/sql/modules/Employee.sql 2012-07-20 12:49:06 UTC (rev 5021)
@@ -78,6 +78,7 @@
control_code text,
person_id int,
salutation text,
+ salutation_id int,
first_name text,
middle_name text,
last_name text,
@@ -97,7 +98,7 @@
CREATE OR REPLACE FUNCTION employee__all_managers()
RETURNS setof employee_result AS
$$
- SELECT p.entity_id, e.control_code, p.id, s.salutation,
+ SELECT p.entity_id, e.control_code, p.id, s.salutation, s.id,
p.first_name, p.middle_name, p.last_name,
ee.startdate, ee.enddate, ee.role, ee.ssn, ee.sales, ee.manager_id,
mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
@@ -114,7 +115,7 @@
(in_entity_id integer)
returns employee_result as
$$
- SELECT p.entity_id, e.control_code, p.id, s.salutation,
+ SELECT p.entity_id, e.control_code, p.id, s.salutation, s.id,
p.first_name, p.middle_name, p.last_name,
ee.startdate, ee.enddate, ee.role, ee.ssn, ee.sales, ee.manager_id,
mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
@@ -136,7 +137,7 @@
in_notes text)
RETURNS SETOF employee_result as
$$
-SELECT p.entity_id, e.control_code, p.id, s.salutation,
+SELECT p.entity_id, e.control_code, p.id, s.salutation, s.id,
p.first_name, p.middle_name, p.last_name,
ee.startdate, ee.enddate, ee.role, ee.ssn, ee.sales, ee.manager_id,
mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.