Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 94e11003

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 94e11003809e9090514026a733e58e72e636a6bb
  • Vorgänger 00738f6f
  • Nachfolger 01bdb4dc

Beim Umwandeln von Angeboten/Preisanfragen in Aufträge die IDs in record_links speichern. Beim Umwandeln von Aufträgen und Lieferscheinen in Rechnungen die IDs in record_links speichern.

Unterschiede anzeigen:

SL/DO.pm
345 345

  
346 346
  # Link this delivery order to the quotations it was created from.
347 347
  RecordLinks->create_links('dbh'        => $dbh,
348
                            'mode'       => 'string',
348
                            'mode'       => 'ids',
349 349
                            'from_table' => 'oe',
350 350
                            'from_ids'   => $form->{convert_from_oe_ids},
351 351
                            'to_table'   => 'delivery_orders',
SL/IR.pm
539 539

  
540 540
  Common::webdav_folder($form) if ($main::webdav);
541 541

  
542
  my @close_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{close_do_ids};
543
  if (scalar @close_do_ids) {
542
  # Link this record to the records it was created from.
543
  RecordLinks->create_links('dbh'        => $dbh,
544
                            'mode'       => 'ids',
545
                            'from_table' => 'oe',
546
                            'from_ids'   => $form->{convert_from_oe_ids},
547
                            'to_table'   => 'ap',
548
                            'to_id'      => $form->{id},
549
    );
550
  delete $form->{convert_from_oe_ids};
551

  
552
  my @convert_from_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{convert_from_do_ids};
553
  if (scalar @convert_from_do_ids) {
544 554
    DO->close_orders('dbh' => $dbh,
545
                     'ids' => \@close_do_ids);
555
                     'ids' => \@convert_from_do_ids);
556

  
557
    RecordLinks->create_links('dbh'        => $dbh,
558
                              'mode'       => 'ids',
559
                              'from_table' => 'delivery_orders',
560
                              'from_ids'   => \@convert_from_do_ids,
561
                              'to_table'   => 'ap',
562
                              'to_id'      => $form->{id},
563
      );
546 564
  }
547 565

  
548 566
  my $rc = 1;
SL/IS.pm
970 970

  
971 971
  Common::webdav_folder($form) if ($main::webdav);
972 972

  
973
  my @close_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{close_do_ids};
974

  
975
  if (scalar @close_do_ids) {
973
  # Link this record to the records it was created from.
974
  RecordLinks->create_links('dbh'        => $dbh,
975
                            'mode'       => 'ids',
976
                            'from_table' => 'oe',
977
                            'from_ids'   => $form->{convert_from_oe_ids},
978
                            'to_table'   => 'ar',
979
                            'to_id'      => $form->{id},
980
    );
981
  delete $form->{convert_from_oe_ids};
982

  
983
  my @convert_from_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{convert_from_do_ids};
984

  
985
  if (scalar @convert_from_do_ids) {
976 986
    DO->close_orders('dbh' => $dbh,
977
                     'ids' => \@close_do_ids);
987
                     'ids' => \@convert_from_do_ids);
988

  
989
    RecordLinks->create_links('dbh'        => $dbh,
990
                              'mode'       => 'ids',
991
                              'from_table' => 'delivery_orders',
992
                              'from_ids'   => \@convert_from_do_ids,
993
                              'to_table'   => 'ar',
994
                              'to_id'      => $form->{id},
995
      );
978 996
  }
979 997

  
980 998
  my $rc = 1;
SL/OE.pm
465 465
  # save printed, emailed, queued
466 466
  $form->save_status($dbh);
467 467

  
468
  # Link this record to the records it was created from.
469
  RecordLinks->create_links('dbh'        => $dbh,
470
                            'mode'       => 'ids',
471
                            'from_table' => 'oe',
472
                            'from_ids'   => $form->{convert_from_oe_ids},
473
                            'to_table'   => 'oe',
474
                            'to_id'      => $form->{id},
475
    );
476
  delete $form->{convert_from_oe_ids};
477

  
468 478
  if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
469 479
    if ($form->{vc} eq 'customer') {
470 480
      $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, $form->{exchangerate}, 0);
......
600 610
      if ($form->{"multi_id_$_"} and $form->{"trans_id_$_"})
601 611
  } (1 .. $form->{"rowcount"});
