cms icon indicating copy to clipboard operation
cms copied to clipboard

Non-translatable field stored as null, not using origin

Open MrMooky opened this issue 3 years ago • 7 comments

Bug description

When storing a non-translatable image field, it still is stored in the translated md file but as null. For some strange reason this has worked before and the origin image was used. But now, those values are stored as null and thus are not available in the translation.

Origin:

Screenshot 2022-08-15 at 11 04 46

Translated:

Screenshot 2022-08-15 at 11 04 27

They also don't show up in the backend of the translated entry, even when a default is set in the origin.

Screenshot 2022-08-15 at 11 11 08

How to reproduce

Create a multi-site and add an image fieldtype to an entry. Make the image non-translatable. When storing the origin and then switching to the translation, the images (of the origin) are not shown in the preview and the translated md file should have the image value as null.

Projects blueprint:

sections:
  main:
    display: Übersicht
    fields:
      -
        handle: title
        field:
          type: text
          required: true
          validate:
            - required
          display: Titel
          instructions_position: above
          listable: hidden
          input_type: text
          antlers: false
          localizable: true
      -
        handle: subtitle
        field:
          input_type: text
          antlers: false
          display: Untertitel
          type: text
          icon: text
          localizable: true
          listable: hidden
          instructions_position: above
          visibility: visible
      -
        handle: project_info
        field:
          always_show_set_button: false
          buttons:
            - h2
            - h3
            - h4
            - bold
            - italic
            - horizontalrule
            - strikethrough
            - small
            - unorderedlist
            - orderedlist
            - removeformat
            - quote
            - anchor
            - table
            - image
          save_html: false
          toolbar_mode: fixed
          link_noopener: false
          link_noreferrer: false
          target_blank: false
          reading_time: false
          fullscreen: true
          allow_source: true
          enable_input_rules: true
          enable_paste_rules: true
          antlers: false
          display: 'Projekt Informationen (Business Plan)'
          type: bard
          icon: bard
          listable: hidden
          instructions_position: above
          sets:
            accordion:
              display: Accordion
              fields:
                -
                  import: accordion
          localizable: true
          visibility: visible
          container: dateien
  sidebar:
    display: Sidebar
    fields:
      -
        handle: slug
        field:
          type: slug
          localizable: true
      -
        handle: date
        field:
          type: date
          required: true
          validate:
            - required
          display: Veröffentlichungsdatum
          instructions_position: above
          listable: hidden
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          localizable: true
      -
        handle: image_preview
        field:
          mode: list
          container: dateien
          restrict: false
          allow_uploads: true
          show_filename: true
          max_files: 1
          display: 'Vorschaubild (klein)'
          type: assets
          icon: assets
          instructions: 'Das Vorschaubild wird für Übersichten verwendet.'
          listable: hidden
          instructions_position: above
      -
        handle: image_main
        field:
          mode: list
          container: dateien
          restrict: false
          allow_uploads: true
          show_filename: true
          max_files: 1
          display: Hauptbild
          type: assets
          icon: assets
          instructions: 'Wird auf der Projektdetailseite im Header verwendet.'
          listable: hidden
          instructions_position: above
      -
        handle: youtube_video_id
        field:
          input_type: text
          antlers: false
          display: 'YouTube Video ID'
          type: text
          icon: text
          listable: hidden
          instructions_position: above
          localizable: true
  projectinfo:
    display: Allgemein
    fields:
      -
        handle: company
        field:
          max_items: 1
          mode: default
          create: false
          collections:
            - companies
          display: Unternehmen
          type: entries
          icon: entries
          listable: hidden
          instructions_position: above
          visibility: visible
          validate:
            - required
      -
        handle: investment_starts
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Laufzeit Beginn'
          type: date
          icon: date
          listable: hidden
          instructions_position: above
          width: 50
          visibility: visible
          validate:
            - required
      -
        handle: investment_ends
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Laufzeit Ende (Mitternacht)'
          type: date
          icon: date
          listable: hidden
          instructions_position: above
          width: 50
          visibility: visible
          validate:
            - required
      -
        handle: hinweis_vermoegensanlagengesetz
        field:
          inline_label: 'Hinweis anzeigen'
          default: true
          display: 'Hinweis Vermögensanlagengesetz'
          type: toggle
          icon: toggle
          instructions: 'Zeigt einen generellen Hinweis zum Vermögensanlagengesetz unterhalb der Übersichtstabelle an.'
          listable: hidden
          instructions_position: above
      -
        handle: downloads
        field:
          collapse: false
          sets:
            download_data_file:
              display: Datei
              fields:
                -
                  handle: file_title
                  field:
                    input_type: text
                    antlers: false
                    display: Dateititel
                    type: text
                    icon: text
                    listable: hidden
                    instructions_position: above
                    read_only: false
                -
                  handle: download_file
                  field:
                    mode: list
                    restrict: false
                    allow_uploads: true
                    show_filename: true
                    max_files: 1
                    display: Datei
                    type: assets
                    icon: assets
                    listable: hidden
                    instructions_position: above
                    read_only: false
                    container: documents
          display: Downloads
          type: replicator
          icon: replicator
          listable: hidden
          instructions_position: above
          localizable: true
      -
        handle: funding_lowest
        field:
          input_type: text
          antlers: false
          display: Fundingschwelle
          type: text
          icon: text
          instructions: 'Angabe ohne Zeichen (z.B. 10750)'
          width: 33
          listable: hidden
          instructions_position: above
          placeholder: '10750'
          visibility: visible
          validate:
            - required
      -
        handle: investment_target
        field:
          placeholder: '50250'
          input_type: text
          antlers: false
          display: Fundinglimit
          type: text
          icon: text
          instructions: 'Angabe ohne Zeichen (z.B. 50250)'
          listable: hidden
          instructions_position: above
          width: 33
          visibility: visible
          validate:
            - required
      -
        handle: funding_limit
        field:
          input_type: text
          antlers: false
          display: Maximalvolumen
          type: text
          icon: text
          instructions: 'Angabe ohne Zeichen (z.B. 75500)'
          width: 33
          listable: hidden
          instructions_position: above
          placeholder: '75500'
          visibility: visible
          validate:
            - required
      -
        handle: secupay_project_id
        field:
          input_type: text
          antlers: false
          display: 'secupay Projekt-ID'
          type: text
          icon: text
          listable: hidden
          instructions_position: above
          instructions: 'Ohne eine gültige Projekt-ID können keine Investitionen getätigt werden. Projekt-IDs können im Bereich "secupay" erstellt werden.'
      -
        handle: mailerlite_list
        field:
          input_type: text
          antlers: false
          display: 'MailerLite Listen-ID'
          type: text
          icon: text
          instructions: 'Hier die ID der Subscriber-Liste aus MailerLite eintragen. Die Listen-IDs können im Bereich "MailerLite" eingesehen werden. Neue Listen müssen direkt im MailerLite Backend erstellt werden.'
          listable: hidden
          instructions_position: above
      -
        handle: mindestvertragslaufzeiten
        field:
          display: Mindestvertragslaufzeiten
          type: section
          icon: section
          listable: hidden
          instructions_position: above
      -
        handle: min_contract_duration_investor
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: Investor
          type: date
          icon: date
          width: 50
          listable: hidden
          instructions_position: above
          visibility: visible
          validate:
            - required
      -
        handle: min_contract_duration_company
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: Unternehmen
          type: date
          icon: date
          width: 50
          listable: hidden
          instructions_position: above
          visibility: visible
          validate:
            - required
  legalinfo:
    display: Rechtliches
    fields:
      -
        handle: legal_info
        field:
          always_show_set_button: false
          sets:
            accordion:
              display: Accordion
              fields:
                -
                  import: accordion
          buttons:
            - h2
            - h3
            - bold
            - italic
            - unorderedlist
            - orderedlist
            - removeformat
            - quote
            - anchor
            - table
            - image
          save_html: false
          toolbar_mode: fixed
          link_noopener: false
          link_noreferrer: false
          target_blank: false
          reading_time: false
          fullscreen: true
          allow_source: true
          enable_input_rules: true
          enable_paste_rules: true
          antlers: false
          display: Text
          type: bard
          icon: bard
          listable: hidden
          instructions_position: above
          localizable: true
          visibility: visible
          container: dateien
      -
        handle: investment_form
        field:
          options:
            partiarisches_nachrangdarlehen: 'Partiarisches Nachrangdarlehen'
          multiple: false
          max_items: 1
          clearable: false
          searchable: false
          taggable: false
          push_tags: false
          cast_booleans: false
          display: Investmentform
          type: select
          icon: select
          listable: hidden
          instructions_position: above
          default: partiarisches_nachrangdarlehen
      -
        handle: contract_duration
        field:
          placeholder: '2 Jahre'
          input_type: text
          antlers: false
          display: Vertragslaufzeit
          type: text
          icon: text
          listable: hidden
          instructions_position: above
          localizable: true
          visibility: visible
          validate:
            - required
      -
        handle: return_opportunity
        field:
          input_type: text
          antlers: false
          display: 'Rendite-Chance in Prozent'
          type: text
          icon: text
          listable: hidden
          instructions_position: above
          placeholder: '1,5'
          width: 50
          instructions: 'Nur Zahl eingeben, kein "%" oder "Prozent".'
          visibility: visible
          validate:
            - required
      -
        handle: rendite_auszahlung_zum
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Auszahlung zum...'
          type: date
          icon: date
          instructions: 'Im Vertrag wird der Tag und Monat ausgegeben (16.02.)'
          width: 50
          listable: hidden
          instructions_position: above
          visibility: visible
          validate:
            - required
      -
        handle: rechtliche_downloads
        field:
          collapse: false
          sets:
            legal_file:
              display: Datei
              fields:
                -
                  handle: dateititel
                  field:
                    input_type: text
                    antlers: false
                    display: Dateititel
                    type: text
                    icon: text
                    listable: hidden
                    instructions_position: above
                    read_only: false
                    placeholder: Mustervertrag
                -
                  handle: datei
                  field:
                    mode: list
                    container: documents
                    restrict: false
                    allow_uploads: true
                    show_filename: true
                    max_files: 1
                    display: Datei
                    type: assets
                    icon: assets
                    listable: hidden
                    instructions_position: above
                    read_only: false
          display: 'Rechtliche Downloads'
          type: replicator
          icon: replicator
          listable: hidden
          instructions_position: above
          localizable: true
      -
        handle: vibfile
        field:
          mode: list
          container: documents
          restrict: false
          allow_uploads: true
          show_filename: true
          max_files: 1
          display: Vermögensanlagen-Informationsblatt
          type: assets
          icon: assets
          localizable: true
          listable: hidden
          instructions_position: above
          visibility: visible
  earlybird:
    display: Early-Bird
    fields:
      -
        handle: earlybird_enabled
        field:
          inline_label: Ja
          default: false
          display: Aktiv
          type: toggle
          icon: toggle
          instructions: 'Wird für dieses Projekt ein Early-Bird Bonus ermöglicht?'
          listable: hidden
          instructions_position: above
      -
        handle: early_bird_days_after_start
        field:
          display: Tage
          type: integer
          icon: integer
          instructions: 'Wieviele Tage nach Investment-Start ist der Early-Bird gültig?'
          listable: hidden
          instructions_position: above
          if:
            earlybird_enabled: 'equals true'
          validate:
            - 'required_if:earlybird_enabled,true'
      -
        handle: verzinsung_in_prozent
        field:
          placeholder: '9,5'
          input_type: text
          antlers: false
          display: 'Verzinsung in Prozent'
          type: text
          icon: text
          instructions: 'Nur Zahl eintragen, kein Prozent oder %'
          listable: hidden
          instructions_position: above
          if:
            earlybird_enabled: 'equals true'
          validate:
            - 'required_if:earlybird_enabled,true'
      -
        handle: auszahlung_zum
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Auszahlung zum...'
          type: date
          icon: date
          instructions: 'Im Vertrag wird der Tag und Monat ausgegeben (16.02.)'
          listable: hidden
          instructions_position: above
          if:
            earlybird_enabled: 'equals true'
          validate:
            - 'required_if:earlybird_enabled,true'
  project_bonus_interest:
    display: Bonuszins
    fields:
      -
        handle: bonuszins_faellig_zum
        field:
          mode: single
          format: Y-m-d
          time_enabled: false
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Fällig zum...'
          type: date
          icon: date
          instructions: 'Im Vertrag wird der Tag und Monat ausgegeben (16.02.)'
          listable: hidden
          instructions_position: above
          validate:
            - required
          visibility: visible
      -
        handle: bonuszins_prozent_eins
        field:
          placeholder: '10'
          input_type: text
          antlers: false
          display: Prozent
          type: text
          icon: text
          width: 33
          listable: hidden
          instructions_position: above
          validate:
            - required
          visibility: visible
      -
        handle: bonuszins_umsatz_ueber_eins
        field:
          placeholder: 10.000.000
          input_type: text
          antlers: false
          display: 'Bei Umsatz ab...'
          type: text
          icon: text
          width: 66
          listable: hidden
          instructions_position: above
          validate:
            - required
          visibility: visible
      -
        handle: bonuszins_prozent_zwei
        field:
          placeholder: '20'
          input_type: text
          antlers: false
          display: Prozent
          type: text
          icon: text
          width: 33
          listable: hidden
          instructions_position: above
          validate:
            - required
      -
        handle: bonuszins_umsatz_ueber_zwei
        field:
          placeholder: 15.000.000
          input_type: text
          antlers: false
          display: 'Bei Umsatz ab...'
          type: text
          icon: text
          width: 66
          listable: hidden
          instructions_position: above
          validate:
            - required
      -
        handle: bonuszins_prozent_drei
        field:
          placeholder: '30'
          input_type: text
          antlers: false
          display: Prozent
          type: text
          icon: text
          width: 33
          listable: hidden
          instructions_position: above
          validate:
            - required
      -
        handle: bonuszins_umsatz_ueber_drei
        field:
          placeholder: 20.000.000
          input_type: text
          antlers: false
          display: 'Bei Umsatz ab...'
          type: text
          icon: text
          width: 66
          listable: hidden
          instructions_position: above
          validate:
            - required
          visibility: visible
