[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4788] trunk
- Subject: SF.net SVN: ledger-smb:[4788] trunk
- From: ..hidden..
- Date: Sun, 27 May 2012 11:42:57 +0000
Revision: 4788
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4788&view=rev
Author: einhverfr
Date: 2012-05-27 11:42:56 +0000 (Sun, 27 May 2012)
Log Message:
-----------
Moving bank account list to dynatable and handling to new 1.4 modular codebase
Modified Paths:
--------------
trunk/LedgerSMB/ScriptLib/Company.pm
trunk/UI/Contact/divs/bank_act.html
trunk/sql/modules/Company.sql
Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm 2012-05-27 09:13:01 UTC (rev 4787)
+++ trunk/LedgerSMB/ScriptLib/Company.pm 2012-05-27 11:42:56 UTC (rev 4788)
@@ -777,7 +777,8 @@
credit_id => $company->{credit_act}->{id}}
);
-
+ @{$company->{bank_account}} =
+ LedgerSMB::DBObject::Entity::Bank->list($company->{entity_id);
$company->{creditlimit} = $request->format_amount({amount => $company->{creditlimit}}) unless !defined $company->{creditlimit};
$company->{discount} = "$company->{discount}" unless !defined $company->{discount};
$company->{note_class_options} = [
@@ -896,12 +897,9 @@
sub delete_bank_acct{
my ($request) = @_;
- my $company = new_company($request);
- if (_close_form($company)){
- $company->delete_bank_account();
- }
- $company->get;
- _render_main_screen( $company );
+ my $account = LedgerSMB::DBObject::Entity::Bank->new(%$request);
+ $account->delete;
+ get($request);
}
=pod
@@ -999,12 +997,9 @@
sub save_bank_account {
my ($request) = @_;
- my $company = new_company($request);
- if (_close_form($company)){
- $company->save_bank_account();
- }
- $company->get;
- _render_main_screen($company );
+ my $bank = LedgerSMB::DBObject::Entity::Bank->new(%$request);
+ $bank->save;
+ get($request);
}
=item save_notes($request)
Modified: trunk/UI/Contact/divs/bank_act.html
===================================================================
--- trunk/UI/Contact/divs/bank_act.html 2012-05-27 09:13:01 UTC (rev 4787)
+++ trunk/UI/Contact/divs/bank_act.html 2012-05-27 11:42:56 UTC (rev 4788)
@@ -1,25 +1,24 @@
<div class="container" id="bank_div">
<div class="listtop"><?lsmb text('Bank Accounts') ?></div>
-<table width="100%">
-<tr class="listheading">
- <th class="bic"><?lsmb text('BIC/SWIFT Code') ?></th>
- <th class="iban"><?lsmb text('Account Number') ?></th>
- <th class="actions"><?lsmb text('Actions') ?></th>
-</tr>
-<?lsmb FOREACH ba = bank_account ?>
-<tr>
- <td class="bic"><?lsmb ba.bic ?></td>
- <td class="iban"><?lsmb ba.iban ?></td>
- <td class="actions">
- <a href="<?lsmb script ?>?action=delete_bank_acct&entity_id=<?lsmb
- entity_id ?>&bank_account_id=<?lsmb ba.id
- ?>&target_div=bank_div&form_id=<?lsmb form_id
- ?>&credit_id=<?lsmb tt_url(credit_id) ?>"
- >[<?lsmb text('Delete') ?>]</a>
- </td>
-</tr>
-<?lsmb END ?>
-</table>
+<?lsmb
+href_base = script _ '?&entity_id=' _ entity_id _ '&bank_account_id=' _
+ ba.id _ '&target_div=bank_div&form_id=' _ form_id _ '&credit_id=' _
+ credit_id;
+FOREACH ba IN bank_account;
+ ba.iban_href_suffix = href_base _ '&bic=' _ bic _ '&iban=' _ iban _
+ '&action=edit_bank_account';
+ ba.delete_href_suffix = href_base _ '&action=delete_bank_account';
+ ba.delete = '[' _ text('Delete') _ ']';
+END;
+PROCESS dynatable
+ attributes = { id = 'bank_account_list', width = '100%' }
+ tbody = {rows = bank_account}
+ columns = [
+ { col_id='bic', type='text', name=text('BIC/SWIFT Code') } #'
+ { col_id='iban', type='href', href_base='', name=text('Account Number')}#'
+ { col_id='delete', type='href', href_base='', name=' ' }
+ ];
+?>
<form name="bank_acct" action="<?lsmb script ?>">
<?lsmb PROCESS input element_data = {
type = "hidden"
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2012-05-27 09:13:01 UTC (rev 4787)
+++ trunk/sql/modules/Company.sql 2012-05-27 11:42:56 UTC (rev 4788)
@@ -934,6 +934,7 @@
contact text
);
+
CREATE OR REPLACE FUNCTION entity__list_contacts(in_entity_id int)
RETURNS SETOF contact_list AS $$
DECLARE out_row contact_list;
@@ -952,7 +953,19 @@
COMMENT ON FUNCTION entity__list_contacts(in_entity_id int) IS
$$ Lists all contact info for the entity.$$;
-CREATE OR REPLACE FUNCTION company__list_bank_account(in_entity_id int)
+CREATE OR REPLACE FUNCTION entity__delete_bank_account(in_id int)
+RETURNS BOOL AS
+$$
+BEGIN;
+
+DELETE FROM entity_bank_account WHERE id = in_id;
+
+RETURN FOUND;
+
+END;
+
+$$ LANGUAGE PLPGSQL;
+CREATE OR REPLACE FUNCTION entity__list_bank_account(in_entity_id int)
RETURNS SETOF entity_bank_account AS
$$
DECLARE out_row entity_bank_account%ROWTYPE;
@@ -965,10 +978,10 @@
END;
$$ LANGUAGE PLPGSQL;
-COMMENT ON FUNCTION company__list_bank_account(in_entity_id int) IS
+COMMENT ON FUNCTION entity__list_bank_account(in_entity_id int) IS
$$ Lists all bank accounts for the entity.$$;
-CREATE OR REPLACE FUNCTION eca__save_bank_account
+CREATE OR REPLACE FUNCTION entity__save_bank_account
(in_entity_id int, in_credit_id int, in_bic text, in_iban text,
in_bank_account_id int)
RETURNS int AS
@@ -997,38 +1010,11 @@
END;
$$ LANGUAGE PLPGSQL;
-COMMENT ON FUNCTION eca__save_bank_account
+COMMENT ON FUNCTION entity__save_bank_account
(in_entity_id int, in_credit_id int, in_bic text, in_iban text,
in_bank_account_id int) IS
$$ Saves bank account to the credit account.$$;
-CREATE OR REPLACE FUNCTION entity__save_bank_account
-(in_entity_id int, in_bic text, in_iban text, in_bank_account_id int)
-RETURNS int AS
-$$
-DECLARE out_id int;
-BEGIN
- UPDATE entity_bank_account
- SET bic = in_bic,
- iban = in_iban
- WHERE id = in_bank_account_id;
-
- IF FOUND THEN
- out_id = in_bank_account_id;
- ELSE
- INSERT INTO entity_bank_account(entity_id, bic, iban)
- VALUES(in_entity_id, in_bic, in_iban);
- SELECT CURRVAL('entity_bank_account_id_seq') INTO out_id ;
- END IF;
-
- RETURN out_id;
-END;
-$$ LANGUAGE PLPGSQL;
-
-COMMENT ON FUNCTION entity__save_bank_account
-(in_entity_id int, in_bic text, in_iban text, in_bank_account_id int) IS
-$$Saves a bank account to the entity.$$;
-
CREATE OR REPLACE FUNCTION company__delete_contact
(in_company_id int, in_contact_class_id int, in_contact text)
returns bool as $$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.