Could a date to send field be added so that a message can be sent, perhaps on cron jobs, on a specific date, through perhaps cron jobs. Ideal for delayed card sending on Christmas, Valentines, Birthdays etc.

Comments

kars-t’s picture

Priority: Normal » Minor

Right now there is no cron integration or anything but it is definitively possible. Lets put this to the "nice to have features" list :)

kars-t’s picture

Title: Delayed Sending » Cron integration
Category: feature » task
browlands’s picture

http://drupal.org/project/addressbook is worth looking at for ideas

stella’s picture

Title: Cron integration » Add ability to schedule e-card sending
Category: task » feature
kars-t’s picture

More detailed task description:

Add an option to the backend for activate delayed sending that the form shows a optional date / time picker. If a date is chosen the ecard will be delayed and sended through hook_cron. So far so good. The problems is wich time picker to use? I could make this feature depend on some other module as I don't want to implement a date picker 1.000 time.

stella’s picture

I'm in favour of making a dependency and not re-implementing the wheel :) as long as it's an optional dependency, and not required for the entire module.

kars-t’s picture

I chatted on german irc a bit about this and I will try to use the jquery.ui library and module.

kaakuu’s picture

Priority: Minor » Major

This is a very important feature of ecard. Infact ecard has no practical utility without this.
Ecard is not ecard without this.
Any progress on this feature?

kars-t’s picture

Hi

the current problem with ecard is that it really needs simpletests. After this I will create a new version. But ofcourse you are always invited to implement this and write a patch :)

I leave the status as major as I believe this is a quite important feature.

kars-t’s picture

Still applies.

kars-t’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Moving to D7

stella’s picture

Status: Active » Needs review
StatusFileSize
new15.51 KB

Ok here's a D6 version of the patch - sorry, not working on D7 yet, though may be later in the week!

Here's what it does:

  • Adds in a dependency on jquery ui for the datepicker.
  • Adds a configurable checkbox to the configuration screen so you can choose whether you want to enable that functionality or not.
  • Changes the "send" and "notify" columns in the ecard table to be boolean values, and renames the "send" column to "sent". The "send" column wasn't being used anywhere, so this made more sense to me. Complete with update hook and an upgrade path.
  • Added in a "scheduled_time" column to the ecard table.
  • If the feature is not enabled, ecards will be sent immediately.
  • If enabled, then the "copies" (if enabled) will be sent immediately, but not the actual ecards unless the user enters in a blank date or today.
  • The time defaults to midnight (00:00:00).
  • On cron, scheduled ecards are sent in batches of "max allowed cards" so as to try to prevent flooding. Additional tweaks may be needed here, not sure.
  • Extends Views integration of the new scheduled_time column, and "sent" and "notify" columns which weren't supported before.
stella’s picture

StatusFileSize
new17.39 KB

Drupal 7 version of the patch attached. It depends on these other patches being applied first though: #1380428: Incorrect verb tense and non-translatable text in user interface, #1802066: Ecard field settings not working, #1802320: pick_up time not being updated in the database and #1802694: notification of when an ecard is picked up not available in d7

For this to work, I had to make the following changes:

  • Add an option to the ecard field settings to enable / disable this feature.
  • Renamed 'timestamp' column to 'created' in database
  • Added new columns 'sent_time', 'scheduled_time' and 'field_name' to hold the time the ecard was sent, when it is scheduled to be sent (defaults to 0 if disabled) and the ecard name of the field on the entity.
  • I had to add the field_name to the db so we can pull out the email and other field settings on cron run.
  • Implemented hook_cron() and hook_cron_queue_info() to process scheduled ecards. Defaults to batches of 50 at present in an attempt to prevent flooding, but this should be made configurable and probably better flood protection put in place.
  • Updated the views configuration for the new schema
  • Fixed the validation and submit form routines so they use $form_state['values'][FIELDNAME] rather than $form[FIELDNAME]['#value']
  • Separated out sending of ecard and ecard copy - as the copy version would need to be sent immediately
  • Moved the drupal_set_message()s out from ecard_mail_send_ecard() as you don't want those when running cron via drush
stella’s picture

StatusFileSize
new18.01 KB

patch re-roll as the field_name wasn't being saved to that column in the db.

stella’s picture

StatusFileSize
new18.01 KB

D7 patch re-roll for undefined index warning.

kars-t’s picture

Status: Needs review » Fixed

Added

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.