Revision 3ae0915d
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/ct.pl | ||
---|---|---|
55 | 55 |
require "bin/mozilla/common.pl"; |
56 | 56 |
require "bin/mozilla/reportgenerator.pl"; |
57 | 57 |
|
58 |
use strict; |
|
58 | 59 |
1; |
59 | 60 |
|
60 | 61 |
# end of main |
61 | 62 |
|
62 | 63 |
sub add { |
63 |
$lxdebug->enter_sub(); |
|
64 |
$main::lxdebug->enter_sub(); |
|
65 |
|
|
66 |
$main::auth->assert('customer_vendor_edit'); |
|
64 | 67 |
|
65 |
$auth->assert('customer_vendor_edit'); |
|
68 |
my $form = $main::form; |
|
69 |
my %myconfig = %main::myconfig; |
|
66 | 70 |
|
67 | 71 |
$form->{title} = "Add"; |
68 | 72 |
$form->{callback} = "$form->{script}?action=add&db=$form->{db}" unless $form->{callback}; |
... | ... | |
72 | 76 |
&form_header; |
73 | 77 |
&form_footer; |
74 | 78 |
|
75 |
$lxdebug->leave_sub(); |
|
79 |
$main::lxdebug->leave_sub();
|
|
76 | 80 |
} |
77 | 81 |
|
78 | 82 |
sub search { |
79 |
$lxdebug->enter_sub(); |
|
83 |
$main::lxdebug->enter_sub(); |
|
84 |
|
|
85 |
$main::auth->assert('customer_vendor_edit'); |
|
80 | 86 |
|
81 |
$auth->assert('customer_vendor_edit'); |
|
87 |
my $form = $main::form; |
|
88 |
my $locale = $main::locale; |
|
82 | 89 |
|
83 | 90 |
$form->{IS_CUSTOMER} = $form->{db} eq 'customer'; |
84 | 91 |
|
... | ... | |
98 | 105 |
$form->header(); |
99 | 106 |
print $form->parse_html_template('ct/search'); |
100 | 107 |
|
101 |
$lxdebug->leave_sub(); |
|
108 |
$main::lxdebug->leave_sub();
|
|
102 | 109 |
} |
103 | 110 |
|
104 | 111 |
sub list_names { |
105 |
$lxdebug->enter_sub(); |
|
112 |
$main::lxdebug->enter_sub();
|
|
106 | 113 |
|
107 |
$auth->assert('customer_vendor_edit'); |
|
114 |
$main::auth->assert('customer_vendor_edit'); |
|
115 |
|
|
116 |
my $form = $main::form; |
|
117 |
my %myconfig = %main::myconfig; |
|
118 |
my $locale = $main::locale; |
|
108 | 119 |
|
109 | 120 |
$form->{IS_CUSTOMER} = $form->{db} eq 'customer'; |
110 | 121 |
|
... | ... | |
236 | 247 |
|
237 | 248 |
$report->generate_with_headers(); |
238 | 249 |
|
239 |
$lxdebug->leave_sub(); |
|
250 |
$main::lxdebug->leave_sub();
|
|
240 | 251 |
} |
241 | 252 |
|
242 | 253 |
sub edit { |
243 |
$lxdebug->enter_sub(); |
|
254 |
$main::lxdebug->enter_sub(); |
|
255 |
|
|
256 |
$main::auth->assert('customer_vendor_edit'); |
|
244 | 257 |
|
245 |
$auth->assert('customer_vendor_edit'); |
|
258 |
my $form = $main::form; |
|
259 |
my %myconfig = %main::myconfig; |
|
246 | 260 |
|
247 | 261 |
# show history button |
248 | 262 |
$form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|; |
... | ... | |
259 | 273 |
&form_header; |
260 | 274 |
&form_footer; |
261 | 275 |
|
262 |
$lxdebug->leave_sub(); |
|
276 |
$main::lxdebug->leave_sub();
|
|
263 | 277 |
} |
264 | 278 |
|
265 | 279 |
sub form_header { |
266 |
$lxdebug->enter_sub(); |
|
280 |
$main::lxdebug->enter_sub();
|
|
267 | 281 |
|
268 |
$auth->assert('customer_vendor_edit'); |
|
282 |
$main::auth->assert('customer_vendor_edit'); |
|
283 |
|
|
284 |
my $form = $main::form; |
|
285 |
my %myconfig = %main::myconfig; |
|
286 |
my $locale = $main::locale; |
|
269 | 287 |
|
270 | 288 |
$form->get_lists("employees" => "ALL_EMPLOYEES", |
271 | 289 |
"taxzones" => "ALL_TAXZONES"); |
... | ... | |
301 | 319 |
$form->header; |
302 | 320 |
print $form->parse_html_template('ct/form_header'); |
303 | 321 |
|
304 |
$lxdebug->leave_sub(); |
|
322 |
$main::lxdebug->leave_sub();
|
|
305 | 323 |
} |
306 | 324 |
|
307 | 325 |
sub form_footer { |
308 |
$lxdebug->enter_sub(); |
|
326 |
$main::lxdebug->enter_sub(); |
|
327 |
|
|
328 |
$main::auth->assert('customer_vendor_edit'); |
|
309 | 329 |
|
310 |
$auth->assert('customer_vendor_edit');
|
|
330 |
my $form = $main::form;
|
|
311 | 331 |
|
312 | 332 |
print $form->parse_html_template('ct/form_footer', { is_orphaned => $form->{status} eq 'orphaned', |
313 | 333 |
is_customer => $form->{db} eq 'customer' }); |
314 |
$lxdebug->leave_sub(); |
|
334 |
$main::lxdebug->leave_sub();
|
|
315 | 335 |
} |
316 | 336 |
|
317 | 337 |
sub add_transaction { |
318 |
$lxdebug->enter_sub(); |
|
338 |
$main::lxdebug->enter_sub();
|
|
319 | 339 |
|
320 |
$auth->assert('customer_vendor_edit & ' . |
|
340 |
$main::auth->assert('customer_vendor_edit & ' .
|
|
321 | 341 |
'(general_ledger | invoice_edit | vendor_invoice_edit | ' . |
322 | 342 |
' request_quotation_edit | sales_quotation_edit | sales_order_edit | purchase_order_edit)'); |
323 | 343 |
|
344 |
my $form = $main::form; |
|
345 |
my %myconfig = %main::myconfig; |
|
346 |
my $locale = $main::locale; |
|
347 |
|
|
324 | 348 |
# # saving the history |
325 | 349 |
# if(!exists $form->{addition}) { |
326 | 350 |
# $form->{addition} = "ADD TRANSACTION"; |
... | ... | |
336 | 360 |
} |
337 | 361 |
|
338 | 362 |
$form->{callback} = $form->escape($form->{callback}, 1); |
339 |
$name = $form->escape("$form->{name}", 1); |
|
363 |
my $name = $form->escape("$form->{name}", 1);
|
|
340 | 364 |
|
341 | 365 |
$form->{callback} = |
342 | 366 |
"$form->{script}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}"; |
343 | 367 |
$form->redirect; |
344 | 368 |
|
345 |
$lxdebug->leave_sub(); |
|
369 |
$main::lxdebug->leave_sub();
|
|
346 | 370 |
} |
347 | 371 |
|
348 | 372 |
sub save_and_ap_transaction { |
349 |
$lxdebug->enter_sub(); |
|
373 |
$main::lxdebug->enter_sub(); |
|
374 |
|
|
375 |
$main::auth->assert('customer_vendor_edit & general_ledger'); |
|
350 | 376 |
|
351 |
$auth->assert('customer_vendor_edit & general_ledger'); |
|
377 |
my $form = $main::form; |
|
378 |
my %myconfig = %main::myconfig; |
|
352 | 379 |
|
353 | 380 |
$form->{script} = "ap.pl"; |
354 | 381 |
# saving the history |
... | ... | |
359 | 386 |
} |
360 | 387 |
# /saving the history |
361 | 388 |
&add_transaction; |
362 |
$lxdebug->leave_sub(); |
|
389 |
$main::lxdebug->leave_sub();
|
|
363 | 390 |
} |
364 | 391 |
|
365 | 392 |
sub save_and_ar_transaction { |
366 |
$lxdebug->enter_sub(); |
|
393 |
$main::lxdebug->enter_sub();
|
|
367 | 394 |
|
368 |
$auth->assert('customer_vendor_edit & general_ledger'); |
|
395 |
$main::auth->assert('customer_vendor_edit & general_ledger'); |
|
396 |
|
|
397 |
my $form = $main::form; |
|
398 |
my %myconfig = %main::myconfig; |
|
369 | 399 |
|
370 | 400 |
$form->{script} = "ar.pl"; |
371 | 401 |
# saving the history |
... | ... | |
376 | 406 |
} |
377 | 407 |
# /saving the history |
378 | 408 |
&add_transaction; |
379 |
$lxdebug->leave_sub(); |
|
409 |
$main::lxdebug->leave_sub();
|
|
380 | 410 |
} |
381 | 411 |
|
382 | 412 |
sub save_and_invoice { |
383 |
$lxdebug->enter_sub(); |
|
413 |
$main::lxdebug->enter_sub(); |
|
414 |
|
|
415 |
my $form = $main::form; |
|
416 |
my %myconfig = %main::myconfig; |
|
384 | 417 |
|
385 | 418 |
if ($form->{db} eq 'customer') { |
386 |
$auth->assert('customer_vendor_edit & invoice_edit'); |
|
419 |
$main::auth->assert('customer_vendor_edit & invoice_edit');
|
|
387 | 420 |
} else { |
388 |
$auth->assert('customer_vendor_edit & vendor_invoice_edit'); |
|
421 |
$main::auth->assert('customer_vendor_edit & vendor_invoice_edit');
|
|
389 | 422 |
} |
390 | 423 |
|
391 | 424 |
$form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl"; |
... | ... | |
398 | 431 |
} |
399 | 432 |
# /saving the history |
400 | 433 |
&add_transaction; |
401 |
$lxdebug->leave_sub(); |
|
434 |
$main::lxdebug->leave_sub();
|
|
402 | 435 |
} |
403 | 436 |
|
404 | 437 |
sub save_and_rfq { |
405 |
$lxdebug->enter_sub(); |
|
438 |
$main::lxdebug->enter_sub();
|
|
406 | 439 |
|
407 |
$auth->assert('customer_vendor_edit & request_quotation_edit'); |
|
440 |
$main::auth->assert('customer_vendor_edit & request_quotation_edit'); |
|
441 |
|
|
442 |
my $form = $main::form; |
|
443 |
my %myconfig = %main::myconfig; |
|
408 | 444 |
|
409 | 445 |
$form->{script} = "oe.pl"; |
410 | 446 |
$form->{type} = "request_quotation"; |
... | ... | |
416 | 452 |
} |
417 | 453 |
# /saving the history |
418 | 454 |
&add_transaction; |
419 |
$lxdebug->leave_sub(); |
|
455 |
$main::lxdebug->leave_sub();
|
|
420 | 456 |
} |
421 | 457 |
|
422 | 458 |
sub save_and_quotation { |
423 |
$lxdebug->enter_sub(); |
|
459 |
$main::lxdebug->enter_sub(); |
|
460 |
|
|
461 |
$main::auth->assert('customer_vendor_edit & sales_quotation_edit'); |
|
424 | 462 |
|
425 |
$auth->assert('customer_vendor_edit & sales_quotation_edit'); |
|
463 |
my $form = $main::form; |
|
464 |
my %myconfig = %main::myconfig; |
|
426 | 465 |
|
427 | 466 |
$form->{script} = "oe.pl"; |
428 | 467 |
$form->{type} = "sales_quotation"; |
... | ... | |
434 | 473 |
} |
435 | 474 |
# /saving the history |
436 | 475 |
&add_transaction; |
437 |
$lxdebug->leave_sub(); |
|
476 |
$main::lxdebug->leave_sub();
|
|
438 | 477 |
} |
439 | 478 |
|
440 | 479 |
sub save_and_order { |
441 |
$lxdebug->enter_sub(); |
|
480 |
$main::lxdebug->enter_sub(); |
|
481 |
|
|
482 |
my $form = $main::form; |
|
483 |
my %myconfig = %main::myconfig; |
|
442 | 484 |
|
443 | 485 |
if ($form->{db} eq 'customer') { |
444 |
$auth->assert('customer_vendor_edit & sales_order_edit'); |
|
486 |
$main::auth->assert('customer_vendor_edit & sales_order_edit');
|
|
445 | 487 |
} else { |
446 |
$auth->assert('customer_vendor_edit & purchase_order_edit'); |
|
488 |
$main::auth->assert('customer_vendor_edit & purchase_order_edit');
|
|
447 | 489 |
} |
448 | 490 |
|
449 | 491 |
$form->{script} = "oe.pl"; |
... | ... | |
457 | 499 |
} |
458 | 500 |
# /saving the history |
459 | 501 |
&add_transaction; |
460 |
$lxdebug->leave_sub(); |
|
502 |
$main::lxdebug->leave_sub();
|
|
461 | 503 |
} |
462 | 504 |
|
463 | 505 |
sub save_and_close { |
464 |
$lxdebug->enter_sub(); |
|
506 |
$main::lxdebug->enter_sub(); |
|
507 |
|
|
508 |
$main::auth->assert('customer_vendor_edit'); |
|
465 | 509 |
|
466 |
$auth->assert('customer_vendor_edit'); |
|
510 |
my $form = $main::form; |
|
511 |
my %myconfig = %main::myconfig; |
|
512 |
my $locale = $main::locale; |
|
467 | 513 |
|
468 |
$msg = ucfirst $form->{db}; |
|
469 |
$imsg .= " saved!";
|
|
514 |
my $msg = ucfirst $form->{db};
|
|
515 |
$msg .= " saved!"; |
|
470 | 516 |
|
471 | 517 |
$form->isblank("name", $locale->text("Name missing!")); |
518 |
my $rc; |
|
472 | 519 |
if ($form->{"db"} eq "customer") { |
473 | 520 |
$rc = CT->save_customer(\%myconfig, \%$form); |
474 | 521 |
} else { |
... | ... | |
486 | 533 |
# /saving the history |
487 | 534 |
$form->redirect($locale->text($msg)); |
488 | 535 |
|
489 |
$lxdebug->leave_sub(); |
|
536 |
$main::lxdebug->leave_sub();
|
|
490 | 537 |
} |
491 | 538 |
|
492 | 539 |
sub save { |
493 |
$lxdebug->enter_sub(); |
|
540 |
$main::lxdebug->enter_sub();
|
|
494 | 541 |
|
495 |
$auth->assert('customer_vendor_edit'); |
|
542 |
$main::auth->assert('customer_vendor_edit');
|
|
496 | 543 |
|
497 |
$msg = ucfirst $form->{db}; |
|
498 |
$imsg .= " saved!"; |
|
544 |
my $form = $main::form; |
|
545 |
my %myconfig = %main::myconfig; |
|
546 |
my $locale = $main::locale; |
|
547 |
|
|
548 |
my $msg = ucfirst $form->{db}; |
|
549 |
$msg .= " saved!"; |
|
499 | 550 |
|
500 | 551 |
$form->isblank("name", $locale->text("Name missing!")); |
501 | 552 |
|
... | ... | |
522 | 573 |
# /saving the history |
523 | 574 |
&edit; |
524 | 575 |
exit; |
525 |
$lxdebug->leave_sub(); |
|
576 |
$main::lxdebug->leave_sub();
|
|
526 | 577 |
} |
527 | 578 |
|
528 | 579 |
sub delete { |
529 |
$lxdebug->enter_sub(); |
|
580 |
$main::lxdebug->enter_sub(); |
|
581 |
|
|
582 |
$main::auth->assert('customer_vendor_edit'); |
|
530 | 583 |
|
531 |
$auth->assert('customer_vendor_edit'); |
|
584 |
my $form = $main::form; |
|
585 |
my %myconfig = %main::myconfig; |
|
586 |
my $locale = $main::locale; |
|
532 | 587 |
|
533 | 588 |
CT->delete(\%myconfig, \%$form); |
534 | 589 |
|
535 |
$msg = ucfirst $form->{db}; |
|
590 |
my $msg = ucfirst $form->{db};
|
|
536 | 591 |
$msg .= " deleted!"; |
537 | 592 |
# saving the history |
538 | 593 |
if(!exists $form->{addition}) { |
... | ... | |
546 | 601 |
$msg = "Cannot delete $form->{db}"; |
547 | 602 |
$form->error($locale->text($msg)); |
548 | 603 |
|
549 |
$lxdebug->leave_sub(); |
|
604 |
$main::lxdebug->leave_sub();
|
|
550 | 605 |
} |
551 | 606 |
|
552 | 607 |
sub display { |
553 |
$lxdebug->enter_sub(); |
|
608 |
$main::lxdebug->enter_sub();
|
|
554 | 609 |
|
555 |
$auth->assert('customer_vendor_edit'); |
|
610 |
$main::auth->assert('customer_vendor_edit'); |
|
611 |
|
|
612 |
my $form = $main::form; |
|
556 | 613 |
|
557 | 614 |
&form_header(); |
558 | 615 |
&form_footer(); |
559 | 616 |
|
560 |
$lxdebug->leave_sub(); |
|
617 |
$main::lxdebug->leave_sub();
|
|
561 | 618 |
} |
562 | 619 |
|
563 | 620 |
sub update { |
564 |
$lxdebug->enter_sub(); |
|
621 |
$main::lxdebug->enter_sub(); |
|
622 |
|
|
623 |
$main::auth->assert('customer_vendor_edit'); |
|
565 | 624 |
|
566 |
$auth->assert('customer_vendor_edit');
|
|
625 |
my $form = $main::form;
|
|
567 | 626 |
|
568 | 627 |
&display(); |
569 |
$lxdebug->leave_sub(); |
|
628 |
$main::lxdebug->leave_sub();
|
|
570 | 629 |
} |
571 | 630 |
|
572 | 631 |
sub get_contact { |
573 |
$lxdebug->enter_sub(); |
|
632 |
$main::lxdebug->enter_sub();
|
|
574 | 633 |
|
575 |
$auth->assert('customer_vendor_edit'); |
|
634 |
$main::auth->assert('customer_vendor_edit'); |
|
635 |
|
|
636 |
my $form = $main::form; |
|
637 |
my %myconfig = %main::myconfig; |
|
576 | 638 |
|
577 | 639 |
CT->get_contact(\%myconfig, \%$form); |
578 | 640 |
print $form->ajax_response_header(), join '__pjx__', map $form->{"cp_$_"}, |
579 | 641 |
qw(name title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used gender); |
580 |
$lxdebug->leave_sub(); |
|
642 |
$main::lxdebug->leave_sub();
|
|
581 | 643 |
|
582 | 644 |
} |
583 | 645 |
|
584 | 646 |
sub get_shipto { |
585 |
$lxdebug->enter_sub(); |
|
647 |
$main::lxdebug->enter_sub(); |
|
648 |
|
|
649 |
$main::auth->assert('customer_vendor_edit'); |
|
586 | 650 |
|
587 |
$auth->assert('customer_vendor_edit'); |
|
651 |
my $form = $main::form; |
|
652 |
my %myconfig = %main::myconfig; |
|
588 | 653 |
|
589 | 654 |
CT->get_shipto(\%myconfig, \%$form); |
590 | 655 |
print $form->ajax_response_header(), join '__pjx__', map $form->{"shipto$_"}, |
591 | 656 |
qw(name department_1 department_2 street zipcode city country contact phone fax email used); |
592 |
$lxdebug->leave_sub(); |
|
657 |
$main::lxdebug->leave_sub();
|
|
593 | 658 |
|
594 | 659 |
} |
595 | 660 |
|
596 | 661 |
sub get_delivery { |
597 |
$lxdebug->enter_sub(); |
|
662 |
$main::lxdebug->enter_sub();
|
|
598 | 663 |
|
599 |
$auth->assert('customer_vendor_edit'); |
|
664 |
$main::auth->assert('customer_vendor_edit'); |
|
665 |
|
|
666 |
my $form = $main::form; |
|
667 |
my %myconfig = %main::myconfig; |
|
600 | 668 |
|
601 | 669 |
CT->get_delivery(\%myconfig, \%$form ); |
602 | 670 |
$form->{IS_CUSTOMER} = $form->{db} eq 'customer'; |
603 | 671 |
|
604 | 672 |
print $form->ajax_response_header(), $form->parse_html_template('ct/get_delivery'); |
605 | 673 |
|
606 |
$lxdebug->leave_sub(); |
|
674 |
$main::lxdebug->leave_sub();
|
|
607 | 675 |
} |
608 | 676 |
|
609 | 677 |
sub delete_shipto { |
610 | 678 |
$main::lxdebug->enter_sub(); |
611 | 679 |
|
612 |
$auth->assert('customer_vendor_edit'); |
|
680 |
$main::auth->assert('customer_vendor_edit'); |
|
681 |
|
|
682 |
my $form = $main::form; |
|
683 |
my %myconfig = %main::myconfig; |
|
613 | 684 |
|
614 | 685 |
CT->get_shipto(\%myconfig, \%$form); |
615 | 686 |
|
... | ... | |
626 | 697 |
sub delete_contact { |
627 | 698 |
$main::lxdebug->enter_sub(); |
628 | 699 |
|
629 |
$auth->assert('customer_vendor_edit'); |
|
700 |
$main::auth->assert('customer_vendor_edit'); |
|
701 |
|
|
702 |
my $form = $main::form; |
|
703 |
my %myconfig = %main::myconfig; |
|
630 | 704 |
|
631 | 705 |
CT->get_contact(\%myconfig, \%$form); |
632 | 706 |
|
... | ... | |
640 | 714 |
$main::lxdebug->leave_sub(); |
641 | 715 |
} |
642 | 716 |
|
643 |
sub continue { call_sub($form->{nextsub}); } |
|
717 |
sub continue { call_sub($main::form->{nextsub}); } |
Auch abrufbar als: Unified diff
ct strict