Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0dd10ee9

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 0dd10ee90eb784dd1fcf3f77fffe7c7917aea3dd
  • Vorgänger 64e24b8f
  • Nachfolger 569d24f3

TODO-Datei für Rebase

Unterschiede anzeigen:

TODO_rebase.md
1

  
2
# Close intake
3

  
4
In `./SL/Controller/Order.pm` `sub save`: link records
5

  
6
```perl
7
        $src->update_attributes(closed => 1) if $src->type eq purchase_quotation_intake_type() && $self->type eq purchase_order_type();
8
```
9

  
10
To `.SL/DB/Order.pm` `sub _after_save_link_records` and `./SL/DB/Helper/RecordLink.pm`
11

  
12
# Close reachable intake
13

  
14

  
15
In `./SL/Controller/Order.pm` `sub save`: after save
16

  
17
```perl
18
    # Close reachable sales order intakes in the from-workflow if this is a sales order
19
    if (sales_order_type() eq $self->type) {
20
      my $lr = $self->order->linked_records(direction => 'from', recursive => 1);
21
      $lr    = [grep { 'SL::DB::Order' eq ref $_ && !$_->closed && $_->is_type('sales_order_intake')} @$lr];
22
      if (@$lr) {
23
        SL::DB::Manager::Order->update_all(set   => {closed => 1},
24
                                           where => [id => [map {$_->id} @$lr]]);
25
      }
26
    }
27
```
28

  
29
To `.SL/DB/Order.pm` `sub _after_save_link_records` and `./SL/DB/Helper/RecordLink.pm`
30

  
31
# Set dates after save as new
32

  
33
In `./SL/Controller/Order.pm` `sub action_save_as_new`:
34

  
35
From
36

  
37
```perl
38
  # Set new reqdate unless changed if it is enabled in client config
39
  if ($order->reqdate == $saved_order->reqdate) {
40
    my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval       :
41
                     $self->type eq sales_order_type()     ? $::instance_conf->get_delivery_date_interval : 1;
42

  
43
    if (   ($self->type eq sales_order_type()     &&  !$::instance_conf->get_deliverydate_on)
44
        || ($self->type eq sales_quotation_type() &&  !$::instance_conf->get_reqdate_on)) {
45
      $new_attrs{reqdate} = '';
46
    } else {
47
      $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days);
48
    }
49
  } else {
50
    $new_attrs{reqdate} = $order->reqdate;
51
  }
52
```
53

  
54
To
55

  
56
```perl
57
  # Set new reqdate unless changed if it is enabled in client config
58
  if ($order->reqdate == $saved_order->reqdate) {
59
    my $extra_days = $self->type eq sales_quotation_type()    ? $::instance_conf->get_reqdate_interval       :
60
                     $self->type eq sales_order_type()        ? $::instance_conf->get_delivery_date_interval :
61
                     $self->type eq sales_order_intake_type() ? $::instance_conf->get_delivery_date_interval : 1;
62

  
63
    if (   ($self->type eq sales_order_intake_type() &&  !$::instance_conf->get_deliverydate_on)
64
        || ($self->type eq sales_order_type()        &&  !$::instance_conf->get_deliverydate_on)
65
        || ($self->type eq sales_quotation_type()    &&  !$::instance_conf->get_reqdate_on)) {
66
      $new_attrs{reqdate} = '';
67
    } else {
68
      $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days);
69
    }
70
  } else {
71
    $new_attrs{reqdate} = $order->reqdate;
72
  }
73
```
74

  
75
# Set default dates
76

  
77
In ./SL/Controller/Order.pm` sub action_add`:
78

  
79
From:
80

  
81
```perl
82
  $self->order->transdate(DateTime->now_local());
83
  my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval       :
84
                   $self->type eq sales_order_type()     ? $::instance_conf->get_delivery_date_interval : 1;
85

  
86
  if (   ($self->type eq sales_order_type()     &&  $::instance_conf->get_deliverydate_on)
87
      || ($self->type eq sales_quotation_type() &&  $::instance_conf->get_reqdate_on)
88
      && (!$self->order->reqdate)) {
89
    $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days));
90
  }
91
```
92

  
93
To:
94

  
95
```perl
96
  $self->order->transdate(DateTime->now_local());
97
  my $extra_days = $self->type eq sales_quotation_type()    ? $::instance_conf->get_reqdate_interval       :
98
                   $self->type eq sales_order_type()        ? $::instance_conf->get_delivery_date_interval :
99
                   $self->type eq sales_order_intake_type() ? $::instance_conf->get_delivery_date_interval : 1;
100

  
101
  if (($self->type eq sales_order_intake_type() &&  $::instance_conf->get_deliverydate_on)
102
      || ($self->type eq sales_order_type()     &&  $::instance_conf->get_deliverydate_on)
103
      || ($self->type eq sales_quotation_type() &&  $::instance_conf->get_reqdate_on)
104
      && (!$self->order->reqdate)) {
105
    $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days));
106
  }
107
```
108

  
109
Now in `SL::Model::Record->update_after_new`
110

  
111
# Create Constants for intake and add to valid type
112

  
113

  
114
```perl
115
  my $text = $self->type eq SALES_ORDER_INTAKE_TYPE()        ? $::locale->text('The order intake has been deleted')
116
           : $self->type eq SALES_ORDER_TYPE()               ? $::locale->text('The order confirmation has been deleted')
117
           : $self->type eq PURCHASE_ORDER_TYPE()            ? $::locale->text('The order has been deleted')
118
           : $self->type eq SALES_QUOTATION_TYPE()           ? $::locale->text('The quotation has been deleted')
119
           : $self->type eq REQUEST_QUOTATION_TYPE()         ? $::locale->text('The rfq has been deleted')
120
           : $self->type eq PURCHASE_QUOTATION_INTAKE_TYPE() ? $::locale->text('The quotation intake has been deleted')
121
```
122

  
123
```perl
124
sub init_valid_types {
125
  [ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type() ];
126
  }
127
```
128

  
129
# End request after save with error
130

  
131
``
132
d9bb0bb9 Bernd Bleßmann (2023-07-12 16:44):                                   
133
Reklamations-Controller: Nach Fehlermeldung beim Speichern Request beenden. … 
134
``
135

  
136
# adapte record_type update script for order
137

  
138
Add intake types
139

  
140
# No intake flag
141

  
142
Like
143
`a794ea45d8 (DB::Order: Funktionen angepasst (kein Angebotsflag)`
144

  
145
`tig log -p intake`
146

  
147

  
148
# Show menu intake
149

  
150
Order setup action bar
151

  
152

  
153
# Type data order intake
154

  
155
# Delivery: order_type errors (Tests)
156

  

Auch abrufbar als: Unified diff