Revision 00738f6f
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
344 | 344 |
$form->save_status($dbh); |
345 | 345 |
|
346 | 346 |
# Link this delivery order to the quotations it was created from. |
347 |
my @oe_ids = grep { $_ } map { $_ * 1 } split m/\s+/, $form->{oe_ids}; |
|
348 |
delete $form->{oe_ids}; |
|
349 |
if (scalar @oe_ids) { |
|
350 |
my @links = map { { 'from_table' => 'oe', 'from_id' => $_, 'to_table' => 'delivery_orders', 'to_id' => $form->{id} } } @oe_ids; |
|
351 |
RecordLinks->create_links('dbh' => $dbh, 'links' => \@links); |
|
352 |
} |
|
347 |
RecordLinks->create_links('dbh' => $dbh, |
|
348 |
'mode' => 'string', |
|
349 |
'from_table' => 'oe', |
|
350 |
'from_ids' => $form->{convert_from_oe_ids}, |
|
351 |
'to_table' => 'delivery_orders', |
|
352 |
'to_id' => $form->{id}, |
|
353 |
); |
|
354 |
delete $form->{convert_from_oe_ids}; |
|
353 | 355 |
|
354 | 356 |
$self->mark_orders_if_delivered('do_id' => $form->{id}, |
355 | 357 |
'type' => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase', |
SL/RecordLinks.pm | ||
---|---|---|
9 | 9 |
my $self = shift; |
10 | 10 |
my %params = @_; |
11 | 11 |
|
12 |
Common::check_params(\%params, qw(links)); |
|
12 |
if ($params{mode} && ($params{mode} eq 'string')) { |
|
13 |
Common::check_params_x(\%params, [ qw(from_ids to_ids) ]); |
|
13 | 14 |
|
14 |
if (!scalar @{ $params{links} }) { |
|
15 |
} else { |
|
16 |
Common::check_params(\%params, qw(links)); |
|
17 |
|
|
18 |
} |
|
19 |
|
|
20 |
my @links; |
|
21 |
|
|
22 |
if ($params{mode} && ($params{mode} eq 'string')) { |
|
23 |
my ($from_to, $to_from) = $params{from_ids} ? qw(from to) : qw(to from); |
|
24 |
my %ids = ( $from_to => [ grep { $_ } map { $_ * 1 } split m/\s+/, $params{"${from_to}_ids"} ] ); |
|
25 |
|
|
26 |
if (my $num = scalar @{ $ids{$from_to} }) { |
|
27 |
$main::lxdebug->message(0, "3"); |
|
28 |
$ids{$to_from} = [ ($params{"${to_from}_id"}) x $num ]; |
|
29 |
@links = map { { 'from_table' => $params{from_table}, |
|
30 |
'from_id' => $ids{from}->[$_], |
|
31 |
'to_table' => $params{to_table}, |
|
32 |
'to_id' => $ids{to}->[$_], } } (0 .. $num - 1); |
|
33 |
} |
|
34 |
|
|
35 |
} else { |
|
36 |
@links = @{ $params{links} }; |
|
37 |
} |
|
38 |
|
|
39 |
if (!scalar @links) { |
|
15 | 40 |
$main::lxdebug->leave_sub(); |
16 | 41 |
return; |
17 | 42 |
} |
... | ... | |
24 | 49 |
my $query = qq|INSERT INTO record_links (from_table, from_id, to_table, to_id) VALUES (?, ?, ?, ?)|; |
25 | 50 |
my $sth = prepare_query($form, $dbh, $query); |
26 | 51 |
|
27 |
foreach my $link (@{ $params{links} }) {
|
|
52 |
foreach my $link (@links) {
|
|
28 | 53 |
next if ('HASH' ne ref $link); |
29 | 54 |
next if (!$link->{from_table} || !$link->{from_id} || !$link->{to_table} || !$link->{to_id}); |
30 | 55 |
|
bin/mozilla/oe.pl | ||
---|---|---|
1814 | 1814 |
delete($form->{ordnumber}); |
1815 | 1815 |
} |
1816 | 1816 |
|
1817 |
$form->{cp_id} *= 1; |
|
1818 |
$form->{oe_ids} = $form->{id}; |
|
1817 |
$form->{cp_id} *= 1;
|
|
1818 |
$form->{convert_from_oe_ids} = $form->{id};
|
|
1819 | 1819 |
|
1820 |
$form->{title} = $locale->text('Add Sales Order'); |
|
1821 |
$form->{vc} = "customer"; |
|
1822 |
$form->{type} = "sales_order"; |
|
1820 |
$form->{title} = $locale->text('Add Sales Order');
|
|
1821 |
$form->{vc} = "customer";
|
|
1822 |
$form->{type} = "sales_order";
|
|
1823 | 1823 |
|
1824 | 1824 |
&poso; |
1825 | 1825 |
|
... | ... | |
1883 | 1883 |
|
1884 | 1884 |
require "bin/mozilla/do.pl"; |
1885 | 1885 |
|
1886 |
$form->{cp_id} *= 1; |
|
1887 |
$form->{oe_ids} = $form->{id};
|
|
1888 |
$form->{transdate} = $form->current_date(\%myconfig); |
|
1886 |
$form->{cp_id} *= 1;
|
|
1887 |
$form->{convert_from_oe_ids} = $form->{id};
|
|
1888 |
$form->{transdate} = $form->current_date(\%myconfig);
|
|
1889 | 1889 |
delete $form->{duedate}; |
1890 | 1890 |
|
1891 |
$form->{closed} = 0; |
|
1892 |
|
|
1893 | 1891 |
$form->{old_employee_id} = $form->{employee_id}; |
1894 | 1892 |
$form->{old_salesman_id} = $form->{salesman_id}; |
1895 | 1893 |
|
1896 | 1894 |
# reset |
1897 |
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal);
|
|
1895 |
delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)};
|
|
1898 | 1896 |
|
1899 | 1897 |
for $i (1 .. $form->{rowcount}) { |
1900 | 1898 |
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor); |
templates/webpages/do/form_header_de.html | ||
---|---|---|
60 | 60 |
<input type="hidden" name="business" value="[% HTML.escape(business) %]"> |
61 | 61 |
<input type="hidden" name="cc" value="[% HTML.escape(cc) %]"> |
62 | 62 |
<input type="hidden" name="closed" value="[% HTML.escape(closed) %]"> |
63 |
<input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]"> |
|
63 | 64 |
<input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]"> |
64 | 65 |
<input type="hidden" name="discount" value="[% HTML.escape(discount) %]"> |
65 | 66 |
<input type="hidden" name="dunning_amount" value="[% HTML.escape(dunning_amount) %]"> |
... | ... | |
71 | 72 |
<input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]"> |
72 | 73 |
<input type="hidden" name="media" value="[% HTML.escape(media) %]"> |
73 | 74 |
<input type="hidden" name="message" value="[% HTML.escape(message) %]"> |
74 |
<input type="hidden" name="oe_ids" value="[% HTML.escape(oe_ids) %]"> |
|
75 | 75 |
<input type="hidden" name="printed" value="[% HTML.escape(printed) %]"> |
76 | 76 |
<input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]"> |
77 | 77 |
<input type="hidden" name="queued" value="[% HTML.escape(queued) %]"> |
templates/webpages/do/form_header_master.html | ||
---|---|---|
60 | 60 |
<input type="hidden" name="business" value="[% HTML.escape(business) %]"> |
61 | 61 |
<input type="hidden" name="cc" value="[% HTML.escape(cc) %]"> |
62 | 62 |
<input type="hidden" name="closed" value="[% HTML.escape(closed) %]"> |
63 |
<input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]"> |
|
63 | 64 |
<input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]"> |
64 | 65 |
<input type="hidden" name="discount" value="[% HTML.escape(discount) %]"> |
65 | 66 |
<input type="hidden" name="dunning_amount" value="[% HTML.escape(dunning_amount) %]"> |
... | ... | |
71 | 72 |
<input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]"> |
72 | 73 |
<input type="hidden" name="media" value="[% HTML.escape(media) %]"> |
73 | 74 |
<input type="hidden" name="message" value="[% HTML.escape(message) %]"> |
74 |
<input type="hidden" name="oe_ids" value="[% HTML.escape(oe_ids) %]"> |
|
75 | 75 |
<input type="hidden" name="printed" value="[% HTML.escape(printed) %]"> |
76 | 76 |
<input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]"> |
77 | 77 |
<input type="hidden" name="queued" value="[% HTML.escape(queued) %]"> |
Auch abrufbar als: Unified diff
1. Variable umbenannt, in der die IDs aus OE zwischengespeichert werden, aus denen ein Lieferschein erzeugt wurde.
2. Erweiterung von "RecordLinks->create_links()" um einen Modus, um die IDs aus einem String zu erhalten.
3. Bug: Bei Umwandlung von Auftrag in Lieferschein Variable "delivered" leeren, weil ansonsten evtl der noch nicht gespeicherte Liferschein bereits als ausgelagert gilt.