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

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



Revision: 3337
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3337&view=rev
Author:   einhverfr
Date:     2011-06-26 10:35:30 +0000 (Sun, 26 Jun 2011)

Log Message:
-----------
Contact editing/deletion now works for employees too

Modified Paths:
--------------
    trunk/UI/Contact/contact.html
    trunk/scripts/employee.pl

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2011-06-26 05:27:56 UTC (rev 3336)
+++ trunk/UI/Contact/contact.html	2011-06-26 10:35:30 UTC (rev 3337)
@@ -390,17 +390,6 @@
 		value = account_class
 	} ?>	
         <table>
-	<tr class="pay_to_row">
-	<td colspan = "2">
-	<?lsmb PROCESS input element_data = {
-		label = text('Pay To') #'
-		type = "text"
-		sixe = "50"
-		name = "pay_to_name"
-		value = pay_to_name
-		class = "name"
-	} ?>
-	</td>
 	<tr class="eca_row">
 	<td>
  	<?lsmb PROCESS input element_data = {
@@ -418,6 +407,18 @@
 		size = "20"
 	} ?></td>
 	</tr>
+	<tr class="pay_to_row">
+	<td colspan = "2">
+	<?lsmb PROCESS input element_data = {
+		label = text('Pay To') #'
+		type = "text"
+		sixe = "50"
+		name = "pay_to_name"
+		value = pay_to_name
+		class = "name"
+	} ?>
+	</td>
+        </tr>
         <tr id="date-row">
             <td>
 		<?lsmb PROCESS input element_data = {
@@ -703,13 +704,15 @@
 			?>&location_id=<?lsmb loc.id ?>&credit_id=<?lsmb 
 			credit_id ?>&country_code=<?lsmb loc.country_id
                         ?>&target_div=location_div&location_class=<?lsmb
-                        loc.class_id ?>">[edit]</a> 
+                        loc.class_id ?>&person_id=<?lsmb tt_url(person_id) 
+                        ?>">[edit]</a> 
 		<a href="<?lsmb script ?>?action=delete_location&entity_id=<?lsmb
 			entity_id ?>&location_id=<?lsmb loc.id 
 			?>&credit_id=<?lsmb credit_id 
                         ?>&form_id=<?lsmb form_id
                         ?>&location_class=<?lsmb loc.class_id 
-                        ?>&target_div=location_div">[delete]</a>
+                        ?>&target_div=location_div&person_id=<?lsmb person_id
+                        ?>">[delete]</a>
 	</td>
     </tr>
 	<?lsmb END ?>
@@ -831,7 +834,9 @@
 				?>&contact_class=<?lsmb tt_url(ct.class_id)
 				?>&description=<?lsmb tt_url(ct.description)
 				?>&action=edit&credit_id=<?lsmb 
-				tt_url(credit_id) ?>&target_div=contact_div"
+				tt_url(credit_id) 
+                                ?>&person_id=<?lsmb tt_url(person_id)
+                                ?>&target_div=contact_div"
 			>[<?lsmb text('Edit'); ?>]</a>&nbsp;&nbsp;
 			<a href="<?lsmb tt_url(script) 
 				?>?entity_id=<?lsmb tt_url(entity_id) 
@@ -840,6 +845,7 @@
 				?>&action=delete_contact&credit_id=<?lsmb 
 				tt_url(credit_id) ?>&form_id=<?lsmb form_id 
                                 ?>&contact=<?lsmb tt_url(ct.contact)
+                                ?>&person_id=<?lsmb tt_url(person_id)
                                 ?>&target_div=contact_div"
 			>[<?lsmb text('Delete'); ?>]</a>
 		</td>

Modified: trunk/scripts/employee.pl
===================================================================
--- trunk/scripts/employee.pl	2011-06-26 05:27:56 UTC (rev 3336)
+++ trunk/scripts/employee.pl	2011-06-26 10:35:30 UTC (rev 3337)
@@ -115,7 +115,7 @@
 sub delete_contact {
     my ($request) = @_;
     my $employee= LedgerSMB::DBObject::Employee->new(base => $request, copy => 'all');
-    if (_close_form($company)){
+    if (_close_form($employee)){
         $employee->delete_contact();
     }
     $employee->get;
@@ -201,6 +201,16 @@
     _render_main_screen( $employee);
 }
 
+# Private method.  Sets notice if form could not be closed.
+sub _close_form {
+    my ($employee) = @_;
+    if (!$employee->close_form()){
+        $employee->{notice} = 
+               $employee->{_locale}->text('Changes not saved.  Please try again.');
+        return 0;
+    }
+    return 1;
+}
 =pod
 
 =over
@@ -361,6 +371,9 @@
 sub _render_main_screen{
     my $employee = shift @_;
     $employee->get_metadata();
+    $employee->close_form;
+    $employee->open_form;
+    $employee->{dbh}->commit;
     $employee->{entity_class} = 3;
     $employee->{creditlimit} = "$employee->{creditlimit}"; 
     $employee->{discount} = "$employee->{discount}"; 


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