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 CiviMember (Moderator: Deepak Srivastava) »
  • Automatic Membership Numbers
Pages: [1]

Author Topic: Automatic Membership Numbers  (Read 2313 times)

Tim0705

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.0.5
  • CMS version: Joomla! 1.7.0 Stable
  • MySQL version: 5.0.92
  • PHP version: 5.2.12
Automatic Membership Numbers
October 14, 2011, 01:36:09 am
I have searched this forum for similar posts but with no sucess so apologies if this question has been answered before.

I have just set up CiviCRM on a Joomla CMS website for a charity that I work with. The charity has over 1000 members with each member currently having their own membership number.

I will be transferring the current membership database from excel to CiviCRM using the CiviMember section but I cannot see how I can add memebrship number in. I will also be setting up online memebrship subscriptiona and renewals and would like to automatically asign a new membership number to new joining members in a sequential order. A membership numbers start at 1 and have run up to over a 1000 so we just require the system to automatically seect the next number available.

Can anyone explain, if it is possible, how I can set this up.

Your help is most appreciated.

regards, Tim.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automatic Membership Numbers
October 14, 2011, 01:46:09 am
interesting - i was just talking to eileen about the same issue for a new client of ours. Problem with their dataset is that there are missing rows in the legacy data too - so my plan to just import the memberships in the same order to take care of requirement will mean i need to add a bunch of rows to the old data with the missing ID before commencing. But hoping someone has a cleverer solution for both of us ;-)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

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: Automatic Membership Numbers
October 14, 2011, 09:44:55 am

seems like this comes up often enough for memberships that we might want to consider adding a new column (varchar) to the membership table to reflect membership number.

for the default case, we can just populate membership number == membership id

but a site can implement a hook and set it in the style that suits them :)

If this makes sense, might be good to flush it out a bit more and spec it followed by a patch that implements the spec and tests to ensure the functionality works as speced :). Might be a good code sprint project :)

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

Tim0705

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.0.5
  • CMS version: Joomla! 1.7.0 Stable
  • MySQL version: 5.0.92
  • PHP version: 5.2.12
Re: Automatic Membership Numbers
October 15, 2011, 02:41:30 am
For a novice like myself can you explain this is simple terms or direct me to step-by-step instructions.


Tim.

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: Automatic Membership Numbers
October 15, 2011, 08:10:58 am

Basically this is not supported in the code and my post was more of a suggestion for a future version of civicrm.

Would be great if your org/client could do the needed work and/or sponsor a developer to do so

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

gastrit

  • I post occasionally
  • **
  • Posts: 60
  • Karma: 2
  • CiviCRM version: 4.2.2
  • CMS version: 7.8
  • MySQL version: 5.1.41
  • PHP version: 5.3.2
Re: Automatic Membership Numbers
October 26, 2011, 03:52:59 pm
Hi, I'm also facing this situation.

Maybe we could allow importing contact-ID in the Import function? So one could export contact-id from another system and import them (and related info) to CiviCRM. I believe that today you're only allowed to update records when using contact-id in imports. Is there some specific reason why we can't import also set new contact-Ids? I know that the database field is an auto-inc and it can continue to be either way.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Automatic Membership Numbers
October 27, 2011, 12:09:53 am
Quote
but a site can implement a hook and set it in the style that suits them

I have to say I don't see a lot of variation when we see this request - it's always to keep the previous number system & then 'whatever' from the time it enters Civi. Of course there is a risk that the old system & Civi would have the same number so being able to enter a pre-fix and / or suffix to the civi number / or a value to add to the Civi number would meet most needs



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

sjthespian

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 3
    • The League of Professional System Administrators
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.66
  • PHP version: 5.3.3
Re: Automatic Membership Numbers
October 28, 2011, 12:21:17 pm
I started down this path when we first migrated from our old membership system -- I was going to create a custom field to hold the membership number. I ended up abandoning this and just decided to go with the CiviCRM id instead and to use that as our membership id. Fortunately it's only our existing users where the ID matters, new users can have "whatever the highest existing ID is +1".

In order to do this, I ended up doing the following (this is really ugly... but worked):
  • Import all of my members from the old system letting Civi assign the IDs
  • Wrote a script to remove all of the constraints in the CiviCRM database on contact id
  • Wrote a script to walk all of the data in the old database and remap the CiviCRM contact id to the member ID in the old databse

That last step is the critical one as you have to make sure that you don't get yourself in a state where you have changed some ids and not others. In my case I calculated what the highest id in my existing database and started walking from there down to 1 changing the ids as I went. The challenge is when you run into an id that need to be renumbered but there is already someone there. I ended up using a temporary id (my max + 1) for these.

You have to have at least one other unique value you can use to compare your users, otherwise you will need to have a custom field to store the old member id while you do the remapping. You're done when you can't find any users whose CiviCRM id != the custom field.

I can probably post my code if people want to see it, but I would have to strip it for passwords and any other private data.
Dan Rich <drich@lopsa.org>
    Director, LOPSA - http://lopsa.org/

gastrit

  • I post occasionally
  • **
  • Posts: 60
  • Karma: 2
  • CiviCRM version: 4.2.2
  • CMS version: 7.8
  • MySQL version: 5.1.41
  • PHP version: 5.3.2
Re: Automatic Membership Numbers
October 28, 2011, 02:03:27 pm
Sounds great! Please post!

adshill

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 8
Re: Automatic Membership Numbers
November 21, 2011, 05:37:34 pm
For info, we recently carried this out and I decided to write up the results. We used the contact ID. You can read the results on the Wiki:

http://wiki.civicrm.org/confluence/display/CRMDOC40/Import+previously+assigned%2C+non-consecutive+membership+numbers+as+Contact+ID%27s

Hope this helps (even if its a bit overdue!)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Automatic Membership Numbers

This forum was archived on 2017-11-26.