Inaktiv Fehler beim prüfen auf Variableninhalt

crap_inhuman

Aktives Mitglied
7. Juli 2018
76
7
Ich habe in der E-Mailvorlage für Rechnungen folgende Zeilen:

{% for anzahl in Vorgang.Auftrag.Lieferscheine.ErstesObjekt.Pakete -%}
{% if anzahl.Hinweis | Matches: 'DPD', true == true -%}
Paketdienst: DPD
...

Jetzt steht in anzahl.Hinweis = Spedition, wieso wird trotzdem der Text "Paketdienst: DPD" ausgegeben?

Hier der komplette Block:

{% for anzahl in Vorgang.Auftrag.Lieferscheine.ErstesObjekt.Pakete -%}
{{ anzahl.Hinweis }}
{% if anzahl.Hinweis | Matches: 'DPD', true == true -%}
Paketverfolgung: https://tracking.dpd.de/parcelstatus?query={{anzahl.TrackingID }}&locale=de_DE
Paketdienst: DPD
{% elsif anzahl.Hinweis | Matches: 'GLS', true == true -%}
Paketverfolgung: https://gls-group.eu/DE/de/paketverfolgung?match={{ anzahl.TrackingID }}
Paketdienst: GLS
{% elsif anzahl.Hinweis | Matches: 'UPS', true == true -%}
Tracking-Nummer: {{ anzahl.TrackingID }}
Paketdienst: UPS
{% else -%}
Paketdienst: {{ anzahl.Hinweis }}
{% endif -%}
{% endfor -%}

Die Text-Vorschau habe ich im Anhang eingefügt. Wie man sieht, steht im Hinweis "Spedition", dennoch wird der DPD Teil angezeigt. Warum?
 

Anhänge

  • fehler.png
    fehler.png
    11 KB · Aufrufe: 2

Rico Giesler

Offizieller Service Partner
SPBanner
10. Mai 2017
13.247
1.526
So sollte es gehen:
{% for anzahl in Vorgang.Auftrag.Lieferscheine.ErstesObjekt.Pakete -%}
{% if anzahl.Hinweis == 'DPD', true == true -%}
Paketverfolgung: https://tracking.dpd.de/parcelstatus?query={{anzahl.TrackingID }}&locale=de_DE
Paketdienst: DPD
{% elsif anzahl.Hinweis == 'GLS', true == true -%}
Paketverfolgung: https://gls-group.eu/DE/de/paketverfolgung?match={{ anzahl.TrackingID }}
Paketdienst: GLS
{% elsif anzahl.Hinweis == 'UPS', true == true -%}
Tracking-Nummer: {{ anzahl.TrackingID }}
Paketdienst: UPS
{% else -%}
Paketdienst: {{ anzahl.Hinweis }}
{% endif -%}
{% endfor -%}
 

crap_inhuman

Aktives Mitglied
7. Juli 2018
76
7
In dem Hinweis steht jedoch nicht "DPD" sondern "Paketdienst DPD" oder "DPDDE" oder "irgendwas DPD". Geht das dann auch mit Deiner Lösung?
 

Ähnliche Themen