X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=sql%2FPg-upgrade2%2Finvoice_positions.pl;h=fea63da26e8d6a500d06e9a036dfc58d80bb52c5;hb=958b82d600cebec78ff208257b1fd348ee0439bf;hp=18ea9e9bcc604835d91242a8b5315deedbafe472;hpb=2a1e80a83b3c03fa6bd6b6103883b040f92ff382;p=kivitendo-erp.git diff --git a/sql/Pg-upgrade2/invoice_positions.pl b/sql/Pg-upgrade2/invoice_positions.pl index 18ea9e9bc..fea63da26 100644 --- a/sql/Pg-upgrade2/invoice_positions.pl +++ b/sql/Pg-upgrade2/invoice_positions.pl @@ -1,7 +1,6 @@ # @tag: invoice_positions # @description: Spalte für Positionen der Einträge in Rechnungen # @depends: release_3_1_0 -# @encoding: utf-8 package SL::DBUpgrade2::invoice_positions; use strict; @@ -17,11 +16,13 @@ sub run { $query = qq|SELECT * FROM invoice ORDER BY trans_id, id|; + my $query2 = qq|UPDATE invoice SET position = ? WHERE id = ?|; my $sth = $self->dbh->prepare($query); + my $sth2 = $self->dbh->prepare($query2); $sth->execute || $::form->dberror($query); - # set new posittion field in order of ids, starting by one for each invoice + # set new position field in order of ids, starting by one for each invoice my $last_invoice_id; my $position; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { @@ -32,10 +33,10 @@ sub run { } $last_invoice_id = $ref->{trans_id}; - $query = qq|UPDATE invoice SET position = ? WHERE id = ?|; - $self->db_query($query, bind => [ $position, $ref->{id} ]); + $sth2->execute($position, $ref->{id}); } $sth->finish; + $sth2->finish; $query = qq|ALTER TABLE invoice ALTER COLUMN position SET NOT NULL|; $self->db_query($query);