Thanks! I think that's an intuitive way of handling it.

Chris, I also realized that my "fix" was incomplete but couldn't figure out 
how to test the update checkbox control. Obviously, Roberto knows the 
codebase best...

LeVon



On Tuesday, February 9, 2016 at 6:46:24 PM UTC-5, Roberto Rosario wrote:
>
> Working on it (
> https://gitlab.com/mayan-edms/mayan-edms/commit/f1b090f8d6b89d826ee9bf623d5c7291fd5a57f9
>  
> <https://www.google.com/url?q=https%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fcommit%2Ff1b090f8d6b89d826ee9bf623d5c7291fd5a57f9&sa=D&sntz=1&usg=AFQjCNGwu70cUnNXiOuimI33X-h2DNJ4Fw>).
>  
> Found a good solution, if the checkbox is not selected the metadata entry 
> is ignored completely. If the checkbox is selected the metadata is created 
> with an empty value if the metadata type allows it. If the update checkbox 
> is not selected, validation is also turned off to avoid invalid values 
> stopping the wizard moving forward for metadata that is not even going to 
> be stored.  Commit is part of the 2.0.2 milestone to be release in a day or 
> two.
>
> On Tuesday, February 9, 2016 at 6:10:26 PM UTC-4, Chris H wrote:
>>
>> LeVon
>>
>> I applied your patch and it resolved the error but what I noticed is that 
>> if a metadata field has no value selected, the metadata is still applied to 
>> document, albeit with no value. I believe it should not be applied to the 
>> document at all. So I think there needs to be a second part to this patch 
>> that checks if a value has been defined before applying the metadata to the 
>> document. I had a look at the code but it is way beyond my coding abilities 
>> :(
>>
>> Thank you for this patch which helped me move forward in my testing.
>>
>> Chris
>>
>> On Tuesday, February 2, 2016 at 11:54:58 AM UTC-5, LeVon Smoker wrote:
>>>
>>> I fixed the problem by changing line 129 in 
>>> mayan/apps/metadata/models.py from:
>>>
>>>         if self.lookup:
>>>             lookup_options = self.get_lookup_values()
>>>             if value not in lookup_options:
>>>                 raise ValidationError(
>>>                     _('Value is not one of the provided options.')
>>>                 )
>>>
>>> to:
>>>         if self.lookup:
>>>             lookup_options = self.get_lookup_values()
>>>             if value and value not in lookup_options:
>>>                 raise ValidationError(
>>>                     _('Value is not one of the provided options.')
>>>                 )
>>>
>>> Adding the 'value and' to the if statement allows empty values. Of 
>>> course if the metadata type is required, that will be caught by the 
>>> preceding code and raise the appropriate error.
>>>
>>> Thoughts?
>>>
>>> LeVon S.
>>>
>>>
>>> On Monday, February 1, 2016 at 1:44:15 PM UTC-5, LeVon Smoker wrote:
>>>>
>>>> I'm having trouble getting optional metadata types to work when the 
>>>> type has a list of lookup options. When I try to upload a document that 
>>>> has 
>>>> optional metadata and I don't choose from the dropdown boxes, I get an 
>>>> error message - "Value is not one of the provided options." See the 
>>>> attachment. For the "Meeting Type" metadata I have 'Board', 'Management 
>>>> Team', 'Supervisors' entered as options in the Lookup field. I could add a 
>>>> value of None to the list but I think that defeats the purpose of allowing 
>>>> for optional vs required metadata based on document type.
>>>>
>>>> Or am I missing something?
>>>>
>>>> Thanks,
>>>> LeVon Smoker
>>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to