Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1809c22

Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt

  • ID d1809c2258dc72d73a6aaf9392bdf290fc5ee289
  • Vorgänger fe4deda7
  • Nachfolger d339e8dc

Auftrags-Controller: neuen Artikel aus Maske heraus anlegen können

Unterschiede anzeigen:

SL/Controller/Order.pm
777 777
sub action_add_item {
778 778
  my ($self) = @_;
779 779

  
780
  delete $::form->{add_item}->{create_part_type};
781

  
780 782
  my $form_attr = $::form->{add_item};
781 783

  
782 784
  return unless $form_attr->{parts_id};
......
976 978
  $self->render_price_dialog($item);
977 979
}
978 980

  
981
# save the order in a session variable and redirect to the part controller
982
sub action_create_part {
983
  my ($self) = @_;
984

  
985
  $::lxdebug->dump(0, "bb: form", $::form);
986
  my $previousform = $::auth->save_form_in_session(non_scalars => 1);
987

  
988
  my $callback     = $self->url_for(
989
    action       => 'return_from_create_part',
990
    type         => $self->type, # type is needed for check_auth on return
991
    previousform => $previousform,
992
  );
993

  
994
  flash_later('info', t8('You are adding a new part while you are editing another document. You will be redirected to your document when saving the new part or aborting this form.'));
995

  
996
  my @redirect_params = (
997
    controller => 'Part',
998
    action     => 'add',
999
    part_type  => $::form->{add_item}->{create_part_type},
1000
    callback   => $callback,
1001
    show_abort => 1,
1002
  );
1003

  
1004
  $self->redirect_to(@redirect_params);
1005
}
1006

  
1007
sub action_return_from_create_part {
1008
  my ($self) = @_;
1009

  
1010
  $self->{created_part} = SL::DB::Part->new(id => delete $::form->{new_parts_id})->load if $::form->{new_parts_id};
1011

  
1012
  $::auth->restore_form_from_session(delete $::form->{previousform});
1013

  
1014
  # set item ids to new fake id, to identify them as new items
1015
  foreach my $item (@{$self->order->items_sorted}) {
1016
    $item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
1017
  }
1018

  
1019
  $self->recalc();
1020
  $self->get_unalterable_data();
1021
  $self->pre_render();
1022

  
1023
  # trigger rendering values for second row/longdescription as hidden,
1024
  # because they are loaded only on demand. So we need to keep the values
1025
  # from the source.
1026
  $_->{render_second_row}      = 1 for @{ $self->order->items_sorted };
1027
  $_->{render_longdescription} = 1 for @{ $self->order->items_sorted };
1028

  
1029
  $self->render(
1030
    'order/form',
1031
    title => $self->get_title_for('edit'),
1032
    %{$self->{template_args}}
1033
  );
1034

  
1035
}
1036

  
979 1037
# load the second row for one or more items
980 1038
#
981 1039
# This action gets the html code for all items second rows by rendering a template for
SL/Controller/Part.pm
157 157
  }
158 158
}
159 159

  
160
sub action_abort {
161
  my ($self) = @_;
162

  
163
  if ( $::form->{callback} ) {
164
    $self->redirect_to($::form->unescape($::form->{callback}));
165
  }
166
}
167

  
160 168
sub action_delete {
161 169
  my ($self) = @_;
162 170

  
......
1334 1342
        ],
1335 1343
      ], # end of combobox "Save"
1336 1344

  
1345
      action => [
1346
        t8('Abort'),
1347
        submit   => [ '#ic', { action => "Part/abort" } ],
1348
        only_if  => !!$::form->{show_abort},
1349
      ],
1350

  
1337 1351
      action => [
1338 1352
        t8('Delete'),
1339 1353
        call     => [ 'kivi.Part.delete' ],
doc/changelog
34 34
   - Anzeige der Mails im Mahnbericht
35 35
   - DB-Trigger zum Löschen von Verknüpfungen beim Löschen einer
36 36
     Mahnung
37
 - Neuer Order-Controller: Artikel können während der Erfassung eines
38
   Angebots bzw. Auftrags erfasst werden.
37 39

  
38 40
Kleinere neue Features und Detailverbesserungen:
39 41
  - Der Status geliefert bei Aufträgen kann mit oder ohne Dienstleistungen
js/kivi.Order.js
837 837
    follow_up_window();
838 838
  };
