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

SF.net SVN: ledger-smb:[2803] addons/1.3/assets/trunk/UI/asset



Revision: 2803
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2803&view=rev
Author:   einhverfr
Date:     2009-12-06 23:25:50 +0000 (Sun, 06 Dec 2009)

Log Message:
-----------
Minor changes to fix account defaults automation in asset management

Modified Paths:
--------------
    addons/1.3/assets/trunk/UI/asset/asset.js
    addons/1.3/assets/trunk/UI/asset/edit_asset.html

Modified: addons/1.3/assets/trunk/UI/asset/asset.js
===================================================================
--- addons/1.3/assets/trunk/UI/asset/asset.js	2009-12-04 22:29:47 UTC (rev 2802)
+++ addons/1.3/assets/trunk/UI/asset/asset.js	2009-12-06 23:25:50 UTC (rev 2803)
@@ -3,24 +3,32 @@
     var dep_dropdown = document.getElementById('dep-account-id');
     var old_class = document.getElementById('last-class-id').value;
     var class_dropdown = document.getElementById('asset-class');
-    var new_class = class_dropdown.options[class_dropdown.selectedIndex].value;;
-    document.getElementById('asset-account-' + old_account).value 
-    = asset_dropdown.options[asset_dropdown.selectedIndex].value;
-    document.getElementById('dep-account-' + old_account).value 
-    = dep_dropdown.options[dep_dropdown.selectedIndex].value;
+    var new_class = class_dropdown.options[class_dropdown.selectedIndex].value;
+    if (new_class == ""){
+        new_class = class_dropdown.options[0].value;
+    }
+    if (old_class != ""){
+        document.getElementById('asset-account-default-' + old_class).value 
+        = asset_dropdown.options[asset_dropdown.selectedIndex].value;
+        document.getElementById('dep-account-default-' + old_class).value 
+        = dep_dropdown.options[dep_dropdown.selectedIndex].value;
+    }
+    document.getElementById('last-class-id').value = new_class;
 
     set_dropdown(asset_dropdown, 
-                 document.getElementById('asset-account-' + new_account).value);
+                 document.getElementById('asset-account-default-' + new_class).value);
     set_dropdown(dep_dropdown,
-                 document.getElementById('dep-account-' + new_account).value);
+                 document.getElementById('dep-account-default-' + new_class).value);
 }
 
 function set_dropdown (selectElement, newValue){
     for (var i = 0; i < selectElement.options.length; i++) {
-        if (selectElement.options[i].value = newValue) {
+        if (selectElement.options[i].value == newValue) {
            selectElement.options[i].selected = true;
+           window.alert('Selecting ' + selectElement.options[i].value);
         } else {
            selectElement.options[i].selected = false;
+          window.alert('Not Selecting ' + selectElement.options[i].value);
         }
     }
    

Modified: addons/1.3/assets/trunk/UI/asset/edit_asset.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/edit_asset.html	2009-12-04 22:29:47 UTC (rev 2802)
+++ addons/1.3/assets/trunk/UI/asset/edit_asset.html	2009-12-06 23:25:50 UTC (rev 2803)
@@ -12,18 +12,18 @@
 	name = "id"
 	value = id
 } ?>
-<?lsmb FOR a_class in asset_classes ?>
+<?lsmb FOREACH a_class IN asset_classes -?>
 <?lsmb PROCESS input element_data = {
-       type = "hidden"
-       name = "asset_account_default_" _ a_class.id
-       value = a_class.asset_account_id
+       type = "hidden",
+       name = "asset_account_default_$a_class.id",
+       value = a_class.asset_account_id,
 } ?>
 <?lsmb PROCESS input element_data = {
-       type = "hidden"
-       name = "dep_account_default_" _ a_class.id
-       value = a_class.dep_account_id
+       type = "hidden",
+       name = "dep_account_default_$a_class.id",
+       value = a_class.dep_account_id,
 } ?>
-<?lsmb END # For a_class ?>
+<?lsmb- END # For a_class ?>
 <?lsmb PROCESS input element_data = {
        type = "hidden"
        name = "last_class_id"


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