Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a3f90d6f

Von Sven Schöling vor etwa 14 Jahren hinzugefügt

  • ID a3f90d6fa23d0a8d026682511e7624bd847d532f
  • Vorgänger 48c946bd
  • Nachfolger 6326597d

Druckeradministration in die Adminumgebung verschoben.

Printercommands werden mit webuser Rechnten ausgeführt, deshalb darf ein User
keine anlegen. Da die Umgebung da völlig anders ist, geht das mit einem Rewrite
der Masken einher.

Unterschiede anzeigen:

SL/AM.pm
1108 1108
  $main::lxdebug->leave_sub();
1109 1109
}
1110 1110

  
1111
sub printer {
1112
  $main::lxdebug->enter_sub();
1113

  
1114
  my ($self, $myconfig, $form) = @_;
1115

  
1116
  # connect to database
1117
  my $dbh = $form->dbconnect($myconfig);
1118

  
1119
  my $query = qq|SELECT id, printer_description, template_code, printer_command
1120
                 FROM printers
1121
                 ORDER BY 2|;
1122

  
1123
  my $sth = $dbh->prepare($query);
1124
  $sth->execute || $form->dberror($query);
1125

  
1126
  $form->{"ALL"} = [];
1127
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
1128
    push @{ $form->{ALL} }, $ref;
1129
  }
1130

  
1131
  $sth->finish;
1132
  $dbh->disconnect;
1133

  
1134
  $main::lxdebug->leave_sub();
1135
}
1136

  
1137
sub get_printer {
1138
  $main::lxdebug->enter_sub();
1139

  
1140
  my ($self, $myconfig, $form) = @_;
1141

  
1142
  # connect to database
1143
  my $dbh = $form->dbconnect($myconfig);
1144

  
1145
  my $query =
1146
    qq|SELECT p.printer_description, p.template_code, p.printer_command
1147
       FROM printers p
1148
       WHERE p.id = ?|;
1149
  my $sth = $dbh->prepare($query);
1150
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
1151

  
1152
  my $ref = $sth->fetchrow_hashref("NAME_lc");
1153

  
1154
  map { $form->{$_} = $ref->{$_} } keys %$ref;
1155

  
1156
  $sth->finish;
1157

  
1158
  $dbh->disconnect;
1159

  
1160
  $main::lxdebug->leave_sub();
1161
}
1162

  
1163
sub save_printer {
1164
  $main::lxdebug->enter_sub();
1165

  
1166
  my ($self, $myconfig, $form) = @_;
1167
  my $query;
1168

  
1169
  # connect to database
1170
  my $dbh = $form->dbconnect($myconfig);
1171

  
1172
  my @values = ($form->{printer_description},
1173
                $form->{template_code},
1174
                $form->{printer_command});
1175

  
1176
  # id is the old record
1177
  if ($form->{id}) {
1178
    $query = qq|UPDATE printers SET
1179
                printer_description = ?, template_code = ?, printer_command = ?
1180
                WHERE id = ?|;
1181
    push(@values, $form->{id});
1182
  } else {
1183
    $query = qq|INSERT INTO printers
1184
                (printer_description, template_code, printer_command)
1185
                VALUES (?, ?, ?)|;
1186
  }
1187
  do_query($form, $dbh, $query, @values);
1188

  
1189
  $dbh->disconnect;
1190

  
1191
  $main::lxdebug->leave_sub();
1192
}
1193

  
1194
sub delete_printer {
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|DELETE FROM printers
1203
              WHERE id = ?|;
1204
  do_query($form, $dbh, $query, $form->{id});
1205

  
1206
  $dbh->disconnect;
1207

  
1208
  $main::lxdebug->leave_sub();
1209
}
1210

  
1211 1111
sub payment {
1212 1112
  $main::lxdebug->enter_sub();
1213 1113

  

Auch abrufbar als: Unified diff