Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c25ec982

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID c25ec982475d592b32ead637a19338a598d9faeb
  • Vorgänger d331a3d7
  • Nachfolger 4088f2a9

Verletzung von NOT NULL Constraints

Bei Zahlungen gab es noch ein paar Probleme durch NOT-NULL-Constraints.

Behebt Bug #2228.

Unterschiede anzeigen:

SL/CP.pm
269 269

  
270 270
      # add AR/AP
271 271
      $query =
272
        qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | .
273
        qq|VALUES (?, ?, ?, ?)|;
272
        qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, chart_link, taxkey, tax_id) | .
273
        qq|VALUES (?, ?, ?, ?, (SELECT link FROM chart WHERE id=?), 0, (SELECT id FROM tax WHERE taxkey=0 LIMIT 1))|;
274 274
      do_query($form, $dbh, $query, $form->{"id_$i"}, $id,
275
               conv_date($form->{datepaid}), $amount * $ml);
275
               conv_date($form->{datepaid}), $amount * $ml, $id);
276 276

  
277 277
      # add payment
278 278
      $query =
279 279
        qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, | .
280
        qq|                       source, memo) | .
281
        qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
280
        qq|                       source, memo, chart_link, taxkey, tax_id) | .
281
        qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, (SELECT link FROM chart WHERE accno=?), 0, (SELECT id FROM tax WHERE taxkey=0 LIMIT 1))|;
282 282
      my @values = (conv_i($form->{"id_$i"}), $paymentaccno,
283 283
                    conv_date($form->{datepaid}),
284 284
                    $form->{"paid_$i"} * $ml * -1, $form->{source},
285
                    $form->{memo});
285
                    $form->{memo}, $paymentaccno);
286 286
      do_query($form, $dbh, $query, @values);
287 287

  
288 288
      # add exchangerate difference if currency ne defaultcurrency
......
293 293
        # exchangerate difference
294 294
        $query =
295 295
          qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, | .
296
          qq|                       cleared, fx_transaction) | .
297
          qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
296
          qq|                       cleared, fx_transaction, chart_link, taxkey, tax_id) | .
297
          qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, (SELECT link FROM chart WHERE accno = ?), 0, (SELECT id FROM tax WHERE taxkey=0 LIMIT 1))|;
298 298
        @values = (conv_i($form->{"id_$i"}), $paymentaccno,
299 299
                   conv_date($form->{datepaid}), ($amount * $ml * -1), '0',
300
                   '1');
300
                   '1', $paymentaccno);
301 301
        do_query($form, $dbh, $query, @values);
302 302

  
303 303
        # gain/loss
......
309 309
          my $accno_id = ($amount < 0) ? $fxgain_accno_id : $fxloss_accno_id;
310 310
          $query =
311 311
            qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, | .
312
            qq|                       amount, cleared, fx_transaction) | .
313
            qq|VALUES (?, ?, ?, ?, ?, ?)|;
312
            qq|                       amount, cleared, fx_transaction, chart_link, taxkey, tax_id) | .
313
            qq|VALUES (?, ?, ?, ?, ?, ?, (SELECT link FROM chart WHERE id=?), 0, (SELECT id FROM tax WHERE taxkey=0 LIMIT 1))|;
314 314
          @values = (conv_i($form->{"id_$i"}), $accno_id,
315 315
                     conv_date($form->{datepaid}), $amount * $ml * -1, '0',
316
                     '1');
316
                     '1', $accno_id);
317 317
          do_query($form, $dbh, $query, @values);
318 318
        }
319 319
      }

Auch abrufbar als: Unified diff