Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e24551e6

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

  • ID e24551e62433de8d5541c315502c63b81048c23f
  • Vorgänger 5e7bb78a
  • Nachfolger 02742685

arap.pl: merge conflict hatte broken Pod hinterlassen.

Unterschiede anzeigen:

bin/mozilla/arap.pl
500 500

  
501 501
=head1 NAME
502 502

  
503
<<<<<<< HEAD:bin/mozilla/arap.pl
504
bin/mozilla/arap.pl - helper routines for invoiceing frontend.
505

  
506
=head1 SYNOPSIS
507

  
508
nothing yet
509

  
510
=head1 DESCRIPTION
511

  
512
nothing yet
513
=======
514 503
arap.pl - helper functions or customer/vendor retrieval
515 504

  
516 505
=head1 SYNOPSIS
......
523 512
Don't use anyting in this file without extreme care, and even then be prepared for massive headaches.
524 513

  
525 514
It's a collection of helper routines that wrap the customer/vendor dropdown/textfield duality into something even complexer.
526
>>>>>>> 88f5a78... check_name erweitert um ein no_select flag. siehe perldoc bin/mozilla/arap.pl:bin/mozilla/arap.pl
527 515

  
528 516
=head1 FUNCTIONS
529 517

  
530 518
=head2 check_name customer|vendor
531 519

  
532
<<<<<<< HEAD:bin/mozilla/arap.pl
533 520
check_name was originally meant to update the selected customer or vendor. The
534 521
way it does that has generted more hate than almost any other part of this
535 522
software.
......
538 525

  
539 526
=over 4
540 527

  
541
=item
528
=item *
542 529

  
543 530
It checks if a vendor or customer is given. No failsafe, vendor fallback if
544 531
$_[0] is something fancy.
545 532

  
546
=item
533
=item *
547 534

  
548 535
It assumes, that there is a field named customer or vendor in $form.
549 536

  
550
=item
537
=item *
551 538

  
552 539
It assumes, that this field is filled with name--id, and tries to split that.
553 540
sql ledger uses that combination to get ids into the select keys.
554 541

  
555
=item
542
=item *
556 543

  
557 544
It looks for a field selectcustomer or selectvendor in $form. sql ledger used
558 545
to store a copy of the html select in there. (again, don't ask)
559 546

  
560
=item
547
=item *
561 548

  
562 549
If this field exists, it looks for a field called oldcustomer or oldvendor, in
563 550
which the old name--id string was stored in sql ledger, and compares those.
564 551

  
565
=item
552
=item *
566 553

  
567 554
if they don't match, it will set customer_id or vendor_id in $form, load the
568 555
entry (which will clobber everything in $form named like a column in customer
569 556
oder vendor) and return.
570 557

  
571
=item
558
=item *
572 559

  
573 560
If there was no select* entry, it assumes that vclimit was lower than the
574 561
number of entries, and that an input field was generated. In that case the
575 562
splitting is omitted (since users don't generally include ids in entered names)
576 563

  
577
=item
564
=item *
578 565

  
579 566
It looks for a *_id field, and combines it with the given input into a name--id
580 567
entry and compares it to the old* entry. (Missing any of these will instantly
581 568
break check_namea.
582 569

  
583
=item
570
=item *
584 571

  
585 572
If those do not match, $form->get_name is called to get matching results.
586 573
get_name only matches by *number and name, not by id, don't try to get it to do
587 574
so.
588 575

  
589
=item
576
=item *
590 577

  
591 578
The results are stored in $form>{name_list} but a count is returned, and
592 579
checked.
593 580

  
594
=item
581
=item *
595 582

  
596 583
If only one result was found, *_id, * and old* are copied into $form, the entry
597 584
is loaded (like above, clobbering)
598 585

  
599
=item
586
=item *
600 587

  
601 588
If there is more than one, a selection dialog is rendered
602 589

  
603
=item
590
=item *
604 591

  
605 592
If none is found, an error is generated.
606 593

  
......
616 603

  
617 604
Since get_customer and get_vendor clobber a lot of fields, make sure what
618 605
changes exactly.
619
=======
620
This function will take the contents of $form->{vendor} or $form->{customer}, try to guess if there was a selectbox or not, and search for matching customer/vendors.
621 606

  
622
This mostly works great, except for the case when there is more than one match.
623
In that case check_name will display a select form, that will redirect to the
624
original C<nextsub>. Unfortunately any hidden vars or input fields will be lost
625
in the process unless saved before in a callback.
607
=head3 select- version works fine, but things go awry when I use a textbox, any idea?
608

  
609
If there is more than one match, check_name will display a select form, that
610
will redirect to the original C<nextsub>. Unfortunately any hidden vars or
611
input fields will be lost in the process unless saved before in a callback.
626 612

  
627 613
If you still want to use it, you can disable this feature, like this:
628 614

  
......
630 616

  
631 617
In that case multiple matches will trigger an error.
632 618

  
633
=head1 BUGS
634

  
635
=head1 AUTHOR
636
>>>>>>> 88f5a78... check_name erweitert um ein no_select flag. siehe perldoc bin/mozilla/arap.pl:bin/mozilla/arap.pl
619
Otherwise you'll have to care to include a complete state in callback.
637 620

  
638 621
=cut

Auch abrufbar als: Unified diff