Date field with To date option
Alpha5 - December 10, 2008 - 09:41
| Project: | Workflow Fields |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | kratib |
| Status: | active |
| Issue tags: | CCK Date field |
Jump to:
Description
I have a date field with To date, when it's moved to a state that have view but not-editable, when save the node will get this error:
warning: Invalid argument supplied for foreach() in D:\Drupal\Secondweb\sites\all\modules\date\date\date_elements.inc on line 392.
Some value must be entered in the To date. How to resolve this bug? I need help.

#1
Please try version 6.x-1.x-dev. I'm not getting this problem there. Also, if you marked the To date as required, you should either:
a) give it a default value
b) allow your first state to edit it
so that Drupal doesn't complain about a missing value.
#2
I use Date module version 6.x-2.0-rc6. Workflow field version 1.0 or 6.x-1.x-dev. With default value or not also give same result. My first state already give this field a value. This make me must give this field alway editable. Date Granularity is Year Month Day Hour Minute. Not second. I use Drupal 6.6. in IIS window domain, last version of PHP and MySQL.
Do I miss something? I create a fresh 6.6 site with just workflow_fields, workflow, cck, date. I still get this error.
#3
Here's what I did:
* installed date-6.x-2.0-rc6
* edited a content type to add a date field with widget = Text field with custom input format
* edited the second workflow state (after creation) to make this field visible but not editable
* created a new node of the content type, and gave the date field some value
* made sure the workflow moved to the second state
* edited again, saw the date field displayed but not editable, submitted: no complaint, the date field remained the same
What did I miss in this scenario?
#4
Which all module version did you use? CCK, date, workflow, workflow field?
* edited the second workflow state (after creation) to make this field visible but not editable
I give date field edit at creation and next state "First state". And then the second state "Second state" is viewable but not editable.
#5
cck-6.x-2.1
date-6.x-2.0-rc6
workflow-6.x-1.0-rc3
workflow_fields-6.x-1.x-dev
drupal-6.7
#6
I think only me have this bug. But after search, I found this http://drupal.org/node/289327 and this http://drupal.org/node/298440 . It seem be a date bug and it is resolved.
Why I still get this ???
#7
Can you try the date fields with Content Permission? Do you still get the same problem as they described it?
#8
If I don't use workflow and workflow field module, and I create a role with userA that have view, not editable that date field. UserB with editable and viewable. If a node created by userB with date field -> no error. UserA edit this node -> no error.
Seem to be only when use workflow to set field permission will get this error.
I regconize that I set Content permission for this field is editable for everyone. So it will load when node save even if workflow field set it to only viewable. Now I remove role that not need to edit date field at Content permission module. This resolve the error at this state. But if this role need to edit date field at other state, it will unable.
#9
I still need help at this bug. If I don't use content permission then I will get this warning when save at state without editable permission date with to date field.
#10
1. Do you also get this problem if the field is marked as non-editable *and* non-visible?
2. According to the error you're getting at date_elements.inc:392, the field's To date is marked as required. Is that the case?
#11
1. Yes
2. To date is marked as required or Optional will get the same
#12
* Please make sure you don't have an older copy of CCK, Date or any other module in the modules folder. This is a common cause of hard-to-trace problems.
* When you save the node at the state where date is marked as read-only, does the node actually get saved?
Sorry for not being to help you more. I am still not able to reproduce this bug even though I keep trying. If you want to send me your Drupal installation + database snapshot please let me know.
#13
Here is something similar to what is noted above- it might be the same bug:
The errors are:
My date field value then disappears. Here are the module versions:
cck-6.x-2.2
date-6.x-2.1
workflow-6.x-1.1
workflow-fields-6.x-1.1
drupal-6.10
If a role has view-only access during a certain step in a workflow, the date field is set to NULL and the above errors are seen.
I will try the dev version.
Thanks,
DaveA
#14
Same result with 6.x.1.x-dev
:(
Thanks,
DaveA
#15
Yes, the date module changed recently and introduced a whole lot of problems. I'll be looking at this soon.
#16
Can you please try to create a new node with the latest date module in place, and then check if workflow_fields gives you the same errors? I encountered problems upgrading my existing CCK nodes containing dates to the latest date.module.
Also, what are the settings on the date field? single/multiple values? disabled/optional/required to date? widget type?
#17
I'm also having similar problem, Used the latest version of all cck, date, workflow/workflow fields but
[#default_value] => Array(
[value] => 2010-03-05 09:06:00
[timezone] => UTC
[timezone_db] => UTC
[date_type] => date
)
after preview the node or saving node it changes to
[#default_value] => Array(
[value] => 0010-03-05 09:06:00
[timezone] => UTC
[timezone_db] => UTC
[date_type] => date
)
Do we need to write any function of workflow_fields process just as written for file - _workflow_field_process_file?
#18
I hope not. Can you give me the settings of your date field for me to try and reproduce this behaviour? See comment #16 for what I'm asking.
#19
I've used the single date, optional, widget type default (tried both Select List / Text Field with Date Pop-up calendar).
Created couple of date cck:
'birth_date' cck with 'Select List' required.
'exam_date' cck with 'Select List' optional.
I've taken create student and workflow state as 'Entry Point' and 'Exit Point'.
'Entry Point' ::
- birth_date (visible and editable both)
- exam_date (visible and editable both)
'Exit Point' ::
- birth_date (visible and not editable)
- exam_date (visible and editable both)
When first create .. No issue.
Change the workflow to 'Exit Point' and save .. No issue.
Again go and edit the 'no editing done' and save .. birthdate field goes wrong ... year's first letter goes to zero. Even when do preview at this point of time.. Preview gives wrong result.
Is it sufficient information to reproduce the error?
#20
kratib,
Are you able to reproduce the bug?
#21
Sorry I haven't replied earlier. I was able to replicate a problem using your scenario and I'm currently looking into it.
#22
Seems this is a date module issue: #408770: #access of date_combo fields prevents validation. I am following up on it.