[librecat-dev] how to have field remain in user after account save
Jonathan NORRIS
jnorris at ist.ac.at
Thu May 28 12:54:17 CEST 2020
Hey,
Thanks, I copied the existing read_only_fields hook and made a new one
for my user fields. It worked like a charm!
I have another thing I am trying to figure out. I need a cql query to
return me only users who have a value for my new field. I am storing a
list of publication ids in the user object and the field is called
'favorite_publications'.
It looks like this in the user object yaml:
favorite_publications:
- 3853
- 3950
- 4118
Here is the field in store.yml:
user:
mapping:
properties:
favorite_publications: {type: text, analyzer: tag}
cql_mapping:
indexes:
favorite_publications:
op:
'<>': true
field: "favorite_publications"
I imagine the cql to be like: bin/librecat user list
'cql=favorite_publications<>0'
However this query returns me the full list of users rather than the one
user which actually has a favorite_publications field.
Can you advise on how I could achieve what I am trying to do?
Thanks for your help!
Jonathan
IST Austria
On 5/27/20 15:02, Patrick Hochstenbach wrote:
> Hi,
>
> One way is using the LibreCat::Hook::read_only_fields
>
> Somewhere in your config/catmandu.local.yml define:
>
> hook:
> my_read_only_fields:
> - legacy_id
>
> And in your config/hooks.yml
>
> publication-update:
> before_fixes:
> - my_read_only_fields
>
> In this way the legacy_id fileds are kept in the original state when updating a record via the forms.
>
> Patrick
>
>
>> On 27 May 2020, at 10:34, Jonathan NORRIS <jnorris at ist.ac.at> wrote:
>>
>> Hello,
>>
>> Is there a way to configure a field in store.yml to have it remain in an index document after saving the document via a form when there is no entry for that field in the form?
>>
>> As in, say I have a new field in the user mapping in store.yml which is populated via some process somewhere in Librecat, but I don't have a form field for this in the user account form. Can I configure the field in store.yml so that it is not removed after I save the user via the user's account form?
>>
>> Thanks,
>> Jonathan
>> IST Austria
>> _______________________________________________
>> librecat-dev mailing list
>> - send list mails to librecat-dev at lists.uni-bielefeld.de
>> - to unsubscribe or change options, visit https://lists.uni-bielefeld.de/mailman2/cgi/unibi/listinfo/librecat-dev
>> - project website: http://librecat.org/
More information about the librecat-dev
mailing list