Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 79b83b02

Von Bernd Blessmann vor mehr als 13 Jahren hinzugefügt

  • ID 79b83b02cf67cf4b701eb1654fa274095d84745a
  • Vorgänger 9a3d356c
  • Nachfolger 2b7a7e40

Zahlungen bei Kreditorenbuchungen nur am selben Tag löschbar machen.

Siehe auch Bug 1640. Ändert zwar nichts am Bug, steht da aber als
Anregung drin.

Unterschiede anzeigen:

SL/AP.pm
288 288
      $form->{payables} = $amount;
289 289

  
290 290
      # add payment
291
      my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->{"gldate"});
291 292
      $query =
292
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, project_id, taxkey) | .
293
        qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, | .
293
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey) | .
294
        qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, | .
294 295
        qq|        (SELECT taxkey_id FROM chart WHERE accno = ?))|;
295 296
      @values = ($form->{id}, $form->{"AP_paid_account_$i"}, $form->{"paid_$i"},
296
                 conv_date($form->{"datepaid_$i"}), $form->{"source_$i"},
297
                 conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"},
297 298
                 $form->{"memo_$i"}, $project_id, $form->{"AP_paid_account_$i"});
298 299
      do_query($form, $dbh, $query, @values);
299 300

  
......
568 569
  $self->_delete_payments($form, $dbh);
569 570

  
570 571
  # Save the new payments the user made before cleaning up $form.
571
  my $payments_re = '^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AP_paid_\d+$|^paidaccounts$';
572
  my $payments_re = '^datepaid_\d+$|^gldate_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AP_paid_\d+$|^paidaccounts$';
572 573
  map { $payments{$_} = $form->{$_} } grep m/$payments_re/, keys %{ $form };
573 574

  
574 575
  # Clean up $form so that old content won't tamper the results.
......
649 650
        $form->{"AP_paid_$j"}         = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
650 651
        $form->{"paid_$j"}            = $form->{acc_trans}{$key}->[$i - 1]->{amount};
651 652
        $form->{"datepaid_$j"}        = $form->{acc_trans}{$key}->[$i - 1]->{transdate};
653
        $form->{"gldate_$j"}          = $form->{acc_trans}{$key}->[$i - 1]->{gldate};
652 654
        $form->{"source_$j"}          = $form->{acc_trans}{$key}->[$i - 1]->{source};
653 655
        $form->{"memo_$j"}            = $form->{acc_trans}{$key}->[$i - 1]->{memo};
654 656

  
SL/Form.pm
2986 2986
    $query =
2987 2987
      qq|SELECT
2988 2988
           c.accno, c.description,
2989
           a.source, a.amount, a.memo, a.transdate, a.cleared, a.project_id, a.taxkey,
2989
           a.source, a.amount, a.memo, a.transdate, a.gldate, a.cleared, a.project_id, a.taxkey,
2990 2990
           p.projectnumber,
2991 2991
           t.rate, t.id
2992 2992
         FROM acc_trans a
bin/mozilla/ap.pl
692 692
      $form->{"exchangerate_$i"} = "";
693 693
    }
694 694

  
695
    print qq|<input type=hidden name="gldate_$i" value=$form->{"gldate_$i"}>\n|;
696
    my $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"});
697
    $form->{"payment_readonly_$i"} = ($changeable)? 0 : 1;
698
    print qq|<input type=hidden name="payment_readonly_$i" value=$form->{"payment_readonly_$i"}>\n|;
699

  
695 700
    $exchangerate = qq|&nbsp;|;
696 701
    if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
697 702
      if ($form->{"forex_$i"}) {
698 703
        $exchangerate =
699 704
          qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
700 705
      } else {
701
        $exchangerate =
702
          qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
706
        if ($changeable) {
707
          $exchangerate =
708
            qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
709
        } else {
710
          $exchangerate = qq|$form->{"exchangerate_$i"}|.
711
            qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
712
        }
703 713
      }
