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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Contact.get + is_deceased
Pages: [1]

Author Topic: Contact.get + is_deceased  (Read 1326 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Contact.get + is_deceased
August 26, 2013, 07:03:42 pm
I just checked & found that by default contact.get returns people regardless of whether they are deceased or not.

It seems perhaps the default should be 'is_deceased' => 0,

Of course then we get into the same problem we have with 'is_deleted' - how do we allow people to get both. Thoughts?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Contact.get + is_deceased
August 27, 2013, 04:17:43 pm
Could you match both with

Code: [Select]
'is_deceased' => array('IN", array(0, 1))

(Combined with the new patch that adds support for IN syntax to Contact.get)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Contact.get + is_deceased
August 27, 2013, 04:44:04 pm
OK - so we agree that it should default to '0' & I should make sure the other syntax is supported on that field?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Contact.get + is_deceased
August 27, 2013, 04:49:14 pm
Makes sense to me. The change should, of course, be added to the changelog. ;)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Contact.get + is_deceased
September 01, 2013, 02:58:08 pm
I did assume (wrongly) that is_deceased was behaving like is_deleted.

is_deceased=0 sounds more logical to me, but we delete the contacts in that case, so that's not a situation I have

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: Contact.get + is_deceased
September 01, 2013, 06:56:13 pm
I like having is_de eased work like is deleted, and Iike Tim's approach to getting either.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contact.get + is_deceased
September 02, 2013, 10:56:46 am
In the CiviCRM user interface, the default seems to list deceased contacts in all search results. So I would rather have the same default behavior in the API. We need consistency between defaults in the user interface and defaults in the API / BAO / etc. And if there is a Display setting or other parameter that changes the default in the user interface I would say it also has to influence the API in the same manner.

If someone does not want to have deceased contacts through a Contact.get call, they should either specify it explicitly or as Xavier does delete the deceased contact.

Tim's proposal make a lot of sense. Is it supported on other attributes such as is_deleted?
cividesk -- CiviCRM delivered ... your way!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Contact.get + is_deceased
September 02, 2013, 02:03:44 pm
I 'expect' Tim's proposal works. That syntax works in quite a few places. As of 4.4 you can use the 'IN' part of it on contact id - as in

civicrm_api3('contact', 'get', array('id' => array('IN' => array(1,2,3,4)));

The syntax isn't tested on other fields for the contact api but the handling that allows the above at least means the BAO receives it in the format it expects for applying 'IN'.

I still lean towards making not dead the default - but I think there is no 'mandate for change' as we don't have consensus here
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Contact.get + is_deceased
September 02, 2013, 02:26:24 pm
Quote from: Eileen on September 02, 2013, 02:03:44 pm
I still lean towards making not dead the default - but I think there is no 'mandate for change' as we don't have consensus here

Agree -- this change is arguably a compatibility-break, and Nicolas's point about API/UI consistency is pretty good, and... without a stronger mandate... it makes sense to keep the status-quo.

antrik

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: .
  • CMS version: .
  • MySQL version: .
  • PHP version: .
Re: Contact.get + is_deceased
November 05, 2013, 11:20:41 am
See also http://forum.civicrm.org/index.php/topic,30518.0.html for somewhat related considerations.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Contact.get + is_deceased

This forum was archived on 2017-11-26.