Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 648b2e7e

Von Sven Schöling vor mehr als 16 Jahren hinzugefügt

  • ID 648b2e7ea886ac021cb1f98bed9955e71f09cf29
  • Vorgänger 2a5030b2
  • Nachfolger d7420ba8

order_links auf aktuelle code richtlinien gebracht, und einige konstruktionen behutsam vereinfacht.

Unterschiede anzeigen:

bin/mozilla/oe.pl
197 197

  
198 198
  OE->retrieve(\%myconfig, \%$form);
199 199

  
200
  $payment_id  = $form->{payment_id}  if $form->{payment_id};
201
  $language_id = $form->{language_id} if $form->{language_id};
202
  $taxzone_id  = $form->{taxzone_id}  if $form->{taxzone_id};
203
  $salesman_id = $form->{salesman_id} if $editing;
204

  
205 200
  # if multiple rowcounts (== collective order) then check if the
206 201
  # there were more than one customer (in that case OE::retrieve removes
207 202
  # the content from the field)
208
  if (   $form->{rowcount}
209
      && $form->{type} eq 'sales_order'
210
      && defined $form->{customer}
211
      && $form->{customer} eq '') {
212

  
213
    #    $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
214
    $form->error(
215
                 $locale->text(
216
                   'Collective Orders only work for orders from one customer!')
217
    );
203
  if (   $form->{rowcount}          && $form->{type} eq 'sales_order'
204
      && defined $form->{customer}  && $form->{customer} eq '') {
205
    $form->error($locale->text('Collective Orders only work for orders from one customer!'));
218 206
  }
219 207

  
220
  $taxincluded = $form->{taxincluded};
221
  $form->{shipto} = 1 if $form->{id};
208
  $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"};
222 209

  
223
  if ($form->{"all_$form->{vc}"}) {
224
    unless ($form->{"$form->{vc}_id"}) {
225
      $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
226
    }
227
  }
228

  
229
  $cp_id    = $form->{cp_id};
230
  $intnotes = $form->{intnotes};
210
  $payment_id     = $form->{payment_id}  if $form->{payment_id};
211
  $language_id    = $form->{language_id} if $form->{language_id};
212
  $taxzone_id     = $form->{taxzone_id}  if $form->{taxzone_id};
213
  $salesman_id    = $form->{salesman_id} if $editing;
214
  $taxincluded    = $form->{taxincluded};
215
  $cp_id          = $form->{cp_id};
216
  $intnotes       = $form->{intnotes};
217
  $form->{shipto} = 1 if $form->{id};
231 218

  
232 219
  # get customer / vendor
233
  if ($form->{type} =~ /(purchase_order|request_quotation)/) {
234
    IR->get_vendor(\%myconfig, \%$form);
235

  
236
    #quote all_vendor Bug 133
237
    foreach $ref (@{ $form->{all_vendor} }) {
238
      $ref->{name} = $form->quote($ref->{name});
239
    }
240

  
241
  }
242
  if ($form->{type} =~ /sales_(order|quotation)/) {
243
    IS->get_customer(\%myconfig, \%$form);
244

  
245
    #quote all_vendor Bug 133
246
    foreach $ref (@{ $form->{all_customer} }) {
247
      $ref->{name} = $form->quote($ref->{name});
248
    }
249

  
250
  }
251
  $form->{cp_id} = $cp_id;
252

  
253
  if ($payment_id) {
254
    $form->{payment_id} = $payment_id;
255
  }
256
  if ($language_id) {
257
    $form->{language_id} = $language_id;
258
  }
259
  if ($taxzone_id) {
260
    $form->{taxzone_id} = $taxzone_id;
261
  }
262
  $form->{intnotes} = $intnotes if $intnotes;
220
  IR->get_vendor(\%myconfig, \%$form)   if $form->{type} =~ /(purchase_order|request_quotation)/;
221
  IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/;
222

  
223
  $form->{cp_id}       = $cp_id;
224
  $form->{payment_id}  = $payment_id  if $payment_id;
225
  $form->{language_id} = $language_id if $language_id;
226
  $form->{taxzone_id}  = $taxzone_id  if $taxzone_id;
227
  $form->{intnotes}    = $intnotes    if $intnotes;
228
  $form->{taxincluded} = $taxincluded if $form->{id};
229
  $form->{salesman_id} = $salesman_id if $editing;
230
  $form->{forex}       = $form->{exchangerate};
231
  $form->{employee}    = "$form->{employee}--$form->{employee_id}";
232

  
233
  # build vendor/customer drop down
263 234
  ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
264 235
  $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
265 236

  
266
  # build the popup menus
267 237
  if (@{ $form->{"all_$form->{vc}"} }) {
268
    $form->{ $form->{vc} } =
269
      qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
270
    map { $form->{"select$form->{vc}"} .=
271
"<option>$_->{name}--$_->{id}</option>\n" }
272
      (@{ $form->{"all_$form->{vc}"} });
238
    map { $_->{name} = $form->quote($_->{name}) } @{ $form->{"all_$form->{vc}"} };
239
    $form->{ $form->{vc} }       = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
240
    $form->{"select$form->{vc}"} = join "\n", map "<option>$_->{name}--$_->{id}</option>", @{ $form->{"all_$form->{vc}"} };
273 241
  }
274 242

  
275
  $form->{taxincluded} = $taxincluded if ($form->{id});
276

  
277 243
  # departments
278 244
  if (@{ $form->{all_departments} }) {
279
    $form->{selectdepartment} = "<option>\n";
280 245
    $form->{department}       = "$form->{department}--$form->{department_id}";
281

  
282
    map {
283
      $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}</option>\n"
284
    } @{ $form->{all_departments} };
246
    $form->{selectdepartment} = join "\n", "<option>", map "<option>$_->{description}--$_->{id}</option>", @{ $form->{all_departments} };
285 247
  }
286 248

  
287
  $form->{employee} = "$form->{employee}--$form->{employee_id}";
288

  
289
  # forex
290
  $form->{forex} = $form->{exchangerate};
291

  
292
  $form->{salesman_id} = $salesman_id if ($editing);
293

  
294 249
  $lxdebug->leave_sub();
295 250
}
296 251

  

Auch abrufbar als: Unified diff