704 714
    }
705 715

  
......
707 717
<input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
708 718
|;
709 719

  
710
    $column_data{"paid_$i"} =
711
      qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
712
    $column_data{"AP_paid_$i"} =
713
      qq|<td align=center>${selectAP_paid}</td>|;
714
    $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
715
    $column_data{"datepaid_$i"}     =
716
      qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
720
    my $datepaid;
721
    if ($changeable) {
722
      $datepaid = qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
717 723
         <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="| . $locale->text('Details (one letter abbreviation)') . qq|"></td>|;
718
    $column_data{"source_$i"} =
719
      qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
720
    $column_data{"memo_$i"} =
721
      qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
722
    $column_data{"paid_project_id_$i"} =
724
    } else {
725
      $datepaid = qq|<td align=center>$form->{"datepaid_$i"}</td>|.
726
        qq|<input type=hidden name="datepaid_$i" value=$form->{"datepaid_$i"}>|;
727
    }
728

  
729
    my $paid;
730
    if ($changeable) {
731
      $paid = qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
732
    } else {
733
      $paid = qq|<td align=center>$form->{"paid_$i"}</td>|.
734
        qq|<input type=hidden name="paid_$i" value=$form->{"paid_$i"}>|;
735
    }
736

  
737
    my $source;
738
    if ($changeable) {
739
      $source = qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
740
    } else {
741
      $source = qq|<td align=center>$form->{"source_$i"}</td>|.
742
        qq|<input type=hidden name="source_$i" value=$form->{"source_$i"}>|;
743
    }
744

  
745
    my $memo;
746
    if ($changeable) {
747
      $memo = qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
748
    } else {
749
      $memo = qq|<td align=center>$form->{"memo_$i"}</td>|.
750
        qq|<input type=hidden name="memo_$i" value=$form->{"memo_$i"}>|;
751
    }
752

  
753
    my $AP_paid;
754
    if ($changeable) {
755
      $AP_paid = qq|<td align=center>${selectAP_paid}</td>|;
756
    } else {
757
      $AP_paid = qq|<td align=center>$form->{"AP_paid_$i"}</td>|.
758
        qq|<input type=hidden name="AP_paid_$i" value=$form->{"AP_paid_$i"}>|;
759
    }
760

  
761
    my $paid_project_id;
762
    if ($changeable) {
763
      $paid_project_id =
723 764
      qq|<td>|
724 765
      . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
725 766
                             '-values' => \@project_values,
726 767
                             '-labels' => \%project_labels,
727 768
                             '-default' => $form->{"paid_project_id_$i"} ))
728 769
      . qq|</td>|;
770
    } else {
771
      my $projectnumber = $project_labels{$form->{"paid_project_id_$i"}};
772
      $paid_project_id = qq|<td>$projectnumber</td>|.
773
        qq|<input type=hidden name="paid_project_id_$i" value=$form->{"paid_project_id_$i"}>|;
774
    }
775

  
776
    $column_data{"paid_$i"} = $paid;
777
    $column_data{"AP_paid_$i"} = $AP_paid;
778
    $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
779
    $column_data{"datepaid_$i"}  = $datepaid;
780
    $column_data{"source_$i"} = $source;
781
    $column_data{"memo_$i"} = $memo;
782
    $column_data{"paid_project_id_$i"} = $paid_project_id;
729 783

  
730 784
    map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
731 785

  
732 786
    print "
733 787
        </tr>
734 788
";
735
    push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
789
    if ($changeable) {
790
      push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
791
    }
736 792
  }
737 793

  
738 794
  my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
......
1126 1182

  
1127 1183
  $main::auth->assert('general_ledger');
1128 1184

  
1129
  map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
1185
  map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
1130 1186
  $form->{paidaccounts} = 1;
1131 1187
  $form->{rowcount}--;
1132 1188
  $form->{invdate} = $form->current_date(\%myconfig);

Auch abrufbar als: Unified diff