When an ad with a start and end date is expired (unpublished) via cron, it as republished, even though the current date is greater than the end date, and the ad should therefore remain unpublished.
What happens is that node_save() which is triggered by cron (with the correct value set for $node->status = 0) invokes the node_presave() hook which runs simpleads_node_presave() - this checks for a form field $node->field_ad_date[$node->language][0]['show_todate'] which doesn't exist when a node is loaded via node_load. So because this value does not exist, the module presumes there is no end date and sets the status to published.
I am working on a fix.
Comment | File | Size | Author |
---|---|---|---|
#3 | simpleads-end_date-2455595-3.patch | 456 bytes | skorzh |
#2 | simpleads-test_for_end_date-2455595-2.patch | 1.4 KB | foxtrotcharlie |
Comments
Comment #1
foxtrotcharlie CreditAttribution: foxtrotcharlie commentedComment #2
foxtrotcharlie CreditAttribution: foxtrotcharlie commentedThis patch finds another way to test whether or not an end date has been explicitly set.
When an ad is initially created, and the end date checkbox is left unchecked, when saved, the end date is set to the same value as the start date, so we can use this to test whether or not an end date was chosen. If they are the same, then we assume no end date was chosen, which we can then use to determine whether or not to continue publishing the ad.
Comment #3
skorzhAttached patch for 7.x-1.x version
Comment #5
skorzhShould be reviewed manually.
Comment #6
golddragon007 CreditAttribution: golddragon007 at Brainsum commentedit seems it works
Comment #7
igorik CreditAttribution: igorik as a volunteer commentedcan be it imported/fixed into the module?
Comment #8
minnur CreditAttribution: minnur as a volunteer commented