602 612

  
613
  if ($form->{rowcount} && scalar @ids) {
614
    $form->{convert_from_oe_ids} = join ' ', @ids;
615
  }
616

  
603 617
  # if called in multi id mode, and still only got one id, switch back to single id
604 618
  if ($form->{"rowcount"} and $#ids == 0) {
605 619
    $form->{"id"} = $ids[0];
SL/RecordLinks.pm
9 9
  my $self     = shift;
10 10
  my %params   = @_;
11 11

  
12
  if ($params{mode} && ($params{mode} eq 'string')) {
12
  if ($params{mode} && ($params{mode} eq 'ids')) {
13 13
    Common::check_params_x(\%params, [ qw(from_ids to_ids) ]);
14 14

  
15 15
  } else {
......
19 19

  
20 20
  my @links;
21 21

  
22
  if ($params{mode} && ($params{mode} eq 'string')) {
22
  if ($params{mode} && ($params{mode} eq 'ids')) {
23 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"} ] );
24
    my %ids;
25

  
26
    if ('ARRAY' eq ref $params{"${from_to}_ids"}) {
27
      $ids{$from_to} = $params{"${from_to}_ids"};
28
    } else {
29
      $ids{$from_to} = [ grep { $_ } map { $_ * 1 } split m/\s+/, $params{"${from_to}_ids"} ];
30
    }
25 31

  
26 32
    if (my $num = scalar @{ $ids{$from_to} }) {
27 33
      $main::lxdebug->message(0, "3");
bin/mozilla/do.pl
648 648
  check_do_access();
649 649
  $auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
650 650

  
651
  $form->{close_do_ids} = $form->{id};
651
  $form->{convert_from_do_ids} = $form->{id};
652
  $form->{deliverydate}        = $form->{transdate};
653
  $form->{transdate}           = $form->{invdate} = $form->current_date(\%myconfig);
654
  $form->{duedate}             = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
655
  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
652 656

  
653
  $form->{deliverydate} = $form->{transdate};
654
  $form->{transdate}    = $form->{invdate} = $form->current_date(\%myconfig);
655
  $form->{duedate}      = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
656

  
657
  $form->{id}     = '';
658
  $form->{closed} = 0;
659 657
  $form->{rowcount}--;
660 658

  
661
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
659
  delete @{$form}{qw(id closed delivered)};
662 660

  
663 661
  if ($form->{type} eq 'purchase_delivery_order') {
664 662
    $form->{title}  = $locale->text('Add Vendor Invoice');
......
742 740
                              'back_button' => 1);
743 741
  }
744 742

  
745
  $form->{close_do_ids}    = join ' ', @do_ids;
746
  $form->{deliverydate}    = $form->{transdate};
747
  $form->{transdate}       = $form->current_date(\%myconfig);
748
  $form->{duedate}         = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
749
  $form->{type}            = "invoice";
750
  $form->{closed}          = 0;
751
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
743
  $form->{convert_from_do_ids} = join ' ', @do_ids;
744
  $form->{deliverydate}        = $form->{transdate};
745
  $form->{transdate}           = $form->current_date(\%myconfig);
746
  $form->{duedate}             = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
747
  $form->{type}                = "invoice";
748
  $form->{closed}              = 0;
749
  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
752 750

  
753 751
  my $buysell;
754 752
  if ($form->{type} eq 'purchase_delivery_order') {
bin/mozilla/ir.pl
424 424

  
425 425
  $form->hide_form(qw(id title vc type level creditlimit creditremaining closedto locked shippted storno storno_id
426 426
                      max_dunning_level dunning_amount vendor_id oldvendor selectvendor taxaccounts
427
                      fxgain_accno fxloss_accno taxpart taxservice cursor_fokus),
427
                      fxgain_accno fxloss_accno taxpart taxservice cursor_fokus
428
                      convert_from_oe_ids convert_from_do_ids),
428 429
                      map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} );
429 430

  
430 431
  print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
......
806 807
  </tr>
807 808
</table>
808 809
<br>
809
| . $cgi->hidden('-name' => 'close_do_ids', '-default' => [$form->{close_do_ids}]);
810
|;
810 811

  
811 812
  $invdate  = $form->datetonum($form->{invdate},  \%myconfig);
812 813
  $closedto = $form->datetonum($form->{closedto}, \%myconfig);
bin/mozilla/is.pl
614 614
                      creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id
615 615
                      max_dunning_level dunning_amount
616 616
                      shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax 
617
                      shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus),
617
                      shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus
618
                      convert_from_do_ids convert_from_oe_ids),
618 619
                      map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} );
