Revision 00738f6f
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
$form->save_status($dbh);
|
||
|
||
# Link this delivery order to the quotations it was created from.
|
||
my @oe_ids = grep { $_ } map { $_ * 1 } split m/\s+/, $form->{oe_ids};
|
||
delete $form->{oe_ids};
|
||
if (scalar @oe_ids) {
|
||
my @links = map { { 'from_table' => 'oe', 'from_id' => $_, 'to_table' => 'delivery_orders', 'to_id' => $form->{id} } } @oe_ids;
|
||
RecordLinks->create_links('dbh' => $dbh, 'links' => \@links);
|
||
}
|
||
RecordLinks->create_links('dbh' => $dbh,
|
||
'mode' => 'string',
|
||
'from_table' => 'oe',
|
||
'from_ids' => $form->{convert_from_oe_ids},
|
||
'to_table' => 'delivery_orders',
|
||
'to_id' => $form->{id},
|
||
);
|
||
delete $form->{convert_from_oe_ids};
|
||
|
||
$self->mark_orders_if_delivered('do_id' => $form->{id},
|
||
'type' => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase',
|
SL/RecordLinks.pm | ||
---|---|---|
my $self = shift;
|
||
my %params = @_;
|
||
|
||
Common::check_params(\%params, qw(links));
|
||
if ($params{mode} && ($params{mode} eq 'string')) {
|
||
Common::check_params_x(\%params, [ qw(from_ids to_ids) ]);
|
||
|
||
if (!scalar @{ $params{links} }) {
|
||
} else {
|
||
Common::check_params(\%params, qw(links));
|
||
|
||
}
|
||
|
||
my @links;
|
||
|
||
if ($params{mode} && ($params{mode} eq 'string')) {
|
||
my ($from_to, $to_from) = $params{from_ids} ? qw(from to) : qw(to from);
|
||
my %ids = ( $from_to => [ grep { $_ } map { $_ * 1 } split m/\s+/, $params{"${from_to}_ids"} ] );
|
||
|
||
if (my $num = scalar @{ $ids{$from_to} }) {
|
||
$main::lxdebug->message(0, "3");
|
||
$ids{$to_from} = [ ($params{"${to_from}_id"}) x $num ];
|
||
@links = map { { 'from_table' => $params{from_table},
|
||
'from_id' => $ids{from}->[$_],
|
||
'to_table' => $params{to_table},
|
||
'to_id' => $ids{to}->[$_], } } (0 .. $num - 1);
|
||
}
|
||
|
||
} else {
|
||
@links = @{ $params{links} };
|
||
}
|
||
|
||
if (!scalar @links) {
|
||
$main::lxdebug->leave_sub();
|
||
return;
|
||
}
|
||
... | ... | |
my $query = qq|INSERT INTO record_links (from_table, from_id, to_table, to_id) VALUES (?, ?, ?, ?)|;
|
||
my $sth = prepare_query($form, $dbh, $query);
|
||
|
||
foreach my $link (@{ $params{links} }) {
|
||
foreach my $link (@links) {
|
||
next if ('HASH' ne ref $link);
|
||
next if (!$link->{from_table} || !$link->{from_id} || !$link->{to_table} || !$link->{to_id});
|
||
|
bin/mozilla/oe.pl | ||
---|---|---|
delete($form->{ordnumber});
|
||
}
|
||
|
||
$form->{cp_id} *= 1;
|
||
$form->{oe_ids} = $form->{id};
|
||
$form->{cp_id} *= 1;
|
||
$form->{convert_from_oe_ids} = $form->{id};
|
||
|
||
$form->{title} = $locale->text('Add Sales Order');
|
||
$form->{vc} = "customer";
|
||
$form->{type} = "sales_order";
|
||
$form->{title} = $locale->text('Add Sales Order');
|
||
$form->{vc} = "customer";
|
||
$form->{type} = "sales_order";
|
||
|
||
&poso;
|
||
|
||
... | ... | |
|
||
require "bin/mozilla/do.pl";
|
||
|
||
$form->{cp_id} *= 1;
|
||
$form->{oe_ids} = $form->{id};
|
||
$form->{transdate} = $form->current_date(\%myconfig);
|
||
$form->{cp_id} *= 1;
|
||
$form->{convert_from_oe_ids} = $form->{id};
|
||
$form->{transdate} = $form->current_date(\%myconfig);
|
||
delete $form->{duedate};
|
||
|
||
$form->{closed} = 0;
|
||
|
||
$form->{old_employee_id} = $form->{employee_id};
|
||
$form->{old_salesman_id} = $form->{salesman_id};
|
||
|
||
# reset
|
||
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal);
|
||
delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)};
|
||
|
||
for $i (1 .. $form->{rowcount}) {
|
||
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 | ||
---|---|---|
<input type="hidden" name="business" value="[% HTML.escape(business) %]">
|
||
<input type="hidden" name="cc" value="[% HTML.escape(cc) %]">
|
||
<input type="hidden" name="closed" value="[% HTML.escape(closed) %]">
|
||
<input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
|
||
<input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]">
|
||
<input type="hidden" name="discount" value="[% HTML.escape(discount) %]">
|
||
<input type="hidden" name="dunning_amount" value="[% HTML.escape(dunning_amount) %]">
|
||
... | ... | |
<input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]">
|
||
<input type="hidden" name="media" value="[% HTML.escape(media) %]">
|
||
<input type="hidden" name="message" value="[% HTML.escape(message) %]">
|
||
<input type="hidden" name="oe_ids" value="[% HTML.escape(oe_ids) %]">
|
||
<input type="hidden" name="printed" value="[% HTML.escape(printed) %]">
|
||
<input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]">
|
||
<input type="hidden" name="queued" value="[% HTML.escape(queued) %]">
|
templates/webpages/do/form_header_master.html | ||
---|---|---|
<input type="hidden" name="business" value="[% HTML.escape(business) %]">
|
||
<input type="hidden" name="cc" value="[% HTML.escape(cc) %]">
|
||
<input type="hidden" name="closed" value="[% HTML.escape(closed) %]">
|
||
<input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
|
||
<input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]">
|
||
<input type="hidden" name="discount" value="[% HTML.escape(discount) %]">
|
||
<input type="hidden" name="dunning_amount" value="[% HTML.escape(dunning_amount) %]">
|
||
... | ... | |
<input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]">
|
||
<input type="hidden" name="media" value="[% HTML.escape(media) %]">
|
||
<input type="hidden" name="message" value="[% HTML.escape(message) %]">
|
||
<input type="hidden" name="oe_ids" value="[% HTML.escape(oe_ids) %]">
|
||
<input type="hidden" name="printed" value="[% HTML.escape(printed) %]">
|
||
<input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]">
|
||
<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.