Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ad4cb09d

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

Dokumentation und Hinweise zur check_name, nachdem ich zum x-ten Male wieder selber drauf reingefallen bin...

Unterschiede anzeigen:

bin/mozilla/arap.pl
486 486

  
487 487
sub continue       { call_sub($main::form->{"nextsub"}); }
488 488

  
489

  
490
1;
491

  
492
__END__
493

  
494
=head1 NAME
495

  
496
bin/mozilla/arap.pl - helper routines for invoiceing frontend.
497

  
498
=head1 SYNOPSIS
499

  
500
nothing yet
501

  
502
=head1 DESCRIPTION
503

  
504
nothing yet
505

  
506
=head1 FUNCTIONS
507

  
508
=head2 check_name customer|vendor
509

  
510
check_name was originally meant to update the selected customer or vendor. The
511
way it does that has generted more hate than almost any other part of this
512
software.
513

  
514
What it does is:
515

  
516
=over 4
517

  
518
=item
519

  
520
It checks if a vendor or customer is given. No failsafe, vendor fallback if
521
$_[0] is something fancy.
522

  
523
=item
524

  
525
It assumes, that there is a field named customer or vendor in $form.
526

  
527
=item
528

  
529
It assumes, that this field is filled with name--id, and tries to split that.
530
sql ledger uses that combination to get ids into the select keys.
531

  
532
=item
533

  
534
It looks for a field selectcustomer or selectvendor in $form. sql ledger used
535
to store a copy of the html select in there. (again, don't ask)
536

  
537
=item
538

  
539
If this field exists, it looks for a field called oldcustomer or oldvendor, in
540
which the old name--id string was stored in sql ledger, and compares those.
541

  
542
=item
543

  
544
if they don't match, it will set customer_id or vendor_id in $form, load the
545
entry (which will clobber everything in $form named like a column in customer
546
oder vendor) and return.
547

  
548
=item
549

  
550
If there was no select* entry, it assumes that vclimit was lower than the
551
number of entries, and that an input field was generated. In that case the
552
splitting is omitted (since users don't generally include ids in entered names)
553

  
554
=item
555

  
556
It looks for a *_id field, and combines it with the given input into a name--id
557
entry and compares it to the old* entry. (Missing any of these will instantly
558
break check_namea.
559

  
560
=item
561

  
562
If those do not match, $form->get_name is called to get matching results.
563
get_name only matches by *number and name, not by id, don't try to get it to do
564
so.
565

  
566
=item
567

  
568
The results are stored in $form>{name_list} but a count is returned, and
569
checked.
570

  
571
=item
572

  
573
If only one result was found, *_id, * and old* are copied into $form, the entry
574
is loaded (like above, clobbering)
575

  
576
=item
577

  
578
If there is more than one, a selection dialog is rendered
579

  
580
=item
581

  
582
If none is found, an error is generated.
583

  
584
=back
585

  
586
=head3 I built a customer/vendor box somewhere and it doesn't work, what's wrong?
587

  
588
Make sure a select* field is given if and only if you render a select box. The
589
actual contents are ignored, but recognition fails if not present.
590

  
591
Make sure old* and *_id fields are set correctly (name--id form for old*). They
592
are necessary in all steps and branches.
593

  
594
Since get_customer and get_vendor clobber a lot of fields, make sure what
595
changes exactly.
596

  
597
=cut

Auch abrufbar als: Unified diff