[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4800] trunk



Revision: 4800
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4800&view=rev
Author:   einhverfr
Date:     2012-05-29 10:08:25 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Basic bank account actions now working on new modular codebase

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Entity/Bank.pm
    trunk/LedgerSMB/Scripts/contact.pm
    trunk/UI/Contact/divs/bank_act.html
    trunk/UI/Contact/divs/contact_info.html

Modified: trunk/LedgerSMB/DBObject/Entity/Bank.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Bank.pm	2012-05-29 09:32:38 UTC (rev 4799)
+++ trunk/LedgerSMB/DBObject/Entity/Bank.pm	2012-05-29 10:08:25 UTC (rev 4800)
@@ -125,7 +125,7 @@
 
 sub delete {
     my ($self) = @_;
-    my ($ref) = $self->exec_method({funcname => 'entity__save_bank_account'});
+    my ($ref) = $self->exec_method({funcname => 'entity__delete_bank_account'});
     return $ref;
 }
 

Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm	2012-05-29 09:32:38 UTC (rev 4799)
+++ trunk/LedgerSMB/Scripts/contact.pm	2012-05-29 10:08:25 UTC (rev 4800)
@@ -558,4 +558,37 @@
     get($request);
 }
 
+=item delete_bank_acct
+
+Deletes the selected bank account record
+
+Required request variables:
+* bank_account_id
+* entity_id
+* form_id
+
+=cut
+
+sub delete_bank_account{
+    my ($request) = @_;
+    my $account = LedgerSMB::DBObject::Entity::Bank->new(%$request);
+    $account->delete;
+    $request->{target_div} = 'bank_act_div';
+    get($request);
+}
+
+=sub save_bank_account 
+
+Adds a bank account to a company and, if defined, an entity credit account.
+
+=cut
+
+sub save_bank_account {
+    my ($request) = @_;
+    my $bank = LedgerSMB::DBObject::Entity::Bank->new(%$request);
+    $bank->save;
+    $request->{target_div} = 'bank_act_div';
+    get($request);
+}
+
 1;

Modified: trunk/UI/Contact/divs/bank_act.html
===================================================================
--- trunk/UI/Contact/divs/bank_act.html	2012-05-29 09:32:38 UTC (rev 4799)
+++ trunk/UI/Contact/divs/bank_act.html	2012-05-29 10:08:25 UTC (rev 4800)
@@ -1,13 +1,12 @@
 <div class="container" id="bank_act_div">
 <div class="listtop"><?lsmb text('Bank Accounts') ?></div>
 <?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;
+href_base = script _ '?&entity_id=' _ entity_id _ '&target_div=bank_act_div' _
+            '&form_id=' _ form_id _ '&credit_id=' _ credit_id _ '&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.iban_href_suffix = '&bic=' _ ba.bic _ '&iban=' _ ba.iban _
+         '&action=edit' _ '&id=' _ ba.id;
+    ba.delete_href_suffix=ba.id _ '&action=delete_bank_account';
     ba.delete = '[' _ text('Delete') _ ']';
 END;
 PROCESS dynatable 
@@ -15,8 +14,9 @@
    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=' ' }
+     { col_id='iban', type='href', href_base=href_base, 
+         name=text('Account Number')}#'
+     { col_id='delete', type='href', href_base=href_base, name=' ' }
    ];
 ?>
 <form name="bank_acct" action="<?lsmb script ?>">
@@ -25,11 +25,6 @@
 		name = "form_id"
 		value = form_id
 	} ?>
-<?lsmb PROCESS input element_data = {
-		type = "hidden"
-		name = "target_div"
-		value = 'bank_div'
-	} ?>
 	<?lsmb PROCESS input element_data = {
 		type="hidden" 
 		name="entity_id" 
@@ -43,14 +38,14 @@
 	<?lsmb PROCESS input element_data = {
 		type="hidden" 
 		name="bank_account_id" 
-		value=bank_account_id
+		value=request.id
 	} ?>
 	<div>
 	<?lsmb INCLUDE input element_data = {
 		type="text" 
 		label = text('BIC/SWIFT Code')
 		name="bic" 
-		value=bic
+		value=request.bic
 		size=20
 	} #' ?>
 	</div>
@@ -59,7 +54,7 @@
 		type="text" 
 		label = text('Bank Account')
 		name="iban" 
-		value=iban
+		value=request.iban
 		size=20
 	} #' ?>
 	</div>

Modified: trunk/UI/Contact/divs/contact_info.html
===================================================================
--- trunk/UI/Contact/divs/contact_info.html	2012-05-29 09:32:38 UTC (rev 4799)
+++ trunk/UI/Contact/divs/contact_info.html	2012-05-29 10:08:25 UTC (rev 4800)
@@ -121,3 +121,4 @@
 </form>
 	
 </div>
+</div>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.