Browse Source

Now deletes old logbooks

master
CT1DRB 15 years ago
parent
commit
e7e79b0652
  1. 19
      yfk
  2. 35
      yfksubs.pl

19
yfk

@ -1438,7 +1438,7 @@ while ($status == 10) {
addstr($whelp, 0,0, 'Chose one of the logs or create/delete a new one ..'.' 'x50);
erase($wmain);
addstr($wmain,0,0, ' 'x(80*22)); # blue background
addstr($wmain, 2,18, 'Select an existing logbook or create a new log!');
addstr($wmain, 2,7, 'Select an existing logbook or create a new log or destroy an old one!');
refresh($wmain);
refresh($whead);
refresh($whelp);
@ -1485,16 +1485,13 @@ while ($status == 10) {
elsif ($choice == 1) { # second item -> delete old log
curs_set(1); # cursor visible
# Ask for the name to delete.
# my $old = &askbox(10, 15, 4, 50, '[a-zA-Z0-9/]',
# "Enter a name (callsign) to delete:", '');
# curs_set(0); # cursr invisible
# my $msg = &oldlogtable($old);
# addstr($wmain, 15, (40-(length($msg." ($old)")/2)), $msg." ($old)");
# if ($msg =~ /successfully/) { # new call OK
# $mycall = "\L$new"; # take it as MYCALL
# $mycall =~ s/\//_/g; # / -> _
# &changemycall($mycall); # change $mycall also in yfksubs.pl
# }
my $old = &askbox(10, 15, 4, 50, '[a-zA-Z0-9/]',
"Enter a name (callsign) to delete:", '');
curs_set(0); # cursr invisible
my $msg = &oldlogtable($old);
addstr($wmain, 15, (40-(length($msg." ($old)")/2)), $msg." ($old)");
if ($msg =~ /successfully/) { # delete succefull
}
refresh($wmain);
getch();
}

35
yfksubs.pl

@ -30,7 +30,7 @@ require Exporter;
lastqsos callinfo getdate gettime splashscreen choseqso getqso chosepqso
entrymask fkeyline winfomask selectlist askbox toggleqsl onlinelog
preparelabels labeltex emptyqslqueue adifexport ftpupload adifimport getlogs
changemycall newlogtable choseeditqso geteditqso editw updateqso checkdate
changemycall newlogtable oldlogtable choseeditqso geteditqso editw updateqso checkdate
awards statistics qslstatistics editdb editdbw savedbedit lotwimport
databaseupgrade xplanet queryrig tableexists changeconfig readsubconfig
connectdb connectrig jumpfield receive_qso);
@ -3661,40 +3661,41 @@ sub newlogtable {
##############################################################################
sub oldlogtable {
my $call = $_[0]; # callsign of the new database
my $call = $_[0]; # callsign to delete
my $filename = "$prefix/share/yfklog/db_log.sql";
if ($db eq 'sqlite') {
$filename = "$prefix/share/yfklog/db_log.sqlite";
}
# open DB, $filename; # database definition in this file
# my @db = <DB>; # read database def. into @db
open DB, $filename; # database definition in this file
my @db = <DB>; # read database def. into @db
# We assume that the callsign in $_[0] is valid, because the &askbox()
# which produced it only accepted valid callsign-letters.
# only exception: empty callsign!
# if ($call eq '') {
# return "**** Invalid callsign! ****";
# }
if ($call eq '') {
return "**** Invalid callsign! ****";
}
# $call =~ tr/\//_/; # convert "/" to "_"
# $call =~ tr/[A-Z]/[a-z]/; # make call lowercase
$call =~ tr/\//_/; # convert "/" to "_"
$call =~ tr/[A-Z]/[a-z]/; # make call lowercase
# Now check if there is also a table existing with the same name
# if (&tableexists("log_$call")) { # If logbook does not yet exist, create it
# my $db = "@db";
if (&tableexists("log_$call")) { # If logbook does exist, delete it
my $db = "@db";
# $db =~ s/MYCALL/$call/g;# replace the callsign placeholder
# $dbh->delete($db); # create it!
# return "Logbook successfully erased!";
# }
# else { # log already existed
# return "Logbook with same name already exists!";
# }
$dbh->do("DROP table 'log_$call'"); # erase it!
return "Logbook successfully erased!";
}
else { # log already existed
return "No logbook for this call!";
}
} # oldlogtable
##############################################################################
# choseeditqso - Choses a QSO in the Edit & Search Mode which has to be
# edited. It gets references to the @qso-array with the search criteria, and

Loading…
Cancel
Save