619 620
   
620 621
  print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
......
1192 1193
$cgi->hidden("-name" => "callback", "-value" => $form->{callback})
1193 1194
. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
1194 1195
. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
1195
. $cgi->hidden('-name' => 'close_do_ids', '-default' => [$form->{close_do_ids}])
1196 1196
. qq|
1197 1197
</form>
1198 1198

  
bin/mozilla/oe.pl
234 234
    $form->{"select$form->{vc}"} = 1;
235 235
    $form->{$form->{vc}}         = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
236 236
  }
237
  $form->{"old$form->{vc}"}    = $form->{$form->{vc}};
237

  
238
  $form->{"old$form->{vc}"}  = $form->{$form->{vc}};
239
  $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}| unless ($form->{"old$form->{vc}"} =~ m/--\d+$/);
238 240

  
239 241
  $lxdebug->leave_sub();
240 242
}
......
1455 1457
    OE->close_orders(\%myconfig, \%$form);
1456 1458
  }
1457 1459

  
1458
  $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1459
  $form->{duedate}   = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1460
  $form->{convert_from_oe_ids} = $form->{id};
1461
  $form->{transdate}           = $form->{invdate} = $form->current_date(\%myconfig);
1462
  $form->{duedate}             = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1463
  $form->{shipto}              = 1;
1464
  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
1460 1465

  
1461
  $form->{id}     = '';
1462
  $form->{closed} = 0;
1466
  delete @{$form}{qw(id closed)};
1463 1467
  $form->{rowcount}--;
1464
  $form->{shipto} = 1;
1465

  
1466
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
1467 1468

  
1468 1469
  if ($form->{type} =~ /_order$/) {
1469 1470
    $form->{exchangerate} = $exchangerate;
......
1814 1815
    delete($form->{ordnumber});
1815 1816
  }
1816 1817

  
1817
  $form->{cp_id}               *= 1;
1818
  $form->{convert_from_oe_ids}  = $form->{id};
1818
  $form->{cp_id} *= 1;
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

  
......
1835 1835
  $form->{transdate} = $form->current_date(\%myconfig);
1836 1836
  delete $form->{duedate};
1837 1837

  
1838
  $form->{closed}          = 0;
1838
  $form->{convert_from_oe_ids} = $form->{id};
1839
  $form->{closed}              = 0;
1839 1840

  
1840
  $form->{old_employee_id} = $form->{employee_id};
1841
  $form->{old_salesman_id} = $form->{salesman_id};
1841
  $form->{old_employee_id}     = $form->{employee_id};
1842
  $form->{old_salesman_id}     = $form->{salesman_id};
1842 1843

  
1843 1844
  # reset
1844
  map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
1845
  map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered);
1845 1846

  
1846 1847
  for $i (1 .. $form->{rowcount}) {
1847 1848
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor);
templates/webpages/oe/form_header_de.html
15 15
   <input type="hidden" name="[% HTML.escape(row.name) %]" value="[% HTML.escape(row.value) %]" >
16 16
[%- END %]
17 17

  
18
    <input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
19

  
18 20
    <input type="hidden" name="follow_up_trans_id_1" value="[% HTML.escape(id) %]">
19 21
    <input type="hidden" name="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
20 22
    <input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
templates/webpages/oe/form_header_master.html
15 15
   <input type="hidden" name="[% HTML.escape(row.name) %]" value="[% HTML.escape(row.value) %]" >
16 16
[%- END %]
17 17

  
18
    <input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
19

  
18 20
    <input type="hidden" name="follow_up_trans_id_1" value="[% HTML.escape(id) %]">
19 21
    <input type="hidden" name="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
20 22
    <input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">

Auch abrufbar als: Unified diff