CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Customizing New Event page
Pages: [1] 2

Author Topic: Customizing New Event page  (Read 4335 times)

pwnedulongtime

  • Guest
Customizing New Event page
June 19, 2008, 11:31:57 am
Greetings

I've added another date field to the New Event page, making the required edits to /ManageEvent/EventInfo.php, ManageEvent/EventInfo.tpl, DAO/Event.php files and creating a new date field in the civicrm_event table.

The field displays and works as expected, but always inserts NULL into the database. Is there another file I've neglected to edit in order to get this working?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customizing New Event page
June 19, 2008, 12:01:18 pm

dates are a bit wierd. they need to be reformatted so mysql will accept it.

check: CRM/Event/Form/ManageEvent/EventInfo.php, line 226

follow the same pattern as start_date

if you did that and it still does not work, add debug statements to the function create. I would suspect that you did not add the new field to all the places in DAO/Event.php

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 19, 2008, 12:34:46 pm
Thanks Lobo

I'm pretty sure I added everything to DOA/Event. I attached...much appreciate it if you could take a look...this is driving me nuts.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customizing New Event page
June 19, 2008, 02:38:57 pm

looked at it briefly and seems it has the right fields (note that we generate DAO's automatically, so we dont really hack that file directly)

Your best bet would be to debug the code at:

CRM/Event/BAO/Event.php, line 112

and see what sql is generated etc. also compare the format of the various dates. mysql is picky with regard to dates

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 19, 2008, 02:55:41 pm
The SQL query has NULL for recurring_date

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customizing New Event page
June 21, 2008, 10:49:16 pm

u'll need to go back a few functions and see what the $params value is and what the recurring date value is. You might want to compare it to start/end date etc

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Customizing New Event page
June 24, 2008, 08:28:48 am
Why didn't you just use custom fields? You can assign a custom field set to events or participants -- the former is for data specific to the event, the latter for people registering for the event.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 24, 2008, 09:55:09 am
Because I need to do validation. I need the recurring_date to be after end_date.

The custom field options are rather lacking, to say the least.

I've since noticed that in ManageEvent/EventInfo.php, in the formRule function

$rdate   = CRM_Utils_Date::format( $values['recurring_date'] );

$rdate has the correct value, but isn't being passed along with $end and $start.

Still confused.

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Customizing New Event page
June 24, 2008, 10:33:36 am
Did you also add it to the postprocess function in that file?

I believe plans are in the works to enable the attachment of javascript to custom fields from within the interface, in one of the upcoming releases. That should improve functionality.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 24, 2008, 11:10:49 am
yes, it's in that function too:

 $params['recurring_date'  ]      = CRM_Utils_Date::format($params['recuring_date']);

I might add that I'm adding recurring event functionality to the Events...or trying. Has anyone attempted this before?

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Customizing New Event page
June 24, 2008, 11:40:52 am
I think it also needs to be added to the properties array in:
CRM/Event/BAO/Event.php
around line 334.

Usually the file that is controlling the form has an associated file in the BAO subdirectory which manages how the field data is inserted/updated in the db.

Good luck with recurring events! I suspect that will present some challenges, given the existing structure.

For what it's worth (and off the top of my head), if were going to try to create a pseudo-recurring event, I would create a custom field that lists the date options for the event (e.g. if I were offering a workshop six times over the course of a year, I would create a custom  field for the participant that shows those six dates. Then when someone registers for the event, they must select which workshop date they are registering for. All registrations are tracked within the single event; you would use the Find Event to search for a specific date within that event.

But I don't know all the details of your structure. Just an idea in case you want to avoid reworking the whole event structure.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customizing New Event page
June 24, 2008, 11:55:05 am

Might be easier to help debug code problems on IRC in real time rather than the forums. Can you get on the #civicrm channel on irc.freenode.net

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 24, 2008, 11:55:35 am
Thanks.

I've added to this file too.

'endDate'         => 'end_date',         'recurringDate'           => 'recurring_date',  ...etc.

I think the problem is I can't find where else I need to place the $rdate variable because I'm basing my knowledge on  the $end and $start variables in the EventInfo.php formRule function....which, btw, are wonderfully unique variable names.

I figured for recurring events I'd just tag each event with a unique ID and loop the INSERT for however many recurrences there are. When editing or deleting an event the user has an option to delete or edit the series, or just the particular event details they're on. I need them to show up in a calendar view as distinct entries..which is partially why I went this way.



lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Customizing New Event page
June 24, 2008, 12:17:47 pm
You indicated you made changes to:
DAO/Event.php

You also need to edit:
BAO/Event.php

(just making sure you got both)

Try hard coding a value for recurring_date to see if it inserts into the DB. If the issue was date formatting, I would think you'd get an error or a weird value inserted. If you're getting null, seems to me the problem is with passing the data to the db, which is why that $properties array is where I'd look first.

-Brian
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

pwnedulongtime

  • Guest
Re: Customizing New Event page
June 24, 2008, 12:30:11 pm
Tried hardcoding a date value...works fine.

I've updated both BAO/Event.php and DAO/Event.php


Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Customizing New Event page

This forum was archived on 2017-11-26.