up
This commit is contained in:
+13
-12
@@ -34,6 +34,10 @@ const (
|
||||
keyQSLAutoSend = "qsl.auto_send" // "1" → render+send an eQSL on log when an e-mail and default template exist
|
||||
)
|
||||
|
||||
// appQSLCardSentField is the ADIF APP_ field stamping when OpsLog e-mailed its
|
||||
// own QSL card. Deliberately NOT eqsl_sent (that's eQSL.cc's, kept independent).
|
||||
const appQSLCardSentField = "APP_OPSLOG_QSL_SENT"
|
||||
|
||||
const (
|
||||
defaultQSLEmailSubject = "eQSL — {CALL} de {MYCALL}"
|
||||
defaultQSLEmailBody = "Hi,\n\nThank you for our QSO! Please find attached your eQSL card.\n\n{DATE} · {BAND} · {MODE}\n\n73,\n{MYCALL}"
|
||||
@@ -74,7 +78,7 @@ type QSLPresetInfo struct {
|
||||
// so picking through the native dialog is the reliable route to real paths).
|
||||
func (a *App) QSLPickPhotos() ([]string, error) {
|
||||
return wruntime.OpenMultipleFilesDialog(a.ctx, wruntime.OpenDialogOptions{
|
||||
Title: "Choose card photos (1–3)",
|
||||
Title: "Choose card photos (1–5)",
|
||||
Filters: []wruntime.FileFilter{
|
||||
{DisplayName: "Photos (*.jpg;*.jpeg;*.png)", Pattern: "*.jpg;*.jpeg;*.png"},
|
||||
},
|
||||
@@ -87,8 +91,8 @@ func (a *App) QSLGenerateProposals(photoPaths []string) ([]string, error) {
|
||||
if len(photoPaths) == 0 {
|
||||
return nil, fmt.Errorf("no photos selected")
|
||||
}
|
||||
if len(photoPaths) > 3 {
|
||||
return nil, fmt.Errorf("at most 3 photos (got %d)", len(photoPaths))
|
||||
if len(photoPaths) > 5 {
|
||||
return nil, fmt.Errorf("at most 5 photos (got %d)", len(photoPaths))
|
||||
}
|
||||
photos := make([]qslcard.PhotoAnalysis, 0, len(photoPaths))
|
||||
for _, p := range photoPaths {
|
||||
@@ -425,17 +429,14 @@ func (a *App) SendEQSL(qsoID int64, templateID int64, jpegB64 string) error {
|
||||
applog.Printf("qsl: send eQSL to %s (%s) failed: %v", to, q.Callsign, err)
|
||||
return err
|
||||
}
|
||||
// Stamp the standard ADIF eqsl_sent flag plus an app-specific timestamp of
|
||||
// the eQSL-card e-mail (APP_OPSLOG_QSL_SENT) — distinct from eqsl_sent, which
|
||||
// an eQSL.cc upload may also set. q came straight from GetByID, so a full
|
||||
// Update rewrites the row unchanged apart from these fields.
|
||||
now := time.Now().UTC()
|
||||
q.EQSLSent = "Y"
|
||||
q.EQSLSentDate = now.Format("20060102")
|
||||
// Record WHEN OpsLog e-mailed its own QSL card, in a dedicated app field —
|
||||
// NOT the ADIF eqsl_sent flag, which belongs to eQSL.cc and must stay
|
||||
// independent. q came straight from GetByID, so a full Update rewrites the
|
||||
// row unchanged apart from this field.
|
||||
if q.Extras == nil {
|
||||
q.Extras = map[string]string{}
|
||||
}
|
||||
q.Extras["APP_OPSLOG_QSL_SENT"] = now.Format(time.RFC3339)
|
||||
q.Extras[appQSLCardSentField] = time.Now().UTC().Format(time.RFC3339)
|
||||
if err := a.qso.Update(a.ctx, q); err != nil {
|
||||
applog.Printf("qsl: eQSL sent to %s but marking failed: %v", q.Callsign, err)
|
||||
return fmt.Errorf("eQSL sent but status not saved: %w", err)
|
||||
@@ -502,7 +503,7 @@ func (a *App) maybeAutoSendEQSL(q qso.QSO) {
|
||||
if v, _ := a.settings.Get(a.ctx, keyQSLAutoSend); v != "1" {
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(q.Email) == "" || strings.EqualFold(q.EQSLSent, "Y") {
|
||||
if strings.TrimSpace(q.Email) == "" || q.Extras[appQSLCardSentField] != "" {
|
||||
return
|
||||
}
|
||||
p, err := a.profiles.Active(a.ctx)
|
||||
|
||||
Reference in New Issue
Block a user