title: Projekte

Logs

No response

Environment

Application Name: Umati-Invest
Laravel Version: 9.24.0
PHP Version: 8.1.4
Composer Version: 2.2.0
Environment: local
Debug Mode: ENABLED
URL: umati-invest.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single, bugsnag
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 2
Antlers: runtime
Version: 3.3.28 PRO

Statamic Addons
jonassiewertsen/statamic-livewire: 2.9.0
octoper/statamic-blade-components: 2.0.0

Installation

Existing Laravel app

Antlers Parser

runtime (new)

Additional details

No response

MrMooky avatar Aug 15 '22 09:08 MrMooky

I can confirm that this issue exists - I just manually had to clean up several .md files and deleting the null values of non-translatable image fields. However, I could not reproduce the problem on this installation anymore using Statamic 3.3.29. @MrMooky Maybe you could try to update Statamic and check if this gets resolved? 🤞

wanze avatar Aug 19 '22 18:08 wanze

Question: Do you have STATAMIC_STACHE_WATCHER=false set in your .env? I am experiencing the same behaviour if the stache watcher is off.

volkeransmann avatar Aug 31 '22 10:08 volkeransmann

Question: Do you have STATAMIC_STACHE_WATCHER=false set in your .env? I am experiencing the same behaviour if the stache watcher is off.