839 839

  
840
  ns.create_part = function() {
841
    var data = $('#order_form').serializeArray();
842
    data.push({ name: 'action', value: 'Order/create_part' });
843

  
844
    $.post("controller.pl", data, kivi.eval_json_result);
845
  };
846

  
840 847
});
841 848

  
842 849
$(function() {
locale/de/all
29 29
  '%'                           => '%',
30 30
  '(recommended) Insert the used currencies in the system. You can simply change the name of the currencies by editing the textfields above. Do not use a name of a currency that is already in use.' => '(empfohlen) Fügen Sie die verwaisten Währungen in Ihr System ein. Sie können den Namen der Währung einfach ändern, indem Sie die Felder oben bearbeiten. Benutzen Sie keine Namen von Währungen, die Sie bereits benutzen.',
31 31
  '*/'                          => '*/',
32
  '+'                           => '+',
32 33
  ', if set'                    => ', falls gesetzt',
33 34
  '---please select---'         => '---bitte auswählen---',
34 35
  '. Automatically generated.'  => '. Automatisch erzeugt.',
......
746 747
  'Create a new client'         => 'Einen neuen Mandanten anlegen',
747 748
  'Create a new delivery term'  => 'Neue Lieferbedingungen anlegen',
748 749
  'Create a new group'          => 'Neue Benutzergruppe erfassen',
750
  'Create a new part'           => 'Einen neuen Artikel anlegen',
749 751
  'Create a new payment term'   => 'Neue Zahlungsbedingungen anlegen',
750 752
  'Create a new price rule'     => 'Neue Preisregel anlegen',
751 753
  'Create a new printer'        => 'Einen neuen Drucker anlegen',
......
4129 4131
  'Yes'                         => 'Ja',
4130 4132
  'Yes, included by default'    => 'Ja, standardmäßig an',
4131 4133
  'Yes/No (Checkbox)'           => 'Ja/Nein (Checkbox)',
4134
  'You are adding a new part while you are editing another document. You will be redirected to your document when saving the new part or aborting this form.' => 'Sie legen einen neuen Artikel an, während Sie ein anderes Dokument bearbeiten. Sie werden zu Ihrem Dokument zurückgeleitet, wenn Sie den Artikel speichern oder die Bearbeitung dieser Maske abbrechen.',
4132 4135
  'You are logged out!'         => 'Auf Wiedersehen!',
4133 4136
  'You can also delete this transaction and re-enter it manually.' => 'Alternativ können Sie die Buchung auch mit löschen lassen und sie anschließend neu eingeben.',
4134 4137
  'You can choose account categories for taxes. Depending on these categories taxes will be displayed for transfers in the general ledger or not.' => 'Sie können Kontoarten für Steuern auswählen. Abhängig von diesen Kontoarten werden dann Steuern bei Dialogbuchungen angezeigt oder nicht.',
locale/en/all
29 29
  '%'                           => '',
30 30
  '(recommended) Insert the used currencies in the system. You can simply change the name of the currencies by editing the textfields above. Do not use a name of a currency that is already in use.' => '',
31 31
  '*/'                          => '',
32
  '+'                           => '',
32 33
  ', if set'                    => '',
33 34
  '---please select---'         => '',
34 35
  '. Automatically generated.'  => '',
......
746 747
  'Create a new client'         => '',
747 748
  'Create a new delivery term'  => '',
748 749
  'Create a new group'          => '',
750
  'Create a new part'           => '',
749 751
  'Create a new payment term'   => '',
750 752
  'Create a new price rule'     => '',
751 753
  'Create a new printer'        => '',
......
4128 4130
  'Yes'                         => '',
4129 4131
  'Yes, included by default'    => '',
4130 4132
  'Yes/No (Checkbox)'           => '',
4133
  'You are adding a new part while you are editing another document. You will be redirected to your document when saving the new part or aborting this form.' => '',
4131 4134
  'You are logged out!'         => '',
4132 4135
  'You can also delete this transaction and re-enter it manually.' => '',
4133 4136
  'You can choose account categories for taxes. Depending on these categories taxes will be displayed for transfers in the general ledger or not.' => '',
templates/webpages/order/tabs/_item_input.html
4 4
  <table id="input_row_table_id">
5 5
    <thead>
6 6
      <tr class="listheading">
7
        <th class="listheading" nowrap >[%- '+'            | $T8 %] </th>
7 8
        <th class="listheading" nowrap >[%- 'position'     | $T8 %] </th>
8 9
        <th class="listheading" nowrap >[%- 'Part'         | $T8 %] </th>
9 10
        <th class="listheading" nowrap >[%- 'Description'  | $T8 %] </th>
......
15 16
    </thead>
16 17
    <tbody>
17 18
      <tr valign="top" class="listrow">
19
        <td class="tooltipster-html" title="[%- 'Create a new part' | $T8 -%]">
20
          [% SET type_options = [[ 'part', LxERP.t8('Part') ], [ 'assembly', LxERP.t8('Assembly') ], [ 'service', LxERP.t8('Service') ] ] %]
21
          [%- IF INSTANCE_CONF.get_feature_experimental_assortment %]
22
            [%- type_options.push([ 'assortment', LxERP.t8('Assortment')]) %]
23
          [%- END %]
24
          [% L.select_tag('add_item.create_part_type', type_options) %]
25
          [% L.button_tag('kivi.Order.create_part()', LxERP.t8('+')) %]
26
        </td>
18 27
        <td>[% L.input_tag('add_item.position', '', size = 5, class="add_item_input numeric") %]</td>
19 28
        <td>
20 29
          [%- SET PARAM_KEY = SELF.cv == "customer" ? 'with_customer_partnumber' : 'with_makemodel' -%]
21 30
          [%- SET PARAM_VAL = SELF.search_cvpartnumber -%]
22
          [% P.part.picker('add_item.parts_id', '', style='width: 300px', class="add_item_input",
31
          [% P.part.picker('add_item.parts_id', SELF.created_part, style='width: 300px', class="add_item_input",
23 32
                            fat_set_item=1,
24 33
                            multiple_pos_input=1,
25 34
                            action={set_multi_items='kivi.Order.add_multi_items'},
26 35
                            classification_id=SELF.part_picker_classification_ids.as_list.join(','),
27 36
                            $PARAM_KEY=PARAM_VAL) %]</td>
28
        <td>[% L.input_tag('add_item.description', '', class="add_item_input") %]</td>
37
        <td>[% L.input_tag('add_item.description', SELF.created_part.description, class="add_item_input") %]</td>
29 38
        <td>
30 39
          [% L.input_tag('add_item.qty_as_number', '', size = 5, class="add_item_input numeric") %]
31
          [% L.hidden_tag('add_item.unit', '', class="add_item_input") %]
40
          [% L.hidden_tag('add_item.unit', SELF.created_part.unit, class="add_item_input") %]
32 41
        </td>
33
        <td>[% L.input_tag('add_item.sellprice_as_number', '', size = 10, class="add_item_input numeric") %]</td>
42
        [%- SET price = LxERP.format_amount(((SELF.type == 'sales_quotation' || SELF.type == 'sales_order') ? SELF.created_part.sellprice : SELF.created_part.lastcost), -2) -%]
43
        <td>[% L.input_tag('add_item.sellprice_as_number', price, size = 10, class="add_item_input numeric") %]</td>
34 44
        <td>[% L.input_tag('add_item.discount_as_percent', '', size = 5, class="add_item_input numeric") %]</td>
35 45
        <td>[% L.button_tag('kivi.Order.add_item()', LxERP.t8('Add part')) %]</td>
36 46
      </tr>

Auch abrufbar als: Unified diff