Hello,

Your last commit introduced a dependency to interval field so I have fatal error du to missing function.

http://cgit.drupalcode.org/date_restrictions/commit/?id=feb9c1678ade83dc...

I will provide a patch in a few minutes.

Comments

Grimreaper created an issue. See original summary.

grimreaper’s picture

Status: Active » Needs review
StatusFileSize
new712 bytes

Here is the patch.

Thanks for the review.

jonhattan’s picture

Sorry I can't see where's the new dependency added. What is the fatal error you're getting?

jonhattan’s picture

If you're using a restriction based on interval, you must already have interval enabled. This dependency is declared at http://cgit.drupalcode.org/date_restrictions/tree/modules/minmax/date_re... and enforced at http://cgit.drupalcode.org/date_restrictions/tree/modules/minmax/date_re...

jonhattan’s picture

Status: Needs review » Postponed (maintainer needs more info)
grimreaper’s picture

Priority: Critical » Major
Status: Postponed (maintainer needs more info) » Active

Hello,

In our project, we use date_restrictions in a custom form, see the following code:

  $form['date'] = array(
    '#title' => t('Choose a date'),
    '#type' => 'date_popup',
    //'#flavour' => 'inline', // requires date_datepicker_inline module.
    '#date_format' => $date_format,
    '#default_value' => $date_default_value,
    '#restrictions' => array(
      'min' => array(
        'type' => 'date',
        'date' => $date_old_prev,
      ),
      'max' => array(
        'type' => 'interval',
        'interval' => array('interval' => $interval, 'period' => 'days'),
      ),
    ),
  );

Before the commit it worked well. Now we have the following error: Fatal error: Call to undefined function interval_apply_interval() in /sites/all/modules/contrib/date_restrictions/modules/minmax/date_restrictions_minmax.date_restrictions.inc on line 290

Thanks for pointing the dependencies check of the module but It seems not working in custom forms.

Maybe we do not use the module correctly, in this case I will be very thankful if you can tell me the problem or pointing me to the associated documentation.

jonhattan’s picture

Dependency check is done in the field UI settings form. It forbids the configuration of interval settings if it founds the module is not enabled.

For custom forms, the best is to add the dependency to your custom module. In the very same way, you want to add a dependency on date_popup module, to grant it is available when declaring '#type' => 'date_popup', in your custom form.

On date_restrictions side, we could add an advice to README.txt, since the example depends on interval module being enabled. Patches welcome.

grimreaper’s picture

Thanks for your response.

Ok I will provide a patch for this advice.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review
StatusFileSize
new1.36 KB

Here is a patch that adds the information in the README.txt

Thanks for the review.

  • jonhattan committed abed568 on 7.x-1.x authored by Grimreaper
    Issue #2556615 by Grimreaper: Missing dependency to interval field
    
jonhattan’s picture

Status: Needs review » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

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