Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 631c46fd

Von Sven Schöling vor etwa 3 Jahren hinzugefügt

  • ID 631c46fd8facf10ce8e17f19d4ece65e0c2634ba
  • Vorgänger 74c5174c
  • Nachfolger 6f677221

DeliveryOrder: neue Typen: supplier_delivery_order und rma_delivery_order

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
205 205
                        : $order->transdate;
206 206

  
207 207
  # Set new reqdate unless changed if it is enabled in client config
208
  $new_attrs{reqdate} = $self->get_reqdate_by_type($order->reqdate, $saved_order->reqdate);
208
  $new_attrs{reqdate} = $self->type_data->get_reqdate_by_type($order->reqdate, $saved_order->reqdate);
209 209

  
210 210
  # Update employee
211 211
  $new_attrs{employee}  = SL::DB::Manager::Employee->current;
......
1644 1644
        action => [
1645 1645
          t8('Save and Invoice'),
1646 1646
          call      => [ 'kivi.DeliveryOrder.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
1647
          only_if  => $self->type_data->show_menu("save_and_invoice"),
1647 1648
        ],
1648 1649
        action => [
1649 1650
          t8('Save and AP Transaction'),
SL/Controller/DeliveryOrder/TypeData.pm
6 6
use SL::Locale::String qw(t8);
7 7

  
8 8
use constant {
9
  SALES_ORDER_TYPE             => 'sales_order',
10
  PURCHASE_ORDER_TYPE          => 'purchase_order',
11
  SALES_QUOTATION_TYPE         => 'sales_quotation',
12
  REQUEST_QUOTATION_TYPE       => 'request_quotation',
13
  PURCHASE_DELIVERY_ORDER_TYPE => 'purchase_delivery_order',
14 9
  SALES_DELIVERY_ORDER_TYPE    => 'sales_delivery_order',
10
  PURCHASE_DELIVERY_ORDER_TYPE => 'purchase_delivery_order',
11
  SUPPLIER_DELIVERY_ORDER_TYPE => 'supplier_delivery_order',
12
  RMA_DELIVERY_ORDER_TYPE      => 'rma_delivery_order',
15 13
};
16 14

  
17
our @EXPORT_OK = qw(SALES_ORDER_TYPE PURCHASE_ORDER_TYPE SALES_QUOTATION_TYPE REQUEST_QUOTATION_TYPE);
15
our @EXPORT_OK = qw(SALES_DELIVERY_ORDER_TYPE PURCHASE_DELIVERY_ORDER_TYPE SUPPLIER_DELIVERY_ORDER_TYPE RMA_DELIVERY_ORDER_TYPE);
18 16

  
19 17
use Rose::Object::MakeMethods::Generic scalar => [ qw(c) ];
20 18

  
21 19
my %type_data = (
22
  SALES_ORDER_TYPE() => {
23
    text => {
24
      delete => t8('The order has been deleted'),
25
      saved  => t8('The order has been saved'),
26
      add    => t8("Add Sales Order"),
27
      edit   => t8("Edit Sales Order"),
28
    },
29
    show_menu => {
30
      save_and_quotation      => 1,
31
      save_and_rfq            => 0,
32
      save_and_sales_order    => 0,
33
      save_and_purchase_order => 1,
34
      save_and_delivery_order => 1,
35
      save_and_ap_transaction => 0,
36
      delete                  => sub { $::instance_conf->get_sales_order_show_delete },
37
    },
38
    workflow => {
39
      to_order_type        => "purchase_order",
40
      to_quotation_type    => "sales_quotation",
41
      to_order_copy_shipto => 1,
42
    },
43
    properties => {
44
      customervendor => "customer",
45
      is_quotation   => 0,
46
      is_customer    => 1,
47
      nr_key         => "ordnumber",
48
    },
49
    part_classification_query => [ "used_for_sale" => 1 ],
50
    right => "sales_order_edit",
51
  },
52
  PURCHASE_ORDER_TYPE() => {
53
    text =>{
54
      delete => t8('The order has been deleted'),
55
      saved  => t8('The order has been saved'),
56
      add    => t8("Add Purchase Order"),
57
      edit   => t8("Edit Purchase Order"),
58
    },
59
    show_menu => {
60
      save_and_quotation      => 0,
61
      save_and_rfq            => 1,
62
      save_and_sales_order    => 1,
63
      save_and_purchase_order => 0,
64
      save_and_delivery_order => 1,
65
      save_and_ap_transaction => 1,
66
      delete                  => sub { $::instance_conf->get_purchase_order_show_delete },
67
    },
68
    workflow => {
69
      to_order_type        => "sales_order",
70
      to_quotation_type    => "request_quotation",
71
      to_order_copy_shipto => 0,
72
    },
73
    properties => {
74
      customervendor => "vendor",
75
      is_quotation   => 0,
76
      is_customer    => 0,
77
      nr_key         => "ordnumber",
78
    },
79
    part_classification_query => [ "used_for_purchase" => 1 ],
80
    right => "purchase_order_edit",
81
  },
82
  SALES_QUOTATION_TYPE() => {
20
  SALES_DELIVERY_ORDER_TYPE() => {
83 21
    text => {
84
      delete => t8('The quotation has been deleted'),
85
      saved  => t8('The quotation has been saved'),
86
      add    => t8("Add Quotation"),
87
      edit   => t8("Edit Quotation"),
22
      delete => t8('Delivery Order has been deleted'),
23
      saved  => t8('Delivery Order has been saved'),
24
      add    => t8("Add Sales Delivery Order"),
25
      edit   => t8("Edit Sales Delivery Order"),
88 26
    },
89 27
    show_menu => {
90 28
      save_and_quotation      => 0,
91 29
      save_and_rfq            => 0,
92
      save_and_sales_order    => 1,
30
      save_and_sales_order    => 0,
93 31
      save_and_purchase_order => 0,
94 32
      save_and_delivery_order => 0,
95 33
      save_and_ap_transaction => 0,
96
      delete                  => 1,
97
    },
98
    workflow => {
99
      to_order_type        => "sales_order",
100
      to_quotation_type    => "request_quotation",
101
      to_order_copy_shipto => 0,
34
      save_and_invoice        => 0,
35
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
102 36
    },
103 37
    properties => {
104 38
      customervendor => "customer",
105
      is_quotation   => 1,
106 39
      is_customer    => 1,
107
      nr_key         => "quonumber",
40
      nr_key         => "donumber",
41
      transfer       => 'out',
108 42
    },
109 43
    part_classification_query => [ "used_for_sale" => 1 ],
110
    right => "sales_quotation_edit",
44
    right => "sales_delivery_order_edit",
111 45
  },
112
  REQUEST_QUOTATION_TYPE() => {
46
  PURCHASE_DELIVERY_ORDER_TYPE() => {
113 47
    text => {
114
      delete => t8('The rfq has been deleted'),
115
      saved  => t8('The rfq has been saved'),
116
      add    => t8("Add Request for Quotation"),
117
      edit   => t8("Edit Request for Quotation"),
48
      delete => t8('Delivery Order has been deleted'),
49
      saved  => t8('Delivery Order has been saved'),
50
      add    => t8("Add Purchase Delivery Order"),
51
      edit   => t8("Edit Purchase Delivery Order"),
118 52
    },
119 53
    show_menu => {
120 54
      save_and_quotation      => 0,
121 55
      save_and_rfq            => 0,
122 56
      save_and_sales_order    => 0,
123
      save_and_purchase_order => 1,
57
      save_and_purchase_order => 0,
124 58
      save_and_delivery_order => 0,
125 59
      save_and_ap_transaction => 0,
126
      delete                  => 1,
127
    },
128
    workflow => {
129
      to_order_type        => "purchase_order",
130
      to_quotation_type    => "request_quotation",
131
      to_order_copy_shipto => 0,
60
      save_and_invoice        => 0,
61
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
132 62
    },
133 63
    properties => {
134 64
      customervendor => "vendor",
135
      is_quotation   => 1,
136 65
      is_customer    => 0,
137
      nr_key         => "quonumber",
66
      nr_key         => "donumber",
67
      transfer       => 'in',
138 68
    },
139 69
    part_classification_query => [ "used_for_purchase" => 1 ],
140
    right => "request_quotation_edit",
70
    right => "purchase_delivery_order_edit",
141 71
  },
142
  SALES_DELIVERY_ORDER_TYPE() => {
72
  SUPPLIER_DELIVERY_ORDER_TYPE() => {
143 73
    text => {
144 74
      delete => t8('Delivery Order has been deleted'),
145 75
      saved  => t8('Delivery Order has been saved'),
146
      add    => t8("Add Sales Delivery Order"),
147
      edit   => t8("Edit Sales Delivery Order"),
76
      add    => t8("Add Supplier Delivery Order"),
77
      edit   => t8("Edit Supplier Delivery Order"),
148 78
    },
149 79
    show_menu => {
150 80
      save_and_quotation      => 0,
......
153 83
      save_and_purchase_order => 0,
154 84
      save_and_delivery_order => 0,
155 85
      save_and_ap_transaction => 0,
86
      save_and_invoice        => 0,
156 87
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
157 88
    },
158 89
    properties => {
159
      customervendor => "customer",
160
      is_customer    => 1,
90
      customervendor => "vendor",
91
      is_customer    => 0,
161 92
      nr_key         => "donumber",
93
      transfer       => 'out',
162 94
    },
163
    part_classification_query => [ "used_for_sale" => 1 ],
164
    right => "sales_delivery_order_edit",
95
    part_classification_query => [ "used_for_purchase" => 1 ],
96
    right => "purchase_delivery_order_edit",
165 97
  },
166
  PURCHASE_DELIVERY_ORDER_TYPE() => {
98
  RMA_DELIVERY_ORDER_TYPE() => {
167 99
    text => {
168 100
      delete => t8('Delivery Order has been deleted'),
169 101
      saved  => t8('Delivery Order has been saved'),
170
      add    => t8("Add Purchase Delivery Order"),
171
      edit   => t8("Edit Purchase Delivery Order"),
102
      add    => t8("Add RMA Delivery Order"),
103
      edit   => t8("Edit RMA Delivery Order"),
172 104
    },
173 105
    show_menu => {
174 106
      save_and_quotation      => 0,
......
177 109
      save_and_purchase_order => 0,
178 110
      save_and_delivery_order => 0,
179 111
      save_and_ap_transaction => 0,
112
      save_and_invoice        => 0,
180 113
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
181 114
    },
182 115
    properties => {
183
      customervendor => "vendor",
116
      customervendor => "customer",
184 117
      is_customer    => 0,
185 118
      nr_key         => "donumber",
119
      transfer       => 'in',
186 120
    },
187
    part_classification_query => [ "used_for_purchase" => 1 ],
188
    right => "purchase_delivery_order_edit",
121
    part_classification_query => [ "used_for_sale" => 1 ],
122
    right => "sales_delivery_order_edit",
189 123
  },
190

  
191 124
);
192 125

  
193 126
sub new {
......
201 134

  
202 135
sub valid_types {
203 136
  [
204
    SALES_ORDER_TYPE,
205
    PURCHASE_ORDER_TYPE,
206
    SALES_QUOTATION_TYPE,
207
    REQUEST_QUOTATION_TYPE,
208 137
    SALES_DELIVERY_ORDER_TYPE,
209 138
    PURCHASE_DELIVERY_ORDER_TYPE,
139
    SUPPLIER_DELIVERY_ORDER_TYPE,
140
    RMA_DELIVERY_ORDER_TYPE,
210 141
  ];
211 142
}
212 143

  
......
286 217
sub set_reqdate_by_type {
287 218
  my ($self) = @_;
288 219

  
289
  my $extra_days = $self->type eq SALES_QUOTATION_TYPE ? $::instance_conf->get_reqdate_interval       :
290
                   $self->type eq SALES_ORDER_TYPE     ? $::instance_conf->get_delivery_date_interval : 1;
291

  
292
  if (   ($self->type eq SALES_ORDER_TYPE     &&  $::instance_conf->get_deliverydate_on)
293
      || ($self->type eq SALES_QUOTATION_TYPE &&  $::instance_conf->get_reqdate_on)
294
      && (!$self->order->reqdate)) {
295
    $self->c->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days));
220
  if (!$self->c->order->reqdate) {
221
    $self->c->order->reqdate(DateTime->today_local->next_workday(extra_days => 1));
296 222
  }
297 223
}
298 224

  
......
300 226
  my ($self, $reqdate, $saved_reqdate) = @_;
301 227

  
302 228
  if ($reqdate == $saved_reqdate) {
303
    my $extra_days = $self->type eq SALES_QUOTATION_TYPE ? $::instance_conf->get_reqdate_interval       :
304
                     $self->type eq SALES_ORDER_TYPE     ? $::instance_conf->get_delivery_date_interval : 1;
305

  
306
    if (   ($self->type eq SALES_ORDER_TYPE     &&  !$::instance_conf->get_deliverydate_on)
307
        || ($self->type eq SALES_QUOTATION_TYPE &&  !$::instance_conf->get_reqdate_on)) {
308
      return '';
309
    } else {
310
      return DateTime->today_local->next_workday(extra_days => $extra_days);
311
    }
229
    return DateTime->today_local->next_workday(extra_days => 1);
312 230
  } else {
313 231
    return $reqdate;
314 232
  }
locale/de/all
188 188
  'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
189 189
  'Add Quotation'               => 'Angebot erfassen',
190 190
  'Add RFQ'                     => 'Preisanfrage erfassen',
191
  'Add RMA Delivery Order'      => 'Retouren-Lieferschein erfassen',
191 192
  'Add Request for Quotation'   => 'Anfrage erfassen',
192 193
  'Add Requirement Spec'        => 'Pflichtenheft erfassen',
193 194
  'Add Requirement Spec Template' => 'Pflichtenheftvorlage erfassen',
......
196 197
  'Add Sales Order'             => 'Auftrag erfassen',
197 198
  'Add Service'                 => 'Dienstleistung erfassen',
198 199
  'Add Storno Credit Note'      => 'Gutschrift Storno hinzufügen',
200
  'Add Supplier Delivery Order' => 'Beistell-Lieferschein erfassen',
199 201
  'Add Transaction'             => 'Dialogbuchen',
200 202
  'Add User'                    => 'Neuer Benutzer',
201 203
  'Add User Group'              => 'Neue Benutzergruppe',
......
1238 1240
  'Edit Purchase Delivery Order' => 'Lieferschein (Einkauf) bearbeiten',
1239 1241
  'Edit Purchase Order'         => 'Lieferantenauftrag bearbeiten',
1240 1242
  'Edit Quotation'              => 'Angebot bearbeiten',
1243
  'Edit RMA Delivery Order'     => 'Retouren-Lieferschein bearbeiten',
1241 1244
  'Edit Request for Quotation'  => 'Anfrage bearbeiten',
1242 1245
  'Edit SEPA strings'           => 'Begriffe bei SEPA-Überweisungen bearbeiten',
1243 1246
  'Edit Sales Delivery Order'   => 'Lieferschein (Verkauf) bearbeiten',
......
1246 1249
  'Edit Service'                => 'Dienstleistung bearbeiten',
1247 1250
  'Edit Storno Credit Note'     => 'Storno Gutschrift bearbeiten',
1248 1251
  'Edit Storno Invoice'         => 'Stornorechnung bearbeiten',
1252
  'Edit Supplier Delivery Order' => 'Beistell-Lieferschein bearbeiten',
1249 1253
  'Edit User'                   => 'Benutzerdaten bearbeiten',
1250 1254
  'Edit User Group'             => 'Benutzergruppe bearbeiten',
1251 1255
  'Edit Vendor'                 => 'Lieferant editieren',

Auch abrufbar als: Unified diff