Lizenz-Vertrieb: CSV-Download ohne Kopfzeile (nur Codes)
Auf Wunsch: txt und csv liefern beide reine Code-Zeilen (eine pro Zeile, keine Metadaten-Kopfzeile) -> direkt per Copy-Paste einloesbar. Nur die Datei-Endung/MIME unterscheidet sich. Dateiname unveraendert <ExtBestellnr|Datum>_geograsim_<interneNr>. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -504,15 +504,11 @@ function buildMailText(m){
|
||||
|
||||
function copyEl(id){ var el=document.getElementById(id); el.select(); navigator.clipboard.writeText(el.value).catch(function(){document.execCommand('copy');}); }
|
||||
|
||||
// CSV: Metadaten (inkl. Gültig-bis) in die KOPFZEILE, danach reine Code-Zeilen
|
||||
// -> der Code-Block bleibt per Copy-Paste einlösbar (kein Datum je Zeile).
|
||||
// Nur die Codes (eine pro Zeile), KEINE Kopfzeile — direkt per Copy-Paste einlösbar.
|
||||
function downloadCodes(fmt){
|
||||
var m = lastIssue; if(!m) return;
|
||||
var content, mime;
|
||||
if(fmt==='csv'){
|
||||
var head='Bestellung;#'+(m.internal_no||'')+'\nExterne Bestellnummer;'+(m.order_no||'')+'\nGültig bis;'+fmtDate(m.valid_until)+'\nAnzahl;'+m.count+'\n\n';
|
||||
content=head+m.codes.join('\r\n')+'\r\n'; mime='text/csv';
|
||||
} else { content=m.codes.join('\r\n')+'\r\n'; mime='text/plain'; }
|
||||
var content = m.codes.join('\r\n')+'\r\n';
|
||||
var mime = fmt==='csv' ? 'text/csv' : 'text/plain';
|
||||
var ext = m.order_no ? m.order_no.replace(/[^a-zA-Z0-9_\-]/g,'_') : (new Date().toISOString().slice(0,16).replace(/[:T]/g,'-'));
|
||||
var fname = ext+'_geograsim_'+(m.internal_no||'')+'.'+fmt;
|
||||
var a=document.createElement('a'); a.href=URL.createObjectURL(new Blob([content],{type:mime})); a.download=fname; a.click();
|
||||
|
||||
Reference in New Issue
Block a user