Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3314d7c2

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

  • ID 3314d7c2247d46033fcd7cd1e1663a705db02fea
  • Vorgänger 13dcc338
  • Nachfolger 9257ca9a

bp strict

Unterschiede anzeigen:

bin/mozilla/bp.pl
39 39

  
40 40
require "bin/mozilla/common.pl";
41 41

  
42
use strict;
43

  
42 44
# end of main
43 45

  
44 46
sub assert_bp_access {
47
  my $form     = $main::form;
48

  
45 49
  my %access_map = (
46 50
    'invoice'           => 'invoice_edit',
47 51
    'sales_order'       => 'sales_order_edit',
......
53 57
  );
54 58

  
55 59
  if ($form->{type} && $access_map{$form->{type}}) {
56
    $auth->assert($access_map{$form->{type}});
60
    $main::auth->assert($access_map{$form->{type}});
57 61

  
58 62
  } elsif ($form->{type} eq 'packing_list') {
59
    $lxdebug->message(0, "1");
60
    if (!$auth->assert('sales_order_edit', 1)) {
61
    $lxdebug->message(0, "2");
62
      $auth->assert('invoice_edit') ;
63
    $main::lxdebug->message(0, "1");
64
    if (!$main::auth->assert('sales_order_edit', 1)) {
65
    $main::lxdebug->message(0, "2");
66
      $main::auth->assert('invoice_edit') ;
63 67
    }
64
    $lxdebug->message(0, "3");
68
    $main::lxdebug->message(0, "3");
65 69

  
66 70
  } else {
67
    $auth->assert('DOES_NOT_EXIST');
71
    $main::auth->assert('DOES_NOT_EXIST');
68 72
  }
69 73
}
70 74

  
71 75
sub search {
72
  $lxdebug->enter_sub();
76
  $main::lxdebug->enter_sub();
77

  
78
  my $form     = $main::form;
79
  my %myconfig = %main::myconfig;
80
  my $locale   = $main::locale;
81

  
82
  my ($name, $account, $onload);
73 83

  
74 84
  assert_bp_access();
75 85

  
......
96 106
  # $locale->text('Customer')
97 107
  # $locale->text('Vendor')
98 108

  
99
  %label = (
109
  my %label = (
100 110
       invoice =>
101 111
         { title => 'Sales Invoices', name => 'Customer', l_invnumber => 'Y' },
102 112
       packing_list =>
......
161 171
        $account .= qq|
162 172
	  <td colspan=3><select name=account>
163 173
|;
164
        foreach $ref (@{ $form->{accounts} }) {
174
        foreach my $ref (@{ $form->{accounts} }) {
165 175
          $account .= qq|
166 176
          <option>$ref->{accno}--$ref->{description}
167 177
|;
......
186 196

  
187 197
  # use JavaScript Calendar or not
188 198
  $form->{jsscript} = 1;
189
  $jsscript = "";
199
  my $jsscript = "";
200
  my ($button1, $button2);
190 201
  if ($form->{jsscript}) {
191 202

  
192 203
    # with JavaScript Calendar
......
272 283
</html>
273 284
|;
274 285

  
275
  $lxdebug->leave_sub();
286
  $main::lxdebug->leave_sub();
276 287
}
277 288

  
278 289
sub remove {
279
  $lxdebug->enter_sub();
290
  $main::lxdebug->enter_sub();
291

  
292
  my $form     = $main::form;
293
  my $locale   = $main::locale;
280 294

  
281 295
  assert_bp_access();
282 296

  
283
  $selected = 0;
297
  my $selected = 0;
284 298

  
285
  for $i (1 .. $form->{rowcount}) {
299
  for my $i (1 .. $form->{rowcount}) {
286 300
    if ($form->{"checked_$i"}) {
287 301
      $selected = 1;
288 302
      last;
......
303 317

  
304 318
  map { delete $form->{$_} } qw(action header);
305 319

  
306
  foreach $key (keys %$form) {
320
  foreach my $key (keys %$form) {
307 321
    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
308 322
    print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
309 323
  }
......
324 338
</html>
325 339
|;
326 340

  
327
  $lxdebug->leave_sub();
341
  $main::lxdebug->leave_sub();
328 342
}
329 343

  
330 344
sub yes {
331
  $lxdebug->enter_sub();
345
  $main::lxdebug->enter_sub();
346

  
347
  my $form     = $main::form;
348
  my %myconfig = %main::myconfig;
349
  my $locale   = $main::locale;
332 350

  
333 351
  assert_bp_access();
334 352

  
......
336 354
  $form->{callback} .= "&header=1" if $form->{callback};
337 355

  
338 356
  $form->redirect($locale->text('Removed spoolfiles!'))
339
    if (BP->delete_spool(\%myconfig, \%$form, $spool));
357
    if (BP->delete_spool(\%myconfig, \%$form, $main::spool));
340 358
  $form->error($locale->text('Cannot remove files!'));
341 359

  
342
  $lxdebug->leave_sub();
360
  $main::lxdebug->leave_sub();
343 361
}
344 362

  
345 363
sub print {
346
  $lxdebug->enter_sub();
364
  $main::lxdebug->enter_sub();
365

  
366
  my $form     = $main::form;
367
  my %myconfig = %main::myconfig;
368
  my $locale   = $main::locale;
347 369

  
348 370
  assert_bp_access();
349 371

  
......
360 382
    $form->{callback} .= "&header=1";
361 383
  }
362 384

  
363
  for $i (1 .. $form->{rowcount}) {
385
  for my $i (1 .. $form->{rowcount}) {
364 386
    if ($form->{"checked_$i"}) {
365 387
      $form->info($locale->text('Printing ... '));
366 388

  
367
      if (BP->print_spool(\%myconfig, \%$form, $spool, "| $selected_printer")) {
389
      if (BP->print_spool(\%myconfig, \%$form, $main::spool, "| $selected_printer")) {
368 390
        print $locale->text('done');
369 391
        $form->redirect($locale->text('Marked entries printed!'));
370 392
      }
......
374 396

  
375 397
  $form->error('Nothing selected!');
376 398

  
377
  $lxdebug->leave_sub();
399
  $main::lxdebug->leave_sub();
378 400
}
379 401

  
380 402
sub list_spool {
381
  $lxdebug->enter_sub();
403
  $main::lxdebug->enter_sub();
404

  
405
  my $form     = $main::form;
406
  my %myconfig = %main::myconfig;
407
  my $locale   = $main::locale;
382 408

  
383 409
  assert_bp_access();
384 410

  
......
388 414

  
389 415
  BP->get_spoolfiles(\%myconfig, \%$form);
390 416

  
391
  $title = $form->escape($form->{title});
392
  $href  = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
417
  my $title = $form->escape($form->{title});
418
  my $href  = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
393 419

  
394 420
  $title = $form->escape($form->{title}, 1);
395
  $callback =
421
  my $callback =
396 422
    "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
423
  my $option;
397 424

  
398 425
  if ($form->{ $form->{vc} }) {
399 426
    $callback .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} }, 1);
......
446 473
      . $locale->date(\%myconfig, $form->{transdateto}, 1);
447 474
  }
448 475

  
449
  $name = ucfirst $form->{vc};
476
  my $name = ucfirst $form->{vc};
450 477

  
451
  @columns = (transdate);
478
  my @columns = qw(transdate);
452 479
  if ($form->{type} =~ /(invoice|packing_list|check|receipt)/) {
453 480
    push @columns, "invnumber";
454 481
  }
......
459 486
    push @columns, "quonumber";
460 487
  }
461 488

  
462
  push @columns, (name, spoolfile);
463
  @column_index = $form->sort_columns(@columns);
489
  push @columns, qw(name spoolfile);
490
  my @column_index = $form->sort_columns(@columns);
464 491
  unshift @column_index, "checked";
465 492

  
493
  my %column_header;
494
  my %column_data;
495

  
466 496
  $column_header{checked}   = "<th class=listheading>&nbsp;</th>";
467 497
  $column_header{transdate} =
468 498
      "<th><a class=listheading href=$href&sort=transdate>"
......
520 550
  # escape callback for href
521 551
  $callback = $form->escape($callback);
522 552

  
523
  $i = 0;
553
  my $i = 0;
554
  my $j = 0;
555
  my $spoolfile;
524 556

  
525
  foreach $ref (@{ $form->{SPOOL} }) {
557
  foreach my $ref (@{ $form->{SPOOL} }) {
526 558

  
527 559
    $i++;
528 560

  
......
531 563
    if ($ref->{invoice}) {
532 564
      $ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir";
533 565
    }
534
    $module = "$ref->{module}.pl";
566
    my $module = "$ref->{module}.pl";
535 567

  
536 568
    $column_data{transdate} = "<td>$ref->{transdate}&nbsp;</td>";
537 569

  
......
550 582
      "<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
551 583
    $column_data{name}      = "<td>$ref->{name}</td>";
552 584
    $column_data{spoolfile} =
553
      qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
585
      qq|<td><a href=$main::spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
554 586
<input type=hidden name="spoolfile_$i" value=$ref->{spoolfile}>
555 587
|;
556 588

  
......
628 660
}
629 661

  
630 662
sub select_all {
631
  $lxdebug->enter_sub();
663
  $main::lxdebug->enter_sub();
664

  
665
  my $form     = $main::form;
632 666

  
633 667
  assert_bp_access();
634 668

  
635 669
  map { $form->{"checked_$_"} = 1 } (1 .. $form->{rowcount});
636 670
  &list_spool;
637 671

  
638
  $lxdebug->leave_sub();
672
  $main::lxdebug->leave_sub();
639 673
}
640 674

  
641
sub continue { call_sub($form->{"nextsub"}); }
675
sub continue { call_sub($main::form->{"nextsub"}); }
642 676

  

Auch abrufbar als: Unified diff