Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e7214232

Von Moritz Bunkus vor etwa 18 Jahren hinzugefügt

  • ID e7214232350249fdab6da3445442ff85891a0d7c
  • Vorgänger d69fdcda
  • Nachfolger 1c234944

ADR entfernt (kam aus Kundenprojekt und ist nicht fuer die allgemeine Lx-Office-Variante gedacht).

Unterschiede anzeigen:

SL/AM.pm
1191 1191
  $main::lxdebug->leave_sub();
1192 1192
}
1193 1193

  
1194
sub adr {
1195
  $main::lxdebug->enter_sub();
1196

  
1197
  my ($self, $myconfig, $form) = @_;
1198

  
1199
  # connect to database
1200
  my $dbh = $form->dbconnect($myconfig);
1201

  
1202
  my $query = qq|SELECT id, adr_description, adr_code
1203
                 FROM adr
1204
		 ORDER BY adr_code|;
1205

  
1206
  $sth = $dbh->prepare($query);
1207
  $sth->execute || $form->dberror($query);
1208

  
1209
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
1210
    push @{ $form->{ALL} }, $ref;
1211
  }
1212

  
1213
  $sth->finish;
1214
  $dbh->disconnect;
1215

  
1216
  $main::lxdebug->leave_sub();
1217
}
1218

  
1219
sub get_adr {
1220
  $main::lxdebug->enter_sub();
1221

  
1222
  my ($self, $myconfig, $form) = @_;
1223

  
1224
  # connect to database
1225
  my $dbh = $form->dbconnect($myconfig);
1226

  
1227
  my $query =
1228
    qq|SELECT a.adr_description, a.adr_code
1229
                 FROM adr a
1230
	         WHERE a.id = $form->{id}|;
1231
  my $sth = $dbh->prepare($query);
1232
  $sth->execute || $form->dberror($query);
1233

  
1234
  my $ref = $sth->fetchrow_hashref(NAME_lc);
1235

  
1236
  map { $form->{$_} = $ref->{$_} } keys %$ref;
1237

  
1238
  $sth->finish;
1239

  
1240
  $dbh->disconnect;
1241

  
1242
  $main::lxdebug->leave_sub();
1243
}
1244

  
1245
sub save_adr {
1246
  $main::lxdebug->enter_sub();
1247

  
1248
  my ($self, $myconfig, $form) = @_;
1249

  
1250
  # connect to database
1251
  my $dbh = $form->dbconnect($myconfig);
1252

  
1253
  $form->{adr_description} =~ s/\'/\'\'/g;
1254
  $form->{adr_code} =~ s/\'/\'\'/g;
1255

  
1256

  
1257
  # id is the old record
1258
  if ($form->{id}) {
1259
    $query = qq|UPDATE adr SET
1260
		adr_description = '$form->{adr_description}',
1261
		adr_code = '$form->{adr_code}'
1262
		WHERE id = $form->{id}|;
1263
  } else {
1264
    $query = qq|INSERT INTO adr
1265
                (adr_description, adr_code)
1266
                VALUES ('$form->{adr_description}', '$form->{adr_code}')|;
1267
  }
1268
  $dbh->do($query) || $form->dberror($query);
1269

  
1270
  $dbh->disconnect;
1271

  
1272
  $main::lxdebug->leave_sub();
1273
}
1274

  
1275
sub delete_adr {
1276
  $main::lxdebug->enter_sub();
1277

  
1278
  my ($self, $myconfig, $form) = @_;
1279

  
1280
  # connect to database
1281
  my $dbh = $form->dbconnect($myconfig);
1282

  
1283
  $query = qq|DELETE FROM adr
1284
	      WHERE id = $form->{id}|;
1285
  $dbh->do($query) || $form->dberror($query);
1286

  
1287
  $dbh->disconnect;
1288

  
1289
  $main::lxdebug->leave_sub();
1290
}
1291

  
1292 1194
sub payment {
1293 1195
  $main::lxdebug->enter_sub();
1294 1196

  

Auch abrufbar als: Unified diff