Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent update broke struct compatibility with structjoin and bureaucracy #709

Open
vic-t opened this issue Feb 18, 2024 · 2 comments
Open
Labels

Comments

@vic-t
Copy link

vic-t commented Feb 18, 2024

Issue Description

I'm sorry for the convoluted title. This error actually appears when using bureaucracy but only when the plugins struct and structjoin are also used. Since neither structjoin nor bureaucracy have received any updates as of late, I assume that a change in the struct plugin must be responsible for the issue I will now try to describe.

I'll start by describing my setup. I have one struct called customer consisting of two fields, the customer number and the customer name. The idea of this struct is to simply be available for other structs as a reference. No documents are linked to this struct directly.

I have another struct called customerdocumentation, referencing the struct customer and adding a couple more fields. This struct is tied to documents in a certain namespace.

I need to be able to reference both the customer name as well as the customer number from the customer struct in the customerdocumentation struct. Since struct by default only supports a single lookup field, I'm using the structjoin plugin that offers the flexibility to reference this second field.

This is my bureaucracy form:

<form>
action template tmpl:customerdoc internal:clients:@@customerdocumentation.customer@@
struct_field customerdocumentation.customer
struct_field customerdocumentation.customerno
struct_field customerdocumentation.customertype
submit "Neue Kundendokumentation erstellen"
</form>

The struct_field customerdocumentation.customer is automatically populated and presents itself as a drop-down list. From here I can select the customer. The content of this field will be provided to the template.

The struct_field customerdocumentation.customertype is a multi-value struct field and is also correctly populated, I can choose the needed values.

Last but not least, the struct_field customerdocumentation.customerno is the mentioned second lookup field which was defined using the structjoin plugin.

Since I started working with these plugins, the customerno field was never populated but instead was simply shown as a non-editable label named customerno. Nevertheless, the value was always correctly handed over to the new customerdocumentation page and correctly stored in the respective struct.

This is no longer the case. When I submit the form, I'm getting the error "Customer number is required".

I can't say for sure which update exactly broke this behavior. As far as I can see, the last time it worked was in August last year. I believe I updated DokuWiki to Jack Jackrum after that, as well as all the plugins. I haven't used the form until today which is why I haven't reported it earlier.

Please let me know if you believe this bug report is in the wrong repository. Also, I'm happy to try and help as much as I can in resolving this issue.

@vic-t
Copy link
Author

vic-t commented Feb 18, 2024

I was trying to research this issue and remembered that in 2022, bureaucracy stopped submitting lookup field values altogether, as described in splitbrain/dokuwiki-plugin-bureaucracy#313. Since a structjoin field is just a variation of a lookup field, this issue may be related.

@vic-t
Copy link
Author

vic-t commented Feb 18, 2024

With some more testing, I seem to have found a workaround that may help in certain instances. While directly referencing a structjoin field in the bureaucracy form will lead to the reported error, referencing the whole schema will not.

So just replace

<form>
action template tmpl:customerdoc internal:clients:@@customerdocumentation.customer@@
struct_field customerdocumentation.customer
struct_field customerdocumentation.customerno
struct_field customerdocumentation.customertype
submit "Neue Kundendokumentation erstellen"
</form>

with

<form>
action template tmpl:customerdoc internal:clients:@@customerdocumentation.customer@@
struct_schema customerdocumentation !
submit "Neue Kundendokumentation erstellen"
</form>

Note that in my particular example, customerdocumentation.customer is a lookup field. Due to another issue, this field is not submitted to the target struct so it is necessary to replace it with a manually entered value. The ugly workaround looks like this.

action template tmpl:customerdoc internal:clients:@@Kundenname@@
textbox Kundenname
struct_schema customerdocumentation !
submit "Neue Kundendokumentation erstellen"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant