Revision 30e1cefc
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpecOrder.pm | ||
---|---|---|
66 | 66 |
$sections_by_id{ $_->{id} }->update_attributes(order_part_id => $_->{order_part_id}) for @{ $section_attrs }; |
67 | 67 |
|
68 | 68 |
# 2. Create actual quotation/order. |
69 |
my $order = $self->create_order(sections => $sections, additional_parts => [ $self->requirement_spec->parts ]);
|
|
69 |
my $order = $self->create_order(sections => $sections, additional_parts => $self->requirement_spec->parts_sorted);
|
|
70 | 70 |
$order->db->with_transaction(sub { |
71 | 71 |
$order->save; |
72 | 72 |
|
... | ... | |
120 | 120 |
} |
121 | 121 |
|
122 | 122 |
sub action_do_update { |
123 |
my ($self) = @_; |
|
124 |
|
|
125 |
my $order = $self->rs_order->order; |
|
126 |
my $sections = $self->requirement_spec->sections_sorted; |
|
127 |
my %orderitems_by_id = map { ($_->id => $_) } @{ $order->orderitems }; |
|
128 |
my %sections_by_id = map { ($_->id => $_) } @{ $sections }; |
|
129 |
$self->{parts} = { map { ($_->id => $_) } @{ SL::DB::Manager::Part->get_all(where => [ id => [ uniq map { $_->order_part_id } @{ $sections } ] ]) } }; |
|
130 |
my $language_id = $self->requirement_spec->customer->language_id; |
|
131 |
|
|
132 |
my %sections_seen; |
|
133 |
|
|
134 |
foreach my $attributes (@{ $::form->{orderitems} || [] }) { |
|
135 |
my $orderitem = $orderitems_by_id{ $attributes->{id} }; |
|
136 |
my $section = $sections_by_id{ $attributes->{section_id} }; |
|
137 |
next unless $orderitem && $section; |
|
138 |
|
|
139 |
$self->create_order_item(section => $section, item => $orderitem, language_id => $language_id)->save; |
|
140 |
$sections_seen{ $section->id } = 1; |
|
141 |
} |
|
123 |
my ($self) = @_; |
|
142 | 124 |
|
143 |
my @new_orderitems = map { $self->create_order_item(section => $_, language_id => $language_id) }
|
|
144 |
grep { !$sections_seen{ $_->id } }
|
|
145 |
@{ $sections };
|
|
125 |
my $order = $self->rs_order->order;
|
|
126 |
my @new_orderitems = $self->do_update_sections;
|
|
127 |
push @new_orderitems, $self->do_update_additional_parts;
|
|
146 | 128 |
|
147 |
$order->orderitems([ @{ $order->orderitems }, @new_orderitems ]) if @new_orderitems;
|
|
129 |
$order->add_orderitems(\@new_orderitems) if @new_orderitems;
|
|
148 | 130 |
|
149 | 131 |
$order->calculate_prices_and_taxes; |
150 | 132 |
|
... | ... | |
244 | 226 |
# helpers |
245 | 227 |
# |
246 | 228 |
|
229 |
sub do_update_sections { |
|
230 |
my ($self) = @_; |
|
231 |
|
|
232 |
my $order = $self->rs_order->order; |
|
233 |
my $sections = $self->requirement_spec->sections_sorted; |
|
234 |
my %orderitems_by_id = map { ($_->id => $_) } @{ $order->orderitems }; |
|
235 |
my %sections_by_id = map { ($_->id => $_) } @{ $sections }; |
|
236 |
$self->{parts} = { map { ($_->id => $_) } @{ SL::DB::Manager::Part->get_all(where => [ id => [ uniq map { $_->order_part_id } @{ $sections } ] ]) } }; |
|
237 |
my $language_id = $self->requirement_spec->customer->language_id; |
|
238 |
|
|
239 |
my %sections_seen; |
|
240 |
|
|
241 |
foreach my $attributes (@{ $::form->{orderitems} || [] }) { |
|
242 |
my $orderitem = $orderitems_by_id{ $attributes->{id} }; |
|
243 |
my $section = $sections_by_id{ $attributes->{section_id} }; |
|
244 |
next unless $orderitem && $section; |
|
245 |
|
|
246 |
$self->create_order_item(section => $section, item => $orderitem, language_id => $language_id)->save; |
|
247 |
$sections_seen{ $section->id } = 1; |
|
248 |
} |
|
249 |
|
|
250 |
my @new_orderitems = map { $self->create_order_item(section => $_, language_id => $language_id) } |
|
251 |
grep { !$sections_seen{ $_->id } } |
|
252 |
@{ $sections }; |
|
253 |
|
|
254 |
return @new_orderitems; |
|
255 |
} |
|
256 |
|
|
257 |
sub do_update_additional_parts { |
|
258 |
my ($self) = @_; |
|
259 |
|
|
260 |
my $order = $self->rs_order->order; |
|
261 |
my $add_parts = $self->requirement_spec->parts_sorted; |
|
262 |
my %orderitems_by = map { (($_->parts_id . '-' . $_->description) => $_) } @{ $order->items }; |
|
263 |
$self->{parts} = { map { ($_->id => $_) } @{ SL::DB::Manager::Part->get_all(where => [ id => [ uniq map { $_->part_id } @{ $add_parts } ] ]) } }; |
|
264 |
my $language_id = $self->requirement_spec->customer->language_id; |
|
265 |
|
|
266 |
my %add_part_seen; |
|
267 |
my @new_orderitems; |
|
268 |
|
|
269 |
foreach my $add_part (@{ $add_parts }) { |
|
270 |
my $key = $add_part->part_id . '-' . $add_part->description; |
|
271 |
my $orderitem = $orderitems_by{$key}; |
|
272 |
|
|
273 |
if ($orderitem) { |
|
274 |
$self->create_additional_part_order_item(additional_part => $add_part, item => $orderitem, language_id => $language_id)->save; |
|
275 |
|
|
276 |
} else { |
|
277 |
push @new_orderitems, $self->create_additional_part_order_item(additional_part => $add_part, language_id => $language_id); |
|
278 |
} |
|
279 |
} |
|
280 |
|
|
281 |
return @new_orderitems; |
|
282 |
} |
|
283 |
|
|
247 | 284 |
sub create_order_item { |
248 | 285 |
my ($self, %params) = @_; |
249 | 286 |
|
locale/de/all | ||
---|---|---|
2615 | 2615 |
'Therefore several settings that had to be made for each user in the past have been consolidated into the client configuration.' => 'Dazu wurden gewisse Einstellungen, die vorher bei jedem Benutzer vorgenommen werden mussten, in die Konfiguration eines Mandanten verschoben.', |
2616 | 2616 |
'Therefore the definition of "kg" with the base unit "g" and a factor of 1000 is valid while defining "g" with a base unit of "kg" and a factor of "0.001" is not.' => 'So ist die Definition von "kg" mit der Basiseinheit "g" und dem Faktor 1000 zulässig, die Definition von "g" mit der Basiseinheit "kg" und dem Faktor "0,001" hingegen nicht.', |
2617 | 2617 |
'These wrong entries cannot be fixed automatically.' => 'Diese Einträge können nicht automatisch bereinigt werden.', |
2618 |
'They will be updated, new ones for additional parts without a line item added automatically.' => 'Diese Positionen werden automatisch aktualisiert bzw. ergänzt, wenn es noch keine Position zu einem zusätzlichen Artikel gibt.', |
|
2618 | 2619 |
'This can be done with the following query:' => 'Dies kann mit der folgenden Datenbankabfrage erreicht werden:', |
2619 | 2620 |
'This could have happened for two reasons:' => 'Dies kann aus zwei Gründen geschehen sein:', |
2620 | 2621 |
'This customer number is already in use.' => 'Diese Kundennummer wird bereits verwendet.', |
... | ... | |
2751 | 2752 |
'Update with section' => 'Mit Abschnitt aktualisieren', |
2752 | 2753 |
'Updated' => 'Erneuert am', |
2753 | 2754 |
'Updating existing entry in database' => 'Existierenden Eintrag in Datenbank aktualisieren', |
2755 |
'Updating items with additional parts' => 'Positionen für zusätzliche Artikel aktualisieren', |
|
2756 |
'Updating items with sections' => 'Positionen für Abschnitte aktualisieren', |
|
2754 | 2757 |
'Updating prices of existing entry in database' => 'Preis des Eintrags in der Datenbank wird aktualisiert', |
2755 | 2758 |
'Updating the client fields in the database "#1" on host "#2:#3" failed.' => 'Die Aktualisierung der Mandantenfelder in der Datenbank "#1" auf Host "#2:#3" schlug fehl.', |
2756 | 2759 |
'Uploaded at' => 'Hochgeladen um', |
... | ... | |
2870 | 2873 |
'You cannot continue before all required modules are installed.' => 'Sie können nicht fortfahren, bevor alle benötigten Pakete installiert sind.', |
2871 | 2874 |
'You cannot create an invoice for delivery orders for different customers.' => 'Sie können keine Rechnung zu Lieferscheinen für verschiedene Kunden erstellen.', |
2872 | 2875 |
'You cannot create an invoice for delivery orders from different vendors.' => 'Sie können keine Rechnung aus Lieferscheinen von verschiedenen Lieferanten erstellen.', |
2876 |
'You cannot modify individual assigments from additional articles to line items.' => 'Eine individuelle Zuordnung der zusätzlichen Artikel zu Positionen kann nicht vorgenommen werden.', |
|
2873 | 2877 |
'You cannot paste function blocks or sub function blocks if there is no section.' => 'Sie können keine Funktionsblöcke oder Unterfunktionsblöcke einfügen, wenn es noch keinen Abschnitt gibt.', |
2874 | 2878 |
'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.', |
2875 | 2879 |
'You have entered or selected the following shipping address for this customer:' => 'Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:', |
templates/webpages/requirement_spec_order/update.html | ||
---|---|---|
13 | 13 |
</h2> |
14 | 14 |
|
15 | 15 |
<form id="quotations_and_orders_form"> |
16 |
<h3>[% LxERP.t8("Updating items with sections") %]</h3> |
|
17 |
|
|
16 | 18 |
[% L.hidden_tag("rs_order_id", SELF.rs_order.id, no_id=1) %] |
17 | 19 |
|
18 | 20 |
<table style="width: 100%"> |
... | ... | |
44 | 46 |
[% LxERP.t8("Sections that are not assigned to any of the items above will be added as new positions.") %] |
45 | 47 |
</p> |
46 | 48 |
|
49 |
<h3>[% LxERP.t8("Updating items with additional parts") %]</h3> |
|
50 |
|
|
51 |
<p> |
|
52 |
[% LxERP.t8("You cannot modify individual assigments from additional articles to line items.") %] |
|
53 |
[% LxERP.t8("They will be updated, new ones for additional parts without a line item added automatically.") %] |
|
54 |
</p> |
|
55 |
|
|
47 | 56 |
<p> |
48 | 57 |
[% L.button_tag("kivi.requirement_spec.standard_quotation_order_ajax_call('do_update')", LxERP.t8('Update')) %] |
49 | 58 |
</p> |
Auch abrufbar als: Unified diff
Pflichtenheftaufträge: Aktualisierung zusätzlicher Artikel implementiert