Layout: title Ausgabe normalisieren
[kivitendo-erp.git] / templates / webpages / dbupgrade / default_bin_parts.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE JavaScript %]
5 <h1>[% '<b>Default Bins Migration !READ CAREFULLY!</b>' | $T8 %]</h1>
6
7  <script type="text/javascript" src="js/common.js"></script>
8  <script type="text/javascript">
9   <!--
10      warehouses = new Array();
11      [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
12       warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
13       warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
14       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
15       [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
16       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]] = new Array();
17       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
18       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
19       [% END %]
20       [% END %]
21       //var rowcount = [% rowcount %];
22       //var rowcount = 3; //[% rowcount %];
23       function warehouse_selected(warehouse_id, bin_id, loop) {
24         var control = document.getElementById("bin_id_" + loop);
25
26         for (var i = control.options.length - 1; i >= 0; i--) {
27           control.options[i] = null;
28         }
29
30         var warehouse_index = 0;
31
32         for (i = 0; i < warehouses.length; i++)
33           if (warehouses[i]['id'] == warehouse_id) {
34             warehouse_index = i;
35             break;
36           }
37
38         var warehouse = warehouses[warehouse_index];
39         var bin_index = 0;
40
41         for (i = 0; i < warehouse['bins'].length; i++)
42           if (warehouse['bins'][i]['id'] == bin_id) {
43             bin_index = i;
44             break;
45           }
46
47         for (i = 0; i < warehouse['bins'].length; i++) {
48           control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
49         }
50
51
52         control.options[bin_index].selected = true;
53       }
54
55       function bin_match(rowcount) {
56         for (i = 1; i <= rowcount + 1; i++) {              // über alle parts_id
57           var lagerplatz = document.getElementById("bin_" + i).value;
58           var control = document.getElementById("bin_id_" + i);
59           var bin_index = 0;
60           for (j = 0; j < warehouses.length; j++) {       // über alle lager
61             var warehouse = warehouses[j];
62
63             for (k = 0; k < warehouse['bins'].length; k++) {       // über alle lagerplätze
64
65               if (lagerplatz == warehouse['bins'][k]['description']) {
66                 var lager = document.getElementById("warehouse_id_" + i);
67                 lager.selectedIndex = j;
68                 bin_index = k;
69                 for (bin_i = 0; bin_i < warehouse['bins'].length; bin_i++) {
70                   control.options[bin_i] = new Option(warehouse['bins'][bin_i]['description'], warehouse['bins'][bin_i]['id']);
71                 }
72                 control.options[bin_index].selected = true;
73                 break;
74                 /*var lagerplatz = document.getElementById("bin_id_" + i);
75                 alert('lagerplatz ' + lagerplatz.value);
76                 lagerplatz.selectedIndex = k; */
77               }
78
79             }
80           }
81         }
82
83       }
84
85
86       $(function() {
87         warehouse_selected([% warehouse_id %], [% bin_id %]);
88       })
89     -->
90  </script>
91
92
93
94 <form name="Form" method="post" action="login.pl">
95 <input type="hidden" name="action" value="login">
96 <input type="hidden" name="continued" value="1">
97
98
99
100 <p>[% 'There are Bins defined in your Inventory.' | $T8 %]</p>
101 <p>[% 'The Bins in Inventory were only a information text field.' | $T8 %]</p>
102 <p>[% 'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' | $T8 %]</p>
103 <p>[% 'If your old bins match exactly Bins in the Warehouse CLICK on <b>AUTOMATICALLY MATCH BINS</b>.' | $T8 %]</p>
104 <p>[% 'Otherwise you can simply check create warehouse and bins and define a name for the warehouse (Bins will be created automatically) and then continue'  | $T8 %]</p>
105 <p>[% 'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).'  | $T8 %]</p>
106
107 <table>
108   <tr>
109     <th class="listheading">[% 'Partnumber' | $T8 %]</th>
110     <th class="listheading">[% 'Description' | $T8 %]</th>
111     <th class="listheading">[% 'Bin' | $T8 %]</th>
112     <th class="listheading">[% 'Default Warehouse' | $T8 %]</th>
113     <th class="listheading">[% 'Default Bin' | $T8 %]</th>
114   </tr>
115
116   [% SET row_odd = '1' %][% FOREACH row = PARTS %]
117   <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
118    <td align="left"> [% HTML.escape(row.partnumber) %]</a></td>
119     <td align="left"> [% HTML.escape(row.description) %]</a></td>
120     <td align="right">[% HTML.escape(row.bin) %]
121     <input type="hidden" id="bin_[% loop.count %]" name="bin_[% loop.count %]" value="[% HTML.escape(row.bin) %]">
122     </td>
123     <td>
124     <input type="hidden" name='partid_[% loop.count %]' value='[% HTML.escape(row.id) %]'>
125      <select id="warehouse_id_[% loop.count %]" name="warehouse_id_[% loop.count %]" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0, [% loop.count %])">
126              [%- FOREACH warehouse = WAREHOUSES %]
127                <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id  == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
128              [%- END %]
129                 <option value=""  [% IF warehouse_id  == 0 %] selected[% END %] ></option>
130      </select>
131     </td>
132     <td><select id="bin_id_[% loop.count %]" name="bin_id_[% loop.count %]"></select></td>
133   </tr>
134   [% SET rowcount = loop.count %]
135   [% END %]
136   <input type="hidden" name="rowcount" value="[% rowcount %]">
137   <tr><td colspan="5"><hr/></td></tr>
138   <tr><td colspan="5">
139          <input type="checkbox" name="create_new_bins"> [% '<b>Automatically create new bins</b> in the following warehouse if not selected in the list above' | $T8 %]
140           <select id="warehouse_id_default" name="warehouse_id_default">
141              [%- FOREACH warehouse = WAREHOUSES %]
142                <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id  == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
143              [%- END %]
144                 <option value=""  [% IF warehouse_id  == 0 %] selected[% END %] ></option>
145          </select>
146       </td>
147   </tr>
148
149   <tr><td colspan="5"><hr/></td></tr>
150  <tr><td><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"> </td><td colspan="3" align="center"><b><input style="background-color:#FFEE66" type="button" value="[% 'AUTOMATICALLY MATCH BINS' | $T8 %]"  onclick="bin_match([% rowcount %])"></b> </td><td><input type="submit" value="[% 'Continue' | $T8 %]"></td></tr>
151 </table>
152 </form>