- # if we switched to all_vc
- # funktioniert derzeit nicht 12.10.2010 jb
- if ($form->{all_vc} ne $form->{oldall_vc}) {
-
- $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1;
-
- $form->{"select$form->{vc}"} = "";
-
- if ($form->{all_vc}) {
- $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
-
- if ($form->{"all_$form->{vc}"}) {
- map {
- $form->{"select$form->{vc}"} .=
- "<option>$_->{name}--$_->{id}\n"
- } @{ $form->{"all_$form->{vc}"} };
- }
- } else { # ab hier wieder ausgeführter code (s.o.):
- CP->get_openvc(\%myconfig, \%$form);
-
- if ($form->{"all_$form->{vc}"}) {
- $newvc =
- qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
- map {
- $form->{"select$form->{vc}"} .=
- "<option>$_->{name}--$_->{id}\n"
- } @{ $form->{"all_$form->{vc}"} };
- }
-
- # if the name is not the same
- if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
- $form->{ $form->{vc} } = $newvc;
- }
- }
- }
-
- # search by customernumber
- # the customernumber has to be correct otherwise nothing is found
- if ($form->{vc} eq 'customer' and $form->{customernumber} and $form->{ARAP} eq 'AR') {
- $form->{open} ='Y'; # only open invoices
- # ar_transactions automatically searches by $form->{customer_id} or else
- # $form->{customer} if available, and these variables will always be set
- # so we have to empty these values first
- $form->{customer_id} = '';
- $form->{customer} = '';
- AR->ar_transactions(\%myconfig, \%$form);
-
- # Here we just take the first returned value even if the custumernumber
- # may not be unique
- $form->{customer} = $form->{AR}[0]{name};
- $form->{customer_id} = $form->{AR}[0]{customer_id};
- }
-
- # search by invoicenumber,
- if ($form->{invnumber}) {