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) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Location being deleted from database when an event is deleted
Pages: [1]

Author Topic: Location being deleted from database when an event is deleted  (Read 1223 times)

leapywca

  • Guest
Location being deleted from database when an event is deleted
October 28, 2009, 06:40:51 am
When we delete an event that was created using a "previous location", it deletes the location from the database. And it removes this location from other events that use it.

any ideas on how to fix this?

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: Location being deleted from database when an event is deleted
October 28, 2009, 07:31:00 am

This is a bug.please file an issue and we'll fix for a future release

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

online_p

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.2.3
  • CMS version: Drupal 6.2.0
  • MySQL version: 5.0.92
  • PHP version: 5.2.9
Re: Location being deleted from database when an event is deleted
December 13, 2011, 07:11:01 am
Was this ever fixed?
I can't find a bug report with this description.
Thank you,
Paul

hbergin

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 6
  • CiviCRM version: 3.4.5 to 4.4.1
  • CMS version: Drupal 6.28 to 7.23
  • MySQL version: 5.5.34
  • PHP version: 5.3.10
Re: Location being deleted from database when an event is deleted
December 13, 2011, 10:24:37 am
I just did the following on a CiviCRM v3.4.5 installation, and did not lose the address on the other events:

1) Create an event with a location
2) Copy and rename first event (copy 1)
3) Copy and rename first event (copy 2)
4) Check that events copy 1 and copy 2 'Use existing location'
5) Delete event copy 2 (Address remains on first event and copy 1)

I then also deleted the first event (where the address was originally entered), and the address remained on event copy 1.

online_p

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.2.3
  • CMS version: Drupal 6.2.0
  • MySQL version: 5.0.92
  • PHP version: 5.2.9
Re: Location being deleted from database when an event is deleted
December 13, 2011, 10:45:20 am
I'm getting addresses lost on 3.2.3
Perhaps you're suggesting an upgrade will alleviate the issue?
I just want to make sure there aren't any patches out there first.
Thank you for your reply

hbergin

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 6
  • CiviCRM version: 3.4.5 to 4.4.1
  • CMS version: Drupal 6.28 to 7.23
  • MySQL version: 5.5.34
  • PHP version: 5.3.10
Re: Location being deleted from database when an event is deleted
December 13, 2011, 02:52:34 pm
I had a quick look at the 'deleteEventLocBlock' code in 3.4.5 and in 3.2.3 on source forge (file /civicrm/CRM/Event/BAO/Event.php).  I didn't spot any difference between the function code in the two versions.  I also didn't spot an obviously matching issue when I had a quick look in the issue tracker, so perhaps someone else may be able to shed more light and may know of a patch. 

Do the same steps I did on 3.4.5 reproduce the error consistently for you on 3.2.3?  I ask because I had an older instance of CiviCRM (3.2.0) and following the same steps I did on the 3.4.5 instance, the event location was not lost either, so I'm thinking there may be a different set of steps you do to reproduce the error.

Code: [Select]
    /**
     * Function to delete the location block associated with an event,
     * if not being used by any other event.
     *
     * @param int $loc_block_id    location block id to be deleted
     * @param int $eventid         event id with which loc block is associated
     *
     * @access public
     * @static
     *
     */
    static function deleteEventLocBlock( $locBlockId, $eventId = null )
    {
        $query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = $locBlockId";

        if ( $eventId ) {
            $query .= " AND ce.id != $eventId;";
        }

        $locCount = CRM_Core_DAO::singleValueQuery( $query );

        if ( $locCount == 0 ) {
            require_once 'CRM/Core/BAO/Location.php';
            CRM_Core_BAO_Location::deleteLocBlock( $locBlockId );
        }
    }

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Location being deleted from database when an event is deleted

This forum was archived on 2017-11-26.