Yes, as suggested in the docs I turned it off on production.

MrMooky avatar Aug 31 '22 10:08 MrMooky

Same here. But this was (at least for me) the root problem. As soon as i turned it on again - the control panel behaved normal again. Could you give that a try? Or did you come up with another solution?

volkeransmann avatar Aug 31 '22 10:08 volkeransmann

@volkeransmann My workaround was to make the image fields translatable, as the project was about to go live and has been pretty busy since then. So I was not able to reverse it and check out if @wanze's suggestion to just update fixes it.

What version are you on?

MrMooky avatar Aug 31 '22 10:08 MrMooky

Understood. I am on 3.3.32 and the issue still persists. Making the fields translatable ist certainly a way. But then you have to do a lot of repetitive work. Not feasible in every scenario :-(

volkeransmann avatar Aug 31 '22 10:08 volkeransmann

@MrMooky You should be able to tests this in your dev environment by also setting STATAMIC_STACHE_WATCHER=false

volkeransmann avatar Aug 31 '22 10:08 volkeransmann

Statamic 3.3.43 still has the same issue

OleksiiBrylin avatar Aug 11 '23 10:08 OleksiiBrylin

On 4.17.0 this doesn't seem to be an issue.

However, I wasn't able to reproduce this on 3.4 either.

If this is still happening to you, please provide an example GitHub repo with the problem reproduced.

jasonvarga avatar Aug 11 '23 14:08 jasonvarga