Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 74b9dd67

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

  • ID 74b9dd679e1c5d10ad19e79e1bbed1c3651d6af8
  • Vorgänger dcf6e20c
  • Nachfolger 1889a90c

Nicht für jede Aktion an Rechnungen ein neues Datenbank Handle aufmachen.

Unterschiede anzeigen:

SL/IS.pm
59 59
  $form->{duedate} ||= $form->{invdate};
60 60

  
61 61
  # connect to database
62
  my $dbh = $form->dbconnect($myconfig);
62
  my $dbh = $form->get_standard_dbh;
63 63
  my $sth;
64 64

  
65 65
  my $query = qq|SELECT date | . conv_dateq($form->{duedate}) . qq| - date | . conv_dateq($form->{invdate}) . qq| AS terms|;
......
409 409

  
410 410
  $form->{username} = $myconfig->{name};
411 411

  
412
  $dbh->disconnect;
413

  
414 412
  $main::lxdebug->leave_sub();
415 413
}
416 414

  
......
434 432
  my ($self, $myconfig, $form, @wanted_vars) = @_;
435 433

  
436 434
  # connect to database
437
  my $dbh = $form->dbconnect($myconfig);
435
  my $dbh = $form->get_standard_dbh;
438 436

  
439 437
  my $language_id = $form->{language_id};
440 438

  
......
505 503
                                                  'allow_fallback'   => 1);
506 504

  
507 505

  
508
  $dbh->disconnect;
509

  
510 506
  $main::lxdebug->leave_sub();
511 507
}
512 508

  
......
1134 1130
  my ($self, $myconfig, $form, $locale) = @_;
1135 1131

  
1136 1132
  # connect to database, turn off autocommit
1137
  my $dbh = $form->dbconnect_noauto($myconfig);
1133
  my $dbh = $form->get_standard_dbh;
1134
  $dbh->begin_work;
1138 1135

  
1139 1136
  my (%payments, $old_form, $row, $item, $query, %keep_vars);
1140 1137

  
......
1189 1186
  restore_form($old_form);
1190 1187

  
1191 1188
  my $rc = $dbh->commit();
1192
  $dbh->disconnect();
1193 1189

  
1194 1190
  $main::lxdebug->leave_sub();
1195 1191

  
......
1369 1365
  my ($self, $myconfig, $form) = @_;
1370 1366

  
1371 1367
  # connect to database
1372
  my $dbh = $form->dbconnect_noauto($myconfig);
1368
  my $dbh = $form->get_standard_dbh;
1369
  $dbh->begin_work;
1373 1370

  
1374 1371
  &reverse_invoice($dbh, $form);
1375 1372

  
......
1399 1396
  do_query($form, $dbh, qq|DELETE FROM status WHERE trans_id = ?|, @values);
1400 1397

  
1401 1398
  my $rc = $dbh->commit;
1402
  $dbh->disconnect;
1403 1399

  
1404 1400
  if ($rc) {
1405 1401
    my $spool = $::lx_office_conf{paths}->{spool};
......
1749 1745
  my ($self, $myconfig, $form) = @_;
1750 1746

  
1751 1747
  # connect to database
1752
  my $dbh = $form->dbconnect($myconfig);
1748
  my $dbh = $form->get_standard_dbh;
1753 1749

  
1754 1750
  my $i = $form->{rowcount};
1755 1751

  
......
1960 1956
    map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
1961 1957
  }
1962 1958

  
1963
  $dbh->disconnect;
1964

  
1965 1959
  $main::lxdebug->leave_sub();
1966 1960
}
1967 1961

  
......
1977 1971

  
1978 1972
  my ($self, $myconfig, $form) = @_;
1979 1973

  
1980
  my $dbh = $form->dbconnect($myconfig);
1974
  my $dbh = $form->get_standard_dbh;
1981 1975

  
1982 1976
  $form->{"PRICES"} = {};
1983 1977

  
......
2125 2119
            $pkr->{selected}  = ' selected';
2126 2120
          }
2127 2121
        } elsif ( ($form->parse_amount($myconfig, $price_new)
2128
                 != $form->parse_amount($myconfig, $form->{"sellprice_$i"})) 
2122
                 != $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
2129 2123
                  and ($price_new ne 0) and defined $price_new) {
2130 2124
          # sellprice has changed
2131 2125
          # when loading existing invoices $price_new is NULL
......
2153 2147
    $pkq->finish;
2154 2148
  }
2155 2149

  
2156
  $dbh->disconnect;
2157

  
2158 2150
  $main::lxdebug->leave_sub();
2159 2151
}
2160 2152

  
......
2169 2161
  # ToDO: die when this happens and throw an error
2170 2162
  $main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
2171 2163

  
2172
  my $dbh = $form->dbconnect($myconfig);
2164
  my $dbh = $form->get_standard_dbh;
2173 2165

  
2174 2166
  my $query = qq|SELECT storno FROM $table WHERE storno_id = ?|;
2175 2167
  my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
2176 2168

  
2177
  $dbh->disconnect();
2178

  
2179 2169
  $main::lxdebug->leave_sub();
2180 2170

  
2181 2171
  return $result;
......
2192 2182
  # ToDO: die when this happens and throw an error
2193 2183
  $main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
2194 2184

  
2195
  my $dbh = $form->dbconnect($myconfig);
2185
  my $dbh = $form->get_standard_dbh;
2196 2186

  
2197 2187
  my $query = qq|SELECT storno FROM $table WHERE id = ?|;
2198 2188
  my ($result) = selectrow_query($form, $dbh, $query, $id);
2199 2189

  
2200
  $dbh->disconnect();
2201

  
2202 2190
  $main::lxdebug->leave_sub();
2203 2191

  
2204 2192
  return $result;
......
2209 2197

  
2210 2198
  my ($self, $myconfig, $form) = @_;
2211 2199

  
2212
  my $dbh = $form->dbconnect($myconfig);
2200
  my $dbh = $form->get_standard_dbh;
2213 2201

  
2214 2202
  my $query = qq| SELECT accno FROM chart WHERE id = (SELECT ar_paid_accno_id FROM defaults)|;
2215 2203
  my ($result) = selectrow_query($form, $dbh, $query);
2216 2204

  
2217
  $dbh->disconnect();
2218

  
2219 2205
  $main::lxdebug->leave_sub();
2220 2206

  
2221 2207
  return $result;

Auch abrufbar als: Unified diff