Closed (fixed)
Project:
Scheduler
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 May 2009 at 17:46 UTC
Updated:
25 May 2009 at 16:40 UTC
When you edit a previously saved node which had a pubish_on or unpublish_on value, change the value and do a preview, the old saved value
is put back into the editing form. This is because the dates are retrived from the database during hook_form_alter() when they should be taken from the edited form values.
This patch fixes this problem by checking if $form_state['values']['op']=='Preview' and then using $form_state['values']['publish_on'] and $form_state['values']['publish_on'] instead of retrieving the stored value from the {scheduler} db table.
Jonathan
| Comment | File | Size | Author |
|---|---|---|---|
| _scheduler.form_values_on_preview.patch.txt | 2.79 KB | jonathan1055 |
Comments
Comment #1
jonathan1055 commentedI forgot to say that this is a new issue, split out from #429004: Disallow publish_on and unpublish_on dates in the past.
The changes for the Preview problem in the attached patch in #1 above, all in scheduler_form_alter() as follows:
1. When doing a preview get the default values from the form not the db
2. Testing is now done on the $defaults object not $node
3. Consolidate the logic tests for whether to call scheduler_strToTime
4. Replace tabs with spaces as per drupal coding standards so that indentation is consistent
Hope that helps to explain things.
Also just noticed in the patch file, on the very first line I have not changed the module name from my temporary file name I used to create the diff. I guess you can edit it and change 'scheduler.before_c.module' to 'scheduler.module' before applying the patch. Sorry about that.
Jonathan
Comment #2
eric-alexander schaefer commentedExcellent! I always knew there must be a better way, but it always makes my brain hurt just looking at form_alter() and node_api(). Thanks a lot. Will be comitting this later this evening...
Comment #3
eric-alexander schaefer commentedCommited.