[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3328] trunk
- Subject: SF.net SVN: ledger-smb:[3328] trunk
- From: ..hidden..
- Date: Sat, 25 Jun 2011 09:51:00 +0000
Revision: 3328
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3328&view=rev
Author: einhverfr
Date: 2011-06-25 09:50:59 +0000 (Sat, 25 Jun 2011)
Log Message:
-----------
Fixed information incompleteness issues with location API, more progress on contact/address/bank account editing
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Company.pm
trunk/LedgerSMB/DBObject/Employee.pm
trunk/LedgerSMB/ScriptLib/Company.pm
trunk/UI/Contact/contact.html
trunk/scripts/employee.pl
trunk/sql/modules/Company.sql
trunk/sql/modules/Location.sql
trunk/sql/modules/Person.sql
Added Paths:
-----------
trunk/sql/upgrade/3328-drop-location_result.sql
Modified: trunk/LedgerSMB/DBObject/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Company.pm 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/LedgerSMB/DBObject/Company.pm 2011-06-25 09:50:59 UTC (rev 3328)
@@ -99,6 +99,7 @@
'No company or credit id in LedgerSMB::DBObject::delete_contact'
));
}
+ $self->{dbh}->commit;
return $rv;
}
@@ -136,6 +137,7 @@
'No company or credit id in LedgerSMB::DBObject::delete_location'
));
}
+ $self->{dbh}->commit;
return $rv;
}
@@ -163,6 +165,7 @@
($rv) = $self->exec_method(funcname => 'entity__delete_bank_account',
args => [$self->{entity_id},
$self->{bank_account_id}]);
+ $self->{dbh}->commit;
return $rv;
}
Modified: trunk/LedgerSMB/DBObject/Employee.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Employee.pm 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/LedgerSMB/DBObject/Employee.pm 2011-06-25 09:50:59 UTC (rev 3328)
@@ -136,6 +136,7 @@
sub delete_contact {
my ($self) = @_;
$self->exec_method(funcname => 'person__delete_contact');
+ $self->{dbh}->commit;
}
=over
@@ -160,6 +161,7 @@
my ($self) = @_;
my $rv;
($rv) = $self->exec_method(funcname => 'person__delete_location');
+ $self->{dbh}->commit;
return $rv;
}
@@ -186,6 +188,7 @@
($rv) = $self->exec_method(funcname => 'entity__delete_bank_account',
args => [$self->{entity_id},
$self->{bank_account_id}]);
+ $self->{dbh}->commit;
return $rv;
}
Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/LedgerSMB/ScriptLib/Company.pm 2011-06-25 09:50:59 UTC (rev 3328)
@@ -278,6 +278,8 @@
_render_main_screen($company);
}
+
+
=pod
=over
@@ -753,6 +755,63 @@
=over
+=item delete_contact
+
+Deletes the selected contact info record
+
+Must include company_id or credit_id (credit_id used if both are provided) plus:
+
+* contact_class_id
+* contact
+* form_id
+
+=back
+
+=cut
+
+sub delete_contact {
+ my ($request) = @_;
+ my $company = new_company($request);
+ if (_close_form($company)){
+ $company->delete_contact();
+ }
+ $company->get;
+ _render_main_screen( $company );
+}
+
+=pod
+
+=over
+
+=item delete_location
+
+Deletes the selected contact info record
+
+Must include company_id or credit_id (credit_id used if both are provided) plus:
+
+* location_class_id
+* location_id
+* form_id
+
+=back
+
+=cut
+
+sub delete_location {
+ my ($request) = @_;
+ my $company = new_company($request);
+ if (_close_form($company)){
+ $company->delete_location();
+ }
+ $company->get;
+ _render_main_screen( $company );
+}
+
+
+=pod
+
+=over
+
=item save_contact_new($request)
Saves contact info as a new line as per save_contact above.
Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/UI/Contact/contact.html 2011-06-25 09:50:59 UTC (rev 3328)
@@ -696,7 +696,8 @@
credit_id ?>&target_div=location_div">[edit]</a>
<a href="<?lsmb script ?>?action=delete_location&entity_id=<?lsmb
entity_id ?>&location_id=<?lsmb loc.id
- ?>&credit_id = <?lsmb credit_id
+ ?>&credit_id=<?lsmb credit_id
+ ?>&form_id=<?lsmb form_id
?>&target_div=location_div">[delete]</a>
</td>
</tr>
@@ -820,9 +821,12 @@
>[<?lsmb text('Edit'); ?>]</a>
<a href="<?lsmb tt_url(script)
?>?entity_id=<?lsmb tt_url(entity_id)
- ?>&contact_id=<?lsmb tt_url(ct.id)
+ ?>&contact_class_id=<?lsmb
+ tt_url(ct.class_id)
?>&action=delete_contact&credit_id=<?lsmb
- tt_url(credit_id) ?>&target_div=contact_div"
+ tt_url(credit_id) ?>&form_id=<?lsmb form_id
+ ?>&contact=<?lsmb tt_url(ct.contact)
+ ?>&target_div=contact_div"
>[<?lsmb text('Delete'); ?>]</a>
</td>
</tr>
@@ -929,7 +933,7 @@
>[Edit]</a>
<a href="<?lsmb script ?>?action=delete_bank_acct&entity_id=<?lsmb
entity_id ?>&bank_account_id=<?lsmb ba.id
- ?>&target_div=bank_div"
+ ?>&target_div=bank_div&form_id=<?lsmb form_id ?>"
>[Delete]</a>
</td>
</tr>
Modified: trunk/scripts/employee.pl
===================================================================
--- trunk/scripts/employee.pl 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/scripts/employee.pl 2011-06-25 09:50:59 UTC (rev 3328)
@@ -98,6 +98,62 @@
=over
+=item delete_contact
+
+Deletes the selected contact info record
+
+Must include company_id or credit_id (credit_id used if both are provided) plus:
+
+* contact_class_id
+* contact
+* form_id
+
+=back
+
+=cut
+
+sub delete_contact {
+ my ($request) = @_;
+ my $employee= LedgerSMB::DBObject::Employee->new(base => $request, copy => 'all');
+ if (_close_form($company)){
+ $employee->delete_contact();
+ }
+ $employee->get;
+ _render_main_screen( $employee);
+}
+
+=pod
+
+=over
+
+=item delete_location
+
+Deletes the selected contact info record
+
+Must include company_id or credit_id (credit_id used if both are provided) plus:
+
+* location_class_id
+* location_id
+* form_id
+
+=back
+
+=cut
+
+sub delete_location {
+ my ($request) = @_;
+ my $employee= LedgerSMB::DBObject::Employee->new(base => $request, copy => 'all');
+ if (_close_form($employee)){
+ $employee->delete_location();
+ }
+ $employee->get;
+ _render_main_screen( $employee);
+}
+
+=pod
+
+=over
+
=item search($self, $request, $user)
Requires form var: search_pattern
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/sql/modules/Company.sql 2011-06-25 09:50:59 UTC (rev 3328)
@@ -693,7 +693,7 @@
BEGIN
FOR out_row IN
SELECT l.id, l.line_one, l.line_two, l.line_three, l.city,
- l.state, l.mail_code, c.name, lc.class
+ l.state, l.mail_code, c.id, c.name, lc.id, lc.class
FROM location l
JOIN company_to_location ctl ON (ctl.location_id = l.id)
JOIN location_class lc ON (ctl.location_class = lc.id)
@@ -1018,7 +1018,9 @@
l.city,
l.state,
l.mail_code,
+ c.id,
c.name,
+ lc.id,
lc.class
FROM location l
JOIN eca_to_location ctl ON (ctl.location_id = l.id)
@@ -1036,7 +1038,7 @@
BEGIN
FOR out_row IN
SELECT l.id, l.line_one, l.line_two, l.line_three, l.city,
- l.state, l.mail_code, c.name, lc.class
+ l.state, l.mail_code, c.id, c.name, lc.id, lc.class
FROM location l
JOIN eca_to_location ctl ON (ctl.location_id = l.id)
JOIN location_class lc ON (ctl.location_class = lc.id)
Modified: trunk/sql/modules/Location.sql
===================================================================
--- trunk/sql/modules/Location.sql 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/sql/modules/Location.sql 2011-06-25 09:50:59 UTC (rev 3328)
@@ -167,12 +167,13 @@
city text,
state text,
mail_code text,
+ country_id int,
country text,
+ class_id int,
class text
);
CREATE OR REPLACE FUNCTION location__get(in_id int) returns location_result AS $$
-
declare
l_row location_result;
begin
@@ -184,8 +185,10 @@
l.line_three,
l.city,
l.state,
- l.mail_code,
- c.name as country,
+ l.mail_code,
+ c.id,
+ c.name as country,
+ NULL,
NULL
FROM location l
JOIN country c on l.country_id = c.id
Modified: trunk/sql/modules/Person.sql
===================================================================
--- trunk/sql/modules/Person.sql 2011-06-25 08:47:04 UTC (rev 3327)
+++ trunk/sql/modules/Person.sql 2011-06-25 09:50:59 UTC (rev 3328)
@@ -57,7 +57,7 @@
BEGIN
FOR out_row IN
SELECT l.id, l.line_one, l.line_two, l.line_three, l.city,
- l.state, l.mail_code, c.name, lc.class
+ l.state, l.mail_code, c.id, c.name, lc.id, lc.class
FROM location l
JOIN person_to_location ctl ON (ctl.location_id = l.id)
JOIN person p ON (ctl.person_id = p.id)
Added: trunk/sql/upgrade/3328-drop-location_result.sql
===================================================================
--- trunk/sql/upgrade/3328-drop-location_result.sql (rev 0)
+++ trunk/sql/upgrade/3328-drop-location_result.sql 2011-06-25 09:50:59 UTC (rev 3328)
@@ -0,0 +1 @@
+drop type location_result cascade;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.