Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 28faaa2a

Von Tamino Steinert vor etwa 2 Monaten hinzugefügt

  • ID 28faaa2a0f73da818bdebda3e95253ee6d48a7d0
  • Vorgänger e945cb1d
  • Nachfolger aa7ea0f0

Varianten: Varianten Ausprägungen bearbeiten

Unterschiede anzeigen:

SL/Controller/Part.pm
246 246
  }
247 247

  
248 248
  my $new_select_tag = select_tag(
249
    "variants[].add_variant_property_value", \@options,
249
    "variants_properties[].add_variant_property_value", \@options,
250
    with_empty => 1,
250 251
    %select_tag_options
251 252
  );
252
  $self->js->replaceWith('[name^="variants[].add_variant_property_value"]', $new_select_tag);
253
  $self->js->replaceWith('[name^="variants_properties[].add_variant_property_value"]', $new_select_tag);
253 254

  
254 255
  my $new_select_tag_multible = select_tag(
255
    "add_variant_property_value_for_selected_variants", \@options,
256
    "add_variant_property_value_for_selected_variants_properties", \@options,
256 257
    %select_tag_options
257 258
  );
258
  $self->js->replaceWith("#add_variant_property_value_for_selected_variants", $new_select_tag_multible);
259
  $self->js->replaceWith("#add_variant_property_value_for_selected_variants_properties", $new_select_tag_multible);
259 260

  
260 261
  $self->js->render();
261 262
}
262 263

  
263
sub action_update_variants {
264
sub action_update_variants_values {
264 265
  my ($self) = @_;
265 266

  
266
  my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants}};
267
  my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants_values}};
267 268

  
268
  my $variant_property_id = $::form->{add_variant_property};
269
  SL::DB->client->with_transaction(sub {
270
    my $new_variant_property;
271
    foreach my $variant (@{$self->part->variants}) {
272
      my $variant_attributes = $variant_id_to_values{$variant->id};
273
      delete $variant_attributes->{$_} for qw(id position);
274
      $variant->update_attributes(%$variant_attributes);
275
    }
276
    1;
277
  }) or do {
278
    return $self->js->error(t8('Error while updating values of variants: #1', SL::DB->client->error))->render();
279
  };
280

  
281
  $self->redirect_to(
282
    controller => 'Part',
283
    action     => 'edit',
284
    'part.id'  => $self->part->id
285
  );
286
}
287

  
288
sub action_update_variants_properties {
289
  my ($self) = @_;
290

  
291
  my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants_properties}};
292

  
293
  my $variant_property_id = delete $::form->{add_variant_property};
269 294
  if ($variant_property_id) {
270 295
    foreach my $variant (@{$self->part->variants}) {
271
      die t8("Please select a new variant property value for all variants")
272
        unless $variant_id_to_values{$variant->id}->{"add_variant_property_value"};
296
      my $variant_values = $variant_id_to_values{$variant->id};
297
      $variant_values->{"variant_property_$variant_property_id"} =
298
        delete $variant_values->{"add_variant_property_value"}
299
        or die t8("Please select a new variant property value for all variants");
273 300
    }
274 301
  }
275 302

  
276
  SL::DB->client->with_transaction(sub {
277
    my $new_variant_property;
278
    if ($variant_property_id) {
279
      $new_variant_property = SL::DB::VariantPropertyPart->new(
280
        part_id             => $self->part->id,
281
        variant_property_id => $variant_property_id,
282
      )->save;
303
  my ($one_variant_id) = keys %variant_id_to_values;
304
  my %variant_property_ids =
305
    map { $_ => 1 }
306
    grep {$_ =~ m/^variant_property_/}
307
    keys %{$variant_id_to_values{$one_variant_id}};
308
  my $variant_property_id_string = join " ", sort keys %variant_property_ids;
309

  
310
  my %variant_property_values_to_variant;
311
  foreach my $variant (@{$self->part->variants}) {
312
    my %variant_values = %{$variant_id_to_values{$variant->id}};
313

  
314
    my $current_variant_property_id_string =
315
      join " ",
316
      sort
317
      grep {$_ =~ m/^variant_property_/}
318
      keys %variant_values;
319

  
320
    die "property ids doesn't match"
321
      . $current_variant_property_id_string . ";" .$variant_property_id_string
322
      if $current_variant_property_id_string ne $variant_property_id_string;
323

  
324
    my $variant_property_values =
325
      join " ",
326
      sort
327
      map {$variant_values{$_}}
328
      keys %variant_property_ids;
329

  
330
    if (defined $variant_property_values_to_variant{$variant_property_values}) {
331
      my $matching_variant = $variant_property_values_to_variant{$variant_property_values};
332
      die t8("The variants '#1' and '#2' would have the same variant property values.",
333
        $variant->displayable_name, $matching_variant->displayable_name
334
      );
335
    } else {
336
      $variant_property_values_to_variant{$variant_property_values} = $variant;
283 337
    }
338
  }
339

  
340
  SL::DB->client->with_transaction(sub {
341

  
342
    my @variant_properties =
343
      map {SL::DB::Manager::VariantProperty->find_by(id => $_)}
344
      map {$_ =~ s/^variant_property_//; $_}
345
      keys %variant_property_ids;
346

  
347
    $self->part->variant_properties(\@variant_properties);
348
    $self->part->save;
349

  
284 350
    foreach my $variant (@{$self->part->variants}) {
285
      my $variant_attributes = $variant_id_to_values{$variant->id};
286
      my $variant_property_value_id = delete $variant_attributes->{add_variant_property_value};
287
      delete $variant_attributes->{$_} for qw(id position);
288
      $variant->update_attributes(%$variant_attributes);
289
      if ($new_variant_property) {
290
        SL::DB::VariantPropertyValuePart->new(
291
          part_id                   => $variant->id,
292
          variant_property_value_id => $variant_property_value_id,
293
        )->save;
294
      }
351
      my %variant_values = %{$variant_id_to_values{$variant->id}};
352

  
353
      my @variant_property_values =
354
        map {
355
          SL::DB::Manager::VariantPropertyValue->find_by(
356
            id => $variant_values{"variant_property_" . $_->id}
357
          );
358
        }
359
        @variant_properties;
360

  
361
      $variant->variant_property_values(\@variant_property_values);
362
      $variant->save;
295 363
    }
296 364
    1;
297 365
  }) or do {
298
    return $self->js->error(t8('Error while adding variant property: #1', SL::DB->client->error))->render();
366
    return $self->js->error(t8('Error while updating variant properties: #1', SL::DB->client->error))->render();
299 367
  };
300 368

  
301 369
  $self->redirect_to(
......
932 1000
  $self->js->run('kivi.Part.redisplay_items', \@to_sort)->render;
933 1001
}
934 1002

  
935
sub action_reorder_variants {
1003
sub action_reorder_variants_values {
936 1004
  my ($self) = @_;
937 1005

  
938 1006
  my $part= $self->part;
......
961 1029

  
962 1030
  my %variant_id_to_position =
963 1031
    map {$_->{id} => $_->{position}}
964
    @{$::form->{variants}};
1032
    @{$::form->{variants_values}};
965 1033

  
966 1034
  my @to_sort = map { { old_pos => $variant_id_to_position{$_->id}, order_by => $method->($_) } } @items;
967 1035
  if ($::form->{order_by} =~ /^(listprice|sellprice|lastcost|onhand|rop)$/ ||
......
979 1047
    }
980 1048
  };
981 1049

  
982
  $self->js->run('kivi.Part.redisplay_variants', \@to_sort)->render;
1050
  $self->js->run('kivi.Part.redisplay_variants_values', \@to_sort)->render;
1051
}
1052

  
1053
sub action_reorder_variants_properties {
1054
  my ($self) = @_;
1055

  
1056
  my $part= $self->part;
1057

  
1058
  my %sort_keys = (
1059
    partnumber       => sub { $_[0]->partnumber },
1060
    description      => sub { $_[0]->description },
1061
    ean              => sub { $_[0]->ean },
1062
    variant_values   => sub { $_[0]->variant_values },
1063
  );
1064
  foreach my $variant_property (@{$part->variant_properties}) {
1065
    my $key = 'variant_property_' . $variant_property->id;
1066
    $sort_keys{$key} = sub {
1067
      $_[0]->get_variant_property_value_by_unique_name($variant_property->unique_name)->sortkey;
1068
    }
1069
  }
1070

  
1071
  my $method = $sort_keys{$::form->{order_by}};
1072

  
1073
  my @items = $part->variants;
1074

  
1075
  my %variant_id_to_position =
1076
    map {$_->{id} => $_->{position}}
1077
    @{$::form->{variants_properties}};
1078

  
1079
  my @to_sort = map { { old_pos => $variant_id_to_position{$_->id}, order_by => $method->($_) } } @items;
1080
  if ($::form->{order_by} =~ /^variant_property_/) {
1081
    if ($::form->{sort_dir}) {
1082
      @to_sort = sort { $a->{order_by} <=> $b->{order_by} } @to_sort;
1083
    } else {
1084
      @to_sort = sort { $b->{order_by} <=> $a->{order_by} } @to_sort;
1085
    }
1086
  } else {
1087
    if ($::form->{sort_dir}) {
1088
      @to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort;
1089
    } else {
1090
      @to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort;
1091
    }
1092
  };
1093

  
1094
  $self->js->run('kivi.Part.redisplay_variants_properties', \@to_sort)->render;
983 1095
}
984 1096

  
985 1097
sub action_warehouse_changed {
js/kivi.Part.js
103 103
    ns.renumber_positions();
104 104
  };
105 105

  
106
  ns.reorder_variants = function(order_by) {
107
    var dir = $('#variant_' + order_by + '_header_id a img').attr("data-sort-dir");
108
    $('#parent_variant_table thead a img').remove();
106
  ns.reorder_variants_values = function(order_by) {
107
    var dir = $('#variant_value_' + order_by + '_header_id a img').attr("data-sort-dir");
108
    $('#variant_value_table thead a img').remove();
109 109

  
110 110
    var src;
111 111
    if (dir == "1") {
......
116 116
      src = "image/down.png";
117 117
    }
118 118

  
119
    $('#variant_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
119
    $('#variant_value_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
120 120

  
121 121
    var data = $('#ic').serializeArray();
122
    data.push({ name: 'action',   value: 'Part/reorder_variants' },
122
    data.push({ name: 'action',   value: 'Part/reorder_variants_values' },
123 123
              { name: 'order_by', value: order_by              },
124 124
              { name: 'sort_dir', value: dir                   });
125 125

  
126 126
    $.post("controller.pl", data, kivi.eval_json_result);
127 127
  };
128 128

  
129
  ns.redisplay_variants = function(data) {
130
    var old_rows = $('.variant_row_entry').detach();
129
  ns.redisplay_variants_values = function(data) {
130
    console.log("data", data);
131
    var old_rows = $('.variant_value_row_entry').detach();
131 132
    var new_rows = [];
132 133
    $(data).each(function(idx, elt) {
133 134
      let new_row = old_rows[elt.old_pos - 1];
134
      $(new_row).find('[name="variants[].position"]').val( idx+1);
135
      $(new_row).find('[name="variants_values[].position"]').val( idx+1);
135 136
      new_rows.push(new_row);
136 137
    });
137
    $(new_rows).appendTo($('#parent_variant_table'));
138
    $(new_rows).appendTo($('#variant_value_table'));
138 139
  };
139 140

  
140
  ns.get_selected_variants = function() {
141
  ns.get_selected_variants_values = function() {
141 142
    let selected_rows = [];
142 143
    $('[name^="variant_multi_id_"]').each( function() {
143 144
      if (this.checked) {
......
147 148
    return selected_rows;
148 149
  }
149 150

  
150
  ns.variant_rows_toggle_selected = function() {
151
  ns.variant_value_rows_toggle_selected = function() {
151 152
    $('[name^="variant_multi_id_"]').each( function() {
152 153
      this.checked = !this.checked;
153 154
    });
154 155
  }
155 156

  
156 157
  ns.set_selected_variants_to_value = function(value_name) {
157
    let value = $('[name="' + value_name + '_for_selected_variants"]').val();
158
    let selected_rows = ns.get_selected_variants();
158
    let value = $('[name="' + value_name + '_for_selected_variants_values"]').val();
159
    let selected_rows = ns.get_selected_variants_values();
159 160
    selected_rows.forEach(function(row) {
160 161
      $(row).find(
161
        '[name="variants[].' + value_name  + '"]'
162
        '[name="variants_values[].' + value_name  + '"]'
162 163
      ).val(
163 164
        value
164 165
      );
165 166
    });
166 167
  };
167 168

  
169
  ns.reorder_variants_properties = function(order_by) {
170
    var dir = $('#variant_property_' + order_by + '_header_id a img').attr("data-sort-dir");
171
    $('#variant_property_table thead a img').remove();
172

  
173
    var src;
174
    if (dir == "1") {
175
      dir = "0";
176
      src = "image/up.png";
177
    } else {
178
      dir = "1";
179
      src = "image/down.png";
180
    }
181

  
182
    $('#variant_property_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
183

  
184
    var data = $('#ic').serializeArray();
185
    data.push({ name: 'action',   value: 'Part/reorder_variants_properties' },
186
              { name: 'order_by', value: order_by              },
187
              { name: 'sort_dir', value: dir                   });
188

  
189
    $.post("controller.pl", data, kivi.eval_json_result);
190
  };
191

  
192
  ns.redisplay_variants_properties = function(data) {
193
    var old_rows = $('.variant_property_row_entry').detach();
194
    var new_rows = [];
195
    $(data).each(function(idx, elt) {
196
      let new_row = old_rows[elt.old_pos - 1];
197
      $(new_row).find('[name="variants_properties[].position"]').val( idx+1);
198
      new_rows.push(new_row);
199
    });
200
    $(new_rows).appendTo($('#variant_property_table'));
201
  };
202

  
203

  
204
  ns.get_selected_variants_properties = function() {
205
    let selected_rows = [];
206
    $('[name^="variant_property_multi_id_"]').each( function() {
207
      if (this.checked) {
208
        selected_rows.push($(this).parents("tr").first());
209
      }
210
    });
211
    return selected_rows;
212
  }
213

  
214
  ns.variant_property_rows_toggle_selected = function() {
215
    $('[name^="variant_property_multi_id_"]').each( function() {
216
      this.checked = !this.checked;
217
    });
218
  }
219

  
220
  ns.set_selected_variants_to_property = function(value_name) {
221
    let value = $('[name="' + value_name + '_for_selected_variants_properties"]').val();
222
    let selected_rows = ns.get_selected_variants_properties();
223
    selected_rows.forEach(function(row) {
224
      $(row).find(
225
        '[name="variants_properties[].' + value_name  + '"]'
226
      ).val(
227
        value
228
      );
229
    });
230
  };
231

  
232
  ns.remove_variant_property = function(button) {
233
    if (!confirm(kivi.t8("Do you really want to delete the property?"))) return;
234
    let column_head_th = $(button).parents("th").first()[0];
235
    let index = column_head_th.cellIndex;
236
    let table = $('#variant_property_table')[0];
237
    for(const row of table.rows) {
238
      row.deleteCell(index);
239
    };
240
  };
241

  
168 242
  ns.assortment_recalc = function() {
169 243
    var data = $('#assortment :input').serializeArray();
170 244
    data.push(
......
411 485
    $.post("controller.pl", data, kivi.eval_json_result);
412 486
  };
413 487

  
414
  ns.update_variants = function() {
488
  ns.update_variants_values = function() {
489
    var data = $('#ic').serializeArray();
490
    data.push({ name: 'action', value: 'Part/update_variants_values' });
491
    $.post("controller.pl", data, kivi.eval_json_result);
492
  };
493

  
494
  ns.update_variants_properties = function() {
415 495
    var data = $('#ic').serializeArray();
416
    data.push({ name: 'action', value: 'Part/update_variants' });
496
    data.push({ name: 'action', value: 'Part/update_variants_properties' });
417 497
    $.post("controller.pl", data, kivi.eval_json_result);
418 498
  };
419 499

  
......
1075 1155

  
1076 1156
    $('#part_warehouse_id').change(kivi.Part.reload_bin_selection);
1077 1157

  
1078
    $('#variant_select_all').click( function() {
1158
    $('#variant_value_select_all').click( function() {
1159
      var checked = this.checked;
1160
      $('[name^="variant_value_multi_id_"]').each(function() {
1161
        this.checked =  checked;
1162
      });
1163
    });
1164

  
1165
    $('#variant_property_select_all').click( function() {
1079 1166
      var checked = this.checked;
1080
      $('[name^="variant_multi_id_"]').each(function() {
1167
      $('[name^="variant_property_multi_id_"]').each(function() {
1081 1168
        this.checked =  checked;
1082 1169
      });
1083 1170
    });
js/locale/de.js
51 51
"Details of article number \"#1\"":"Details von Artikel \"#1\"",
52 52
"Do you really want to cancel?":"Möchten Sie wirklich abbrechen?",
53 53
"Do you really want to continue?":"Möchten Sie wirklich fortfahren?",
54
"Do you really want to delete the property?":"Möchten Sie wirklich die Eigenschaft entfernen?",
54 55
"Do you really want to delete the selected documents?":"Möchten Sie wirklich diese Dateien löschen?",
55 56
"Do you really want to delete this draft?":"Möchten Sie diesen Entwurf wirklich löschen?",
56 57
"Do you really want to delete this record template?":"Möchten Sie diese Belegvorlage wirklich löschen?",
js/locale/en.js
51 51
"Details of article number \"#1\"":"",
52 52
"Do you really want to cancel?":"",
53 53
"Do you really want to continue?":"",
54
"Do you really want to delete the property?":"",
54 55
"Do you really want to delete the selected documents?":"",
55 56
"Do you really want to delete this draft?":"",
56 57
"Do you really want to delete this record template?":"",
locale/de/all
1188 1188
  'Delete Dataset'              => 'Datenbank löschen',
1189 1189
  'Delete Documents'            => 'Dokumente löschen',
1190 1190
  'Delete Images'               => 'Bilder löschen',
1191
  'Delete Property'             => 'Eigenschaft entfernen',
1191 1192
  'Delete Shipto'               => 'Lieferadresse löschen',
1192 1193
  'Delete address'              => 'Adresse löschen',
1193 1194
  'Delete all'                  => 'Alle Löschen',
......
1308 1309
  'Do you really want to delete AP transaction #1?' => 'Möchten Sie wirklich die Kreditorenbuchung #1 löschen?',
1309 1310
  'Do you really want to delete AR transaction #1?' => 'Möchten Sie wirklich die Debitorenbuchung #1 löschen?',
1310 1311
  'Do you really want to delete GL transaction #1?' => 'Möchten Sie wirklich die Dialogbuchung #1 löschen?',
1312
  'Do you really want to delete the property?' => 'Möchten Sie wirklich die Eigenschaft entfernen?',
1311 1313
  'Do you really want to delete the selected documents?' => 'Möchten Sie wirklich diese Dateien löschen?',
1312 1314
  'Do you really want to delete the selected links?' => 'Möchten Sie wirklich die ausgewählten Verknüpfungen löschen?',
1313 1315
  'Do you really want to delete the selected objects?' => 'Möchten Sie die ausgewählten Objekte wirklich löschen?',
......
1439 1441
  'Edit Preferences for #1'     => 'Einstellungen von #1 bearbeiten',
1440 1442
  'Edit Price Factor'           => 'Preisfaktor bearbeiten',
1441 1443
  'Edit Printer'                => 'Drucker bearbeiten',
1444
  'Edit Properties'             => 'Eigenschaften bearbeiten',
1442 1445
  'Edit Purchase Credit Note'   => 'Einkaufsgutschrift bearbeiten',
1443 1446
  'Edit Purchase Delivery Order' => 'Lieferschein (Einkauf) bearbeiten',
1444 1447
  'Edit Purchase Invoice'       => 'Einkaufsrechnung bearbeiten',
......
1592 1595
  'Error message from the database: #1' => 'Fehlermeldung der Datenbank: #1',
1593 1596
  'Error message from the webshop api:' => 'Fehlermeldung der Webshop Api',
1594 1597
  'Error when saving: #1'       => 'Fehler beim Speichern: #1',
1595
  'Error while adding variant property: #1' => 'Fehler beim Hinzufügen der Varianteneigenschaft: #1',
1596 1598
  'Error while applying year-end bookings!' => 'Fehler beim Durchführen der Abschlußbuchungen!',
1597 1599
  'Error while converting part to variant: ' => 'Fehler beim Umwandeln des Artikel zur Variante: ',
1598 1600
  'Error while creating project with project number of new order number, project number #1 already exists!' => 'Fehler beim Erstellen eines Projekts mit der Projektnummer der neuen Auftragsnummer, Projektnummer #1 existiert bereits!',
1599 1601
  'Error while creating variants: ' => 'Fehler beim Erstellen von Varianten: ',
1600 1602
  'Error while processing email journal (\'#1\') attachments with \'#2\': ' => 'Fehler beim Verarbeiten der E-Mail-Journals (\'#1\') Anhänge mit \'#2\': ',
1601 1603
  'Error while saving shop order #1. DB Error #2. Generic exception #3.' => 'Fehler beim Speichern der Shop-Bestellung #1. DB Fehler #2. Genereller Fehler #3.',
1604
  'Error while updating values of variants: #1' => 'Fehler beim Updaten der Werte der Varianten: #1',
1605
  'Error while updating variant properties: #1' => 'Fehler beim Updaten der Ausprägungen: #1',
1602 1606
  'Error with default taxzone'  => 'Ungültige Standardsteuerzone',
1603 1607
  'Error!'                      => 'Fehler!',
1604 1608
  'Error: #1'                   => 'Fehler: #1',
......
1941 1945
  'Hide Attachment'             => 'Anhang verbergen',
1942 1946
  'Hide Convert Part to Variant' => 'Artikel in Variante umwandeln verbergen',
1943 1947
  'Hide Create new Variants'    => 'Neue Varianten erstellen verbergen',
1948
  'Hide Edit Properties'        => 'Eigenschaften bearbeiten verbergen',
1944 1949
  'Hide Filter'                 => 'Filter verbergen',
1945 1950
  'Hide Records'                => 'Belege verbergen',
1946 1951
  'Hide all details'            => 'Alle Details verbergen',
......
3695 3700
  'Show Convert Part to Variant' => 'Artikel in Variante umwandeln zeigen',
3696 3701
  'Show Create new Variants'    => 'Neue Varianten erstellen zeigen',
3697 3702
  'Show E-Mails'                => 'E-Mails anzeigen',
3703
  'Show Edit Properties'        => 'Eigenschaften bearbeiten zeigen',
3698 3704
  'Show Filter'                 => 'Filter zeigen',
3699 3705
  'Show Records'                => 'Belege anzeigen',
3700 3706
  'Show Salesman'               => 'Verkäufer anzeigen',
......
4365 4371
  'The value \'#1\' is not a valid IBAN.' => 'Der Wert \'#1\' ist keine gültige IBAN.',
4366 4372
  'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => 'Der Wert »unsere Leitweg-ID beim Kunden« muss in den Kundenstammdaten gesetzt sein für Profil #1.',
4367 4373
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken',
4374
  'The variants \'#1\' and \'#2\' would have the same variant property values.' => 'Die Varianten \'#1\' und \'#2\' würden die gleichen Ausprägunen bekommen.',
4368 4375
  'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => 'Der Lieferant konnte nicht gefunden werden. Bitte registrieren Sie den Lieferanten mit dem exakten Namen aus der QR-Rechnung wie unten angezeigt.',
4369 4376
  'The vendor name is missing.' => 'Der Liefeantenname fehlt.',
4370 4377
  'The version number is missing.' => 'Die Versionsnummer fehlt.',
locale/en/all
1188 1188
  'Delete Dataset'              => '',
1189 1189
  'Delete Documents'            => '',
1190 1190
  'Delete Images'               => '',
1191
  'Delete Property'             => '',
1191 1192
  'Delete Shipto'               => '',
1192 1193
  'Delete address'              => '',
1193 1194
  'Delete all'                  => '',
......
1308 1309
  'Do you really want to delete AP transaction #1?' => '',
1309 1310
  'Do you really want to delete AR transaction #1?' => '',
1310 1311
  'Do you really want to delete GL transaction #1?' => '',
1312
  'Do you really want to delete the property?' => '',
1311 1313
  'Do you really want to delete the selected documents?' => '',
1312 1314
  'Do you really want to delete the selected links?' => '',
1313 1315
  'Do you really want to delete the selected objects?' => '',
......
1439 1441
  'Edit Preferences for #1'     => '',
1440 1442
  'Edit Price Factor'           => '',
1441 1443
  'Edit Printer'                => '',
1444
  'Edit Properties'             => '',
1442 1445
  'Edit Purchase Credit Note'   => '',
1443 1446
  'Edit Purchase Delivery Order' => '',
1444 1447
  'Edit Purchase Invoice'       => '',
......
1592 1595
  'Error message from the database: #1' => '',
1593 1596
  'Error message from the webshop api:' => '',
1594 1597
  'Error when saving: #1'       => '',
1595
  'Error while adding variant property: #1' => '',
1596 1598
  'Error while applying year-end bookings!' => '',
1597 1599
  'Error while converting part to variant: ' => '',
1598 1600
  'Error while creating project with project number of new order number, project number #1 already exists!' => '',
1599 1601
  'Error while creating variants: ' => '',
1600 1602
  'Error while processing email journal (\'#1\') attachments with \'#2\': ' => '',
1601 1603
  'Error while saving shop order #1. DB Error #2. Generic exception #3.' => '',
1604
  'Error while updating values of variants: #1' => '',
1605
  'Error while updating variant properties: #1' => '',
1602 1606
  'Error with default taxzone'  => '',
1603 1607
  'Error!'                      => '',
1604 1608
  'Error: #1'                   => '',
......
1940 1944
  'Hide Attachment'             => '',
1941 1945
  'Hide Convert Part to Variant' => '',
1942 1946
  'Hide Create new Variants'    => '',
1947
  'Hide Edit Properties'        => '',
1943 1948
  'Hide Filter'                 => '',
1944 1949
  'Hide Records'                => '',
1945 1950
  'Hide all details'            => '',
......
3694 3699
  'Show Convert Part to Variant' => '',
3695 3700
  'Show Create new Variants'    => '',
3696 3701
  'Show E-Mails'                => '',
3702
  'Show Edit Properties'        => '',
3697 3703
  'Show Filter'                 => '',
3698 3704
  'Show Records'                => '',
3699 3705
  'Show Salesman'               => '',
......
4363 4369
  'The value \'#1\' is not a valid IBAN.' => '',
4364 4370
  'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => '',
4365 4371
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => '',
4372
  'The variants \'#1\' and \'#2\' would have the same variant property values.' => '',
4366 4373
  'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => '',
4367 4374
  'The vendor name is missing.' => '',
4368 4375
  'The version number is missing.' => '',
templates/design40_webpages/part/_parent_variant.html
6 6

  
7 7
<div id="parent_variant" class="wrapper">
8 8
  <div class="input-panel">
9
    <h3> [% LxERP.t8("Variant Properties") %] </h3>
10
    <table id="parent_variant_table" class="tbl-list">
9
    <table id="variant_value_table" class="tbl-list">
11 10
      <caption>
12 11
        [% LxERP.t8("Variants") %]
13 12
      </caption>
14 13
      <thead>
15 14
      <tr>
16 15
        <th>
17
          [% L.checkbox_tag("varaint_select_all_multi_id",
18
              checked=0, id='variant_select_all'
16
          [% L.checkbox_tag("varaint_value_select_all_multi_id",
17
              checked=0, id='variant_value_select_all'
19 18
              alt=LxERP.t8('Select/Deselect all'), title=LxERP.t8('Select/Deselect all'),
20 19
            ) %]
21 20
        </th>
22
        <th id="variant_partnumber_header_id">
23
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("partnumber")'>
21
        <th id="variant_value_partnumber_header_id">
22
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("partnumber")'>
24 23
            [% 'Partnumber' | $T8 %]
25 24
          </a>
26 25
        </th>
27
        <th id="variant_ean_header_id">
28
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("ean")'>
26
        <th id="variant_value_ean_header_id">
27
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("ean")'>
29 28
            [% "EAN" | $T8 %]
30 29
          </a>
31 30
        </th>
32
        <th id="variant_description_header_id">
33
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("description")'>
31
        <th id="variant_value_description_header_id">
32
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("description")'>
34 33
            [% "Description" | $T8 %]
35 34
          </a>
36 35
        </th>
37
        <th id="variant_variant_values_header_id">
38
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("variant_values")'>
36
        <th id="variant_value_variant_values_header_id">
37
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("variant_values")'>
39 38
            [% "Property Values (Abbreviation)" | $T8 %]
40 39
          </a>
41 40
        </th>
42 41
        [% FOREACH variant_property = SELF.part.variant_properties %]
43
        <th id="variant_variant_property_[% variant_property.id %]_header_id">
44
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("variant_property_[% variant_property.id %]")'>
42
        <th id="variant_value_variant_property_[% variant_property.id %]_header_id">
43
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("variant_property_[% variant_property.id %]")'>
45 44
            [% variant_property.displayable_name %]
46 45
          </a>
47 46
        </th>
48 47
        [% END %]
49
        <th id="variant_listprice_header_id">
50
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("listprice")'>
48
        <th id="variant_value_listprice_header_id">
49
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("listprice")'>
51 50
            [% "List Price" | $T8 %]
52 51
          </a>
53 52
        </th>
54
        <th id="variant_sellprice_header_id">
55
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("sellprice")'>
53
        <th id="variant_value_sellprice_header_id">
54
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("sellprice")'>
56 55
            [% "Sell Price" | $T8 %]
57 56
          </a>
58 57
        </th>
59
        <th id="variant_lastcost_header_id">
60
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("lastcost")'>
58
        <th id="variant_value_lastcost_header_id">
59
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("lastcost")'>
61 60
            [% "Last Cost" | $T8 %]
62 61
          </a>
63 62
        </th>
64
        <th id="variant_onhand_header_id">
65
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("onhand")'>
63
        <th id="variant_value_onhand_header_id">
64
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("onhand")'>
66 65
            [% "On Hand" | $T8 %]
67 66
          </a>
68 67
        </th>
69
        <th id="variant_rop_header_id">
70
          <a href='#' onClick='javascript:kivi.Part.reorder_variants("rop")'>
68
        <th id="variant_value_rop_header_id">
69
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_values("rop")'>
71 70
            [% "ROP" | $T8 %]
72 71
          </a>
73 72
        </th>
74
        <th>
75
          [% L.select_tag("add_variant_property", AVAILABLE_VARIANT_PROPERIES
76
            title_key='displayable_name', value_key='id',
77
            with_empty=1, empty_title=LxERP.t8("Add Variant Property"),
78
            onchange='kivi.Part.update_variant_property_value_options();',
79
          )%]
80
        </th>
81 73
      </tr>
82 74
      <tr>
83 75
        <th>
......
89 81
        <th><!-- partnumber --></th>
90 82
        <th><!-- ean --></th>
91 83
        <th>
92
          [% L.input_tag("description_for_selected_variants", SELF.part.description,
84
          [% L.input_tag("description_for_selected_variants_values", SELF.part.description,
93 85
                          class="wi-medium",
94 86
                          ) %]
95 87
          [%- L.button_tag(
......
105 97
        [% END %]
106 98
        <th>
107 99
          [% L.input_tag(
108
                "listprice_as_number_for_selected_variants",
100
                "listprice_as_number_for_selected_variants_values",
109 101
                SELF.part.listprice_as_number,
110 102
                class="reformat_number numeric wi-small",
111 103
          ) %]
......
118 110
        </th>
119 111
        <th>
120 112
          [% L.input_tag(
121
                "sellprice_as_number_for_selected_variants",
113
                "sellprice_as_number_for_selected_variants_values",
122 114
                SELF.part.sellprice_as_number,
123 115
                class="reformat_number numeric wi-small",
124 116
          ) %]
......
131 123
        </th>
132 124
        <th>
133 125
          [% L.input_tag(
134
                "lastcost_as_number_for_selected_variants",
126
                "lastcost_as_number_for_selected_variants_values",
135 127
                SELF.part.lastcost_as_number,
136 128
                class="reformat_number numeric wi-small",
137 129
          ) %]
......
145 137
        <th><!-- onhand --></th>
146 138
        <th>
147 139
          [% L.input_tag(
148
                "rop_as_number_for_selected_variants",
140
                "rop_as_number_for_selected_variants_values",
149 141
                SELF.part.rop_as_number,
150 142
                class="reformat_number numeric wi-small",
151 143
          ) %]
......
156 148
                title=LxERP.t8('Apply to selected rows'),
157 149
          ) %]
158 150
        </th>
159
        <th>
160
          [% L.select_tag("add_variant_property_value_for_selected_variants", []
161
                title_key='displayable_name', value_key='id',
162
                with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
163
              ) %]
164
          [%- L.button_tag(
165
                'kivi.Part.set_selected_variants_to_value("add_variant_property_value")',
166
                "↓",
167
                alt=LxERP.t8('Apply to selected rows'),
168
                title=LxERP.t8('Apply to selected rows'),
169
          ) %]
170
        </th>
171 151
      </tr>
172 152
      </thead>
173 153
      <tbody class="listrow">
174 154
        [% FOREACH variant = SELF.part.variants %]
175
          <tr class="variant_row_entry">
176
            [% L.hidden_tag("variants[+].id", variant.id, id='variant_' _ variant.id) %]
177
            [% L.hidden_tag("variants[].position", loop.count) %]
155
          <tr class="variant_value_row_entry">
156
            [% L.hidden_tag("variants_values[+].id", variant.id, id='variant_' _ variant.id) %]
157
            [% L.hidden_tag("variants_values[].position", loop.count) %]
178 158
            <td>
179
              [% L.checkbox_tag('variant_multi_id_' _ loop.count, value=variant.id, checked=0) %]
159
              [% L.checkbox_tag('variant_value_multi_id_' _ loop.count, value=variant.id, checked=0) %]
180 160
            </td>
181 161
            <td>[% variant.presenter.part %]</td>
182 162
            <td>
183
              [% L.input_tag("variants[].ean", variant.ean, class="wi-medium") %]
163
              [% L.input_tag("variants_values[].ean", variant.ean, class="wi-medium") %]
184 164
            </td>
185 165
            <td>
186
              [% L.input_tag("variants[].description", variant.description, class="wi-medium") %]
166
              [% L.input_tag("variants_values[].description", variant.description, class="wi-medium") %]
187 167
            </td>
188 168
            <td>[% variant.variant_values | html %]</td>
189 169
            [% FOREACH variant_property = SELF.part.variant_properties %]
......
191 171
            [% END %]
192 172
            <td>
193 173
              [% L.input_tag(
194
                    "variants[].listprice_as_number",
174
                    "variants_values[].listprice_as_number",
195 175
                    variant.listprice_as_number,
196 176
                    class='reformat_number numeric wi-small',
197 177
              ) %]
198 178
            </td>
199 179
            <td>
200 180
              [% L.input_tag(
201
                    "variants[].sellprice_as_number",
181
                    "variants_values[].sellprice_as_number",
202 182
                    variant.sellprice_as_number,
203 183
                    class='reformat_number numeric wi-small',
204 184
              ) %]
205 185
            </td>
206 186
            <td>
207 187
              [% L.input_tag(
208
                    "variants[].lastcost_as_number",
188
                    "variants_values[].lastcost_as_number",
209 189
                    variant.lastcost_as_number,
210 190
                    class='reformat_number numeric wi-small',
211 191
              ) %]
......
217 197
            </td>
218 198
            <td>
219 199
              [% L.input_tag(
220
                    "variants[].rop_as_number",
200
                    "variants_values[].rop_as_number",
221 201
                    variant.rop_as_number,
222 202
                    class='reformat_number numeric wi-small',
223 203
              ) %]
224 204
            </td>
225
            <td>
226
              [% L.select_tag("variants[].add_variant_property_value", []
227
                title_key='displayable_name', value_key='id',
228
                with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
229
              ) %]
230
            </td>
231 205
          </tr>
232 206
        [% END %]
233 207
      </tbody>
234 208
    </table>
235
    [% L.button_tag('kivi.Part.update_variants();', LxERP.t8("Update Variants")) %]
209
    [% L.button_tag('kivi.Part.update_variants_values();', LxERP.t8("Update Variants")) %]
236 210
  </div>
237 211

  
238 212
  [% BLOCK panel_1 %]
......
318 292
  %]
319 293
  </div>
320 294

  
295
  <div class="wrapper">
296
  [%
297
    INCLUDE 'common/toggle_panel.html'
298
    block_name='panel_3'
299
    toggle_class='panel_3'
300
    display_status='open'
301
    button_closed=LxERP.t8('Show Edit Properties')
302
    button_open=LxERP.t8('Hide Edit Properties')
303
  %]
304
  </div>
305

  
306
  [% BLOCK panel_3 %]
307
    <h3> [% LxERP.t8("Edit Properties") %] </h3>
308
    <table id="variant_property_table" class="tbl-list">
309
      <caption>
310
        [% LxERP.t8("Variants") %]
311
      </caption>
312
      <thead>
313
      <tr>
314
        <th>
315
          [% L.checkbox_tag("varaint_property_select_all_multi_id",
316
              checked=0, id='variant_property_select_all'
317
              alt=LxERP.t8('Select/Deselect all'), title=LxERP.t8('Select/Deselect all'),
318
            ) %]
319
        </th>
320
        <th id="variant_property_partnumber_header_id">
321
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("partnumber")'>
322
            [% 'Partnumber' | $T8 %]
323
          </a>
324
        </th>
325
        <th id="variant_property_ean_header_id">
326
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("ean")'>
327
            [% "EAN" | $T8 %]
328
          </a>
329
        </th>
330
        <th id="variant_property_description_header_id">
331
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("description")'>
332
            [% "Description" | $T8 %]
333
          </a>
334
        </th>
335
        <th id="variant_property_variant_values_header_id">
336
          <a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("variant_values")'>
337
            [% "Property Values (Abbreviation)" | $T8 %]
338
          </a>
339
        </th>
340
        [% FOREACH variant_property = SELF.part.variant_properties %]
341
        <th id="variant_property_variant_property_[% variant_property.id %]_header_id">
342
          <span>
343
          <a style="color:#e0e0d6"
344
            href='#' onClick='javascript:kivi.Part.reorder_variants_properties("variant_property_[% variant_property.id %]")'>
345
            [% variant_property.displayable_name | html %]
346
          </a>
347
          [% L.button_tag('kivi.Part.remove_variant_property(this)', 'X'
348
            title=LxERP.t8('Delete Property'),
349
            alt=LxERP.t8('Delete Property'),
350
          )%]
351
          </span>
352
        </th>
353
        [% END %]
354
        <th>
355
          [% L.select_tag("add_variant_property", AVAILABLE_VARIANT_PROPERIES
356
            title_key='displayable_name', value_key='id',
357
            with_empty=1, empty_title=LxERP.t8("Add Variant Property"),
358
            onchange='kivi.Part.update_variant_property_value_options();',
359
          )%]
360
        </th>
361
      </tr>
362
      <tr>
363
        <th>
364
          [%- L.button_tag('kivi.Part.variant_property_rows_toggle_selected();', "🔄",
365
                           title=LxERP.t8("Toggle selection"),
366
                           alt=LxERP.t8("Toggle selection"),
367
                           ) %]
368
        </th>
369
        <th><!-- partnumber --></th>
370
        <th><!-- ean --></th>
371
        <th><!-- description --></th>
372
        <th><!-- variant_values --></th>
373
        [% FOREACH variant_property = SELF.part.variant_properties %]
374
        <th>
375
          [% L.select_tag("variant_property_" _ variant_property.id _ "_for_selected_variants_properties",
376
                variant_property.property_values_sorted
377
                title_key='displayable_name', value_key='id'
378
              ) %]
379
          [%- L.button_tag(
380
                'kivi.Part.set_selected_variants_to_property("variant_property_' _ variant_property.id _ '")',
381
                "↓",
382
                alt=LxERP.t8('Apply to selected rows'),
383
                title=LxERP.t8('Apply to selected rows'),
384
          ) %]
385
        </th>
386
        [% END %]
387
        <th>
388
          [% L.select_tag("add_variant_property_value_for_selected_variants_properties", []
389
                title_key='displayable_name', value_key='id',
390
                with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
391
              ) %]
392
          [%- L.button_tag(
393
                'kivi.Part.set_selected_variants_to_property("add_variant_property_value")',
394
                "↓",
395
                alt=LxERP.t8('Apply to selected rows'),
396
                title=LxERP.t8('Apply to selected rows'),
397
          ) %]
398
        </th>
399
      </tr>
400
      </thead>
401
      <tbody class="listrow">
402
        [% FOREACH variant = SELF.part.variants %]
403
          <tr class="variant_property_row_entry">
404
            [% L.hidden_tag("variants_properties[+].id", variant.id, id='variant_' _ variant.id) %]
405
            [% L.hidden_tag("variants_properties[].position", loop.count) %]
406
            <td>
407
              [% L.checkbox_tag('variant_property_multi_id_' _ loop.count, value=variant.id, checked=0) %]
408
            </td>
409
            <td>[% variant.presenter.part %]</td>
410
            <td><span class="data wi-medium">
411
              [% variant.ean | html %]
412
            </span></td>
413
            <td><span class="data wi-normal">
414
              [% variant.description | html %]
415
            </span></td>
416
            <td>[% variant.variant_values | html %]</td>
417
            [% FOREACH variant_property = SELF.part.variant_properties %]
418
            <td>
419
              [% L.select_tag("variants_properties[].variant_property_" _ variant_property.id,
420
                variant_property.property_values_sorted
421
                title_key='displayable_name', value_key='id',
422
                default=variant.variant_value(variant_property).id
423
              ) %]
424
            </td>
425
            [% END %]
426
            <td>
427
              [% L.select_tag("variants_properties[].add_variant_property_value", []
428
                title_key='displayable_name', value_key='id',
429
                with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
430
              ) %]
431
            </td>
432
          </tr>
433
        [% END %]
434
      </tbody>
435
    </table>
436
    [% L.button_tag('kivi.Part.update_variants_properties();', LxERP.t8("Update Variants")) %]
437
  [% END %]
438

  
321 439
</div>
322 440

  
323 441

  

Auch abrufbar als: Unified diff