Nachtrag zum Commit von eben zu für 2284
authorJan Büren <jan@kivitendo-premium.de>
Thu, 30 May 2013 12:14:57 +0000 (14:14 +0200)
committerJan Büren <jan@kivitendo-premium.de>
Thu, 30 May 2013 12:14:57 +0000 (14:14 +0200)
Copy / Paste Fehler in form_header.html
Copy / Paste Fehler in Default.pm
Vergessene ausgelagerte common select_warehouse_bin.html
hinzugefügt.

SL/DB/MetaSetup/Default.pm
templates/webpages/common/select_warehouse_bin.html [new file with mode: 0644]
templates/webpages/ic/form_header.html

index 1fde1bb..d6b6b84 100644 (file)
@@ -85,7 +85,7 @@ __PACKAGE__->meta->setup(
     warehouse => {
       class       => 'SL::DB::Warehouse',
       key_columns => { warehouse_id => 'id' },
-
+    },
     currency => {
       class       => 'SL::DB::Currency',
       key_columns => { currency_id => 'id' },
diff --git a/templates/webpages/common/select_warehouse_bin.html b/templates/webpages/common/select_warehouse_bin.html
new file mode 100644 (file)
index 0000000..f7d854a
--- /dev/null
@@ -0,0 +1,57 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE JavaScript -%]
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/parts_language_selection.js"></script>
+ <script type="text/javascript">
+  <!--
+      warehouses = new Array();
+      [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
+      warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
+      warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
+      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
+      [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
+      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]] = new Array();
+      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
+      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
+      [% END %]
+      [% END %]
+
+      function warehouse_selected(warehouse_id, bin_id) {
+        var control = document.getElementById("bin_id");
+
+        for (var i = control.options.length - 1; i >= 0; i--) {
+          control.options[i] = null;
+        }
+
+        var warehouse_index = 0;
+
+        for (i = 0; i < warehouses.length; i++)
+          if (warehouses[i]['id'] == warehouse_id) {
+            warehouse_index = i;
+            break;
+          }
+
+        var warehouse = warehouses[warehouse_index];
+        var bin_index = 0;
+
+        for (i = 0; i < warehouse['bins'].length; i++)
+          if (warehouse['bins'][i]['id'] == bin_id) {
+            bin_index = i;
+            break;
+          }
+
+        for (i = 0; i < warehouse['bins'].length; i++) {
+          control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
+        }
+
+
+        control.options[bin_index].selected = true;
+      }
+
+      $(function() {
+        warehouse_selected([% warehouse_id %], [% bin_id %]);
+      })
+    -->
+ </script>
index 32527a9..a892bd5 100644 (file)
@@ -1,4 +1,4 @@
-[[%- USE T8 %]
+[%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
 [% PROCESS 'common/select_warehouse_bin.html' %]