[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3926] branches/1.3
- Subject: SF.net SVN: ledger-smb:[3926] branches/1.3
- From: ..hidden..
- Date: Tue, 25 Oct 2011 13:52:59 +0000
Revision: 3926
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3926&view=rev
Author: einhverfr
Date: 2011-10-25 13:52:59 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
Correcting inconsistent argument names in company__save (and UI inconsistencies as a result)
Correcting inability to save employee, customer, and vendor countries.
REQUIRES A RELOAD OF SQL MODULES
Modified Paths:
--------------
branches/1.3/Changelog
branches/1.3/UI/Contact/contact.html
branches/1.3/sql/modules/Company.sql
branches/1.3/sql/modules/Employee.sql
branches/1.3/sql/modules/Person.sql
Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog 2011-10-25 10:39:34 UTC (rev 3925)
+++ branches/1.3/Changelog 2011-10-25 13:52:59 UTC (rev 3926)
@@ -6,6 +6,8 @@
* Fix for being unable to delete AR/AP drafts (Herman V)
* Additional button cleanup (Herman V)
* Fix for is_zero issue with latest Math::BigFloat in AR/AP trans (Chris T)
+* Fix for inability to save employee country (Chris T)
+* API inconsistency fixed (Chris T)
Changelog for LedgerSMB 1.3.2
* Fixed a few files where suExec fixes were not applied (Chris T)
Modified: branches/1.3/UI/Contact/contact.html
===================================================================
--- branches/1.3/UI/Contact/contact.html 2011-10-25 10:39:34 UTC (rev 3925)
+++ branches/1.3/UI/Contact/contact.html 2011-10-25 13:52:59 UTC (rev 3926)
@@ -8,6 +8,7 @@
]
?>
<?lsmb PROCESS 'elements.html' ?>
+<?lsmb IF !country_id; country_id = default_country; END -?>
<?lsmb
# Adding the action requirement to the conditional because otherwise it still
# breaks. --CT
@@ -147,12 +148,11 @@
} ?>
</div>
<div class="input_group">
- <?lsmb IF !country_id; country_id = default_country; END -?>
<?lsmb country_list.unshift({}) ?>
<?lsmb INCLUDE select element_data = {
text_attr = "name"
value_attr = "id"
- default_values = [country_id_t]
+ default_values = [country_id]
options = country_list
name = "country_id"
label = text('Country')
@@ -317,14 +317,13 @@
} ?>
</div>
<div class="input_group2">
- <?lsmb IF !country_id_t; country_id_t = default_country; END -?>
<?lsmb country_list.unshift({}) ?>
<?lsmb INCLUDE select element_data = {
text_attr = "name"
value_attr = "id"
- default_values = [country_id_t]
+ default_values = [country_id]
options = country_list
- name = "country_id_t"
+ name = "country_id"
label = text('Country')
} ?>
</div>
Modified: branches/1.3/sql/modules/Company.sql
===================================================================
--- branches/1.3/sql/modules/Company.sql 2011-10-25 10:39:34 UTC (rev 3925)
+++ branches/1.3/sql/modules/Company.sql 2011-10-25 13:52:59 UTC (rev 3926)
@@ -614,7 +614,7 @@
CREATE OR REPLACE FUNCTION company_save (
in_id int, in_control_code text, in_entity_class int,
in_name text, in_tax_id TEXT,
- in_entity_id int, in_sic_code text,in_country_id_t int
+ in_entity_id int, in_sic_code text,in_country_id int
) RETURNS INT AS $$
DECLARE t_entity_id INT;
t_company_id INT;
@@ -638,7 +638,7 @@
t_entity_id = in_entity_id;
ELSE
INSERT INTO entity (name, entity_class, control_code,country_id)
- VALUES (in_name, in_entity_class, t_control_code,in_country_id_t);
+ VALUES (in_name, in_entity_class, t_control_code,in_country_id);
t_entity_id := currval('entity_id_seq');
END IF;
@@ -661,7 +661,7 @@
COMMENT ON FUNCTION company_save (
in_id int, in_control_code text, in_entity_class int,
in_name text, in_tax_id TEXT,
- in_entity_id int, in_sic_code text,in_country_id_t int
+ in_entity_id int, in_sic_code text,in_country_id int
) is
$$ Saves a company. Returns the id number of the record stored.$$;
Modified: branches/1.3/sql/modules/Employee.sql
===================================================================
--- branches/1.3/sql/modules/Employee.sql 2011-10-25 10:39:34 UTC (rev 3925)
+++ branches/1.3/sql/modules/Employee.sql 2011-10-25 13:52:59 UTC (rev 3926)
@@ -66,6 +66,8 @@
GRANT select ON employees TO public;
+DROP TYPE IF EXISTS employee_result CASCADE;
+
CREATE TYPE employee_result AS (
entity_id int,
person_id int,
@@ -82,7 +84,8 @@
manager_first_name text,
manager_last_name text,
employeenumber varchar(32),
- dob date
+ dob date,
+ country_id int
);
CREATE OR REPLACE FUNCTION employee__get
@@ -92,9 +95,10 @@
SELECT p.entity_id, p.id, s.salutation,
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
+ mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
FROM person p
JOIN entity_employee ee on (ee.entity_id = p.entity_id)
+ JOIN entity e ON (p.entity_id = e.id)
LEFT JOIN salutation s on (p.salutation_id = s.id)
LEFT JOIN person mp ON ee.manager_id = p.entity_id
WHERE p.entity_id = $1;
@@ -113,8 +117,9 @@
SELECT p.entity_id, p.id, s.salutation,
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
+ mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
FROM person p
+ JOIN entity e ON p.entity_id = e.id
JOIN entity_employee ee on (ee.entity_id = p.entity_id)
LEFT JOIN salutation s on (p.salutation_id = s.id)
LEFT JOIN person mp ON ee.manager_id = p.entity_id
Modified: branches/1.3/sql/modules/Person.sql
===================================================================
--- branches/1.3/sql/modules/Person.sql 2011-10-25 10:39:34 UTC (rev 3925)
+++ branches/1.3/sql/modules/Person.sql 2011-10-25 13:52:59 UTC (rev 3926)
@@ -38,7 +38,12 @@
select * into e from entity where id = in_entity_id and entity_class = 3;
e_id := in_entity_id;
- IF NOT FOUND THEN
+ IF FOUND THEN
+ UPDATE entity
+ SET name = in_first_name || ' ' || in_last_name,
+ country_id = in_country_id
+ WHERE id = in_entity_id;
+ ELSE
INSERT INTO entity (name, entity_class, country_id)
values (in_first_name || ' ' || in_last_name, 3, in_country_id);
e_id := currval('entity_id_seq');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.