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 CiviCase (Moderator: Dave Greenberg) »
  • Update vs Insert - db question regarding activities within cases
Pages: [1]

Author Topic: Update vs Insert - db question regarding activities within cases  (Read 1430 times)

leapywca

  • Guest
Update vs Insert - db question regarding activities within cases
November 16, 2009, 09:09:54 am
Alright, so first let me start off by telling the steps I took on the site, then we'll talk about the db.
I went to Cases, Case List. I then clicked on one of the active cases in the "summary of case involvement" table at top. After this page came up I clicked "manage case" for the first person in the list. We are now at a page where it has the individuals name at the top and the activities they're in. The relative url is "/drupal/civicrm/contact/view/case?reset=1&id=53&cid=1&action=view&context=search&selectedChild=case"
After this i clicked on "Edit" for a particular activity. This brings us to a page where we can edit details about this person's activity as well as custom data associated with the activity. Relative url: "drupal/civicrm/case/activity?reset=1&cid=1&caseid=53&action=update&id=307"

When here, you change one thing, and click save. Here's my question (maybe this is a bug/issue):

Hitting save inserts a whole new record into the table (I know this because not only did I check that table, but I realized this as I was trying to create a custom report of this data, and the same individual's data kept coming up three+ times). I'm guessing this is because in the code somewhere there's an insert rather than an update? Or maybe it's supposed to be this way? Not really sure. I looked into the code a bit (file: "drupal\sites\all\modules\civicrm\CRM\Case\Form\Activity.php") where I found the function create( $params). I then traced this to "drupal\sites\all\modules\civicrm\CRM\Activity\BAO\Activity.php" and noticed create is only function here - I was hoping to possibly find an update() function. The db table that it's updating is a custom db table titled "civicrm_value_screening_location_and_date_110" Right now there's only one individual in this table, but there are 5 entries (5 rows) for this individual where each entry represents an edit.

Does anyone know if there's a way to make this an update rather than insert? Maybe the functionality exists somewhere else in the API (I dont know the API very well, but I do have a BS in comp sci. I also have a vast knowledge of php - thanks to working on this project! :) )

any help would be greatly appreciated! Thanks!

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Update vs Insert - db question regarding activities within cases
November 16, 2009, 07:24:00 pm
This is "as designed". All activities in Case are revisioned so that an audit trail is maintained of all changes. If you "view" the activity that you edited (click on the Subject) - you'll see a link upper right corner to view prior revisions.
Protect your investment in CiviCRM by  becoming a Member!

leapywca

  • Guest
Re: Update vs Insert - db question regarding activities within cases
November 17, 2009, 05:57:01 am
Ah that makes a ton of sense! Thanks :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • Update vs Insert - db question regarding activities within cases

This forum was archived on 2017-11-26.