title: Importing relationships

text:
# Question
Title: Importing relationships
I have a set of custom relationships I need to import against, but the import mapping dropdowns are only showing the three default relationships:

Employee of.. Family member is.. Household member is..

Any ideas? I cannot see any options on the custom relationship settings i need to change. We are using CiviCRM 4.6.2 (recently upgraded)

# Answer
> 3 votes
Thanks Paul - it turned out that relationships needed to be set up at contact type level, not as a contact sub type in order for the relationships options to be displayed in the import screens.

So where contact sub types had been set up on earlier versions of civi, the relationship had to be changed to conctact type leve i.e

individual to individual not Individual (parent) to Indiviudal (child)

The relationship names can stay the same just not the level.

---
Tags: import, relationships
---


# Question
Title: How to fetch CiViCRM events externally [ Drupal 7]
I'm new to CiViCRM. I want to fetch events which are created in CiViCRM which is hosted on another server. So basically I want to fetch CiViCRM data from one individual site to my site. I don't know that which are the ways to do it and which is the best one. But I think Rest option would be good if I'm not wrong. I'm not able to find any similar example which is near to my task. All I don't understand that how should I use my rest url with code:

1. Option 1:

```
$api = new civicrm_api3(array ('server' => 'http://localhost/abc',
    'api_key'=>'123456789',
    'key'=>'123xyzABC'));

```
2. Option 2:

```
 $contactxml =       simplexml_load_file("http://localhost/abc/sites/all/modules/civicrm/extern /rest.php?entity=contact&action=get&key=<site    key>&api_key=$apikey&last_name=Koot");
 foreach ($contactxml->children() as $contact) {
   $display = $contact->display_name;
 }

```

Is there any other options. I want to go for option 1 if that is possible. And I want response in JSON if possible.

# Answer
> 2 votes
The wiki page http://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface pretty much describe what you could do with rest.

From the wiki page :

> Before the REST interface can be used, two things have to be set up:
>
> * You need to know your site key which can be found in the civicrm.settings.php file labelled CIVICRM\_SITE\_KEY.
> * You will need to enter an API key for every user that will be allowed to use the REST interface. (See below)

Then you will have to call an url like :

```
https://www.example.org/path/to/civi/codebase/civicrm/extern/rest.php?entity=event&action=get&key=your_site_key&api_key=the_user_api_key&json=1

```
* Option `json=1` will give you result in json format instead of xml
* You may need to use `&options[limit]=xxx` if you want more than 25 results

Every options available in the api should be available in REST but need to be converted in the proper URL syntax. The wiki page give you some good examples of standard api call vs REST api call.

---
Tags: rest, drupal
---


# Question
Title: Is there a Civicrm hook for new contact/user insert?
I want to create new users in Drupal 7 whenever there is a new contact created from the civicrm.

Also, how can I use the civicrm primary email address as a username in the Drupal 7?

Please suggest

# Answer
Check out this post, which uses CiviCRM Entity and Rules to create Drupal users when Civi contacts are created.

Within the CiviCRM Entity module, check out the function `civicrm_entity_action_create_user()` to see how the username is set. You could patch it to implement a way to choose a username field/pattern, rather than hard-coding it to the Civi Display Name field.
> 2 votes

---
Tags: drupal, civicrm-entity
---


# Question
Title: How do you update participant status without affecting contributions?
I have a bunch of event attendees who were marked "pending from pay later." Due to issues with their accounting departments we didn't have cheques by the time of the event, but since they are trustworthy partners we allowed them to attend. I updated the participant statuses to "attended" so we could send thank-you letters, but now they are all marked as having paid. This is going to take a lot of manual work to confirm if anyone has yet to pay.

For the immediate concern: is there a way to check for participants with payment type "check" and "check number" blank?

Is there a way to prevent this from happening in the future? Ideally, participant status and contribution status would be independent, especially from the bulk update window, or I could be prompted with a "Would you like to mark the contribution as complete as well?"

# Answer
Ben -

To your immediate question, you should be able to use the search builder (Search \> Search Builder) to search for payments where the check number is empty (or null - it might be safest to search both ways).

You didn't indicate your version of Civi but it is usually possible to update participant status without recording payment - I doublechecked this quickly on the 4.5 demo site by searching for participants and selecting "Change Participant Status" from the actions menu; when I changed the status to Attended from Pending from Pay Later, no payment was recorded. (Thinking ahead, you may want to add a different status to distinguish users who attend without paying, so you can easily find them later for collecting payment.)

Hope this helps, Lesley
> 4 votes

---
Tags: civievent
---


title: Best practices for "lookup" variables

text:
# Question
Title: Best practices for "lookup" variables
I am getting ready to move our organization to CiviCRM. We have many values that are "codes" that show in our current system via lookup tables.

For instance, the value in the database for a chapter might be "SC" whereas what is displayed is "Some Chapter"

We anticipate that this would be the "Some Chapter" group in CiviCMS but that it would also be used as grouping in reports.

So, as I move our info, is it better to retain the "SC" code, or should I convert them to "Some Chapter" as I do the export?

# Answer
> 2 votes
This is an opinion-based question, but for a better experience for your users, I would use the "Some Chapter" version for your group name, rather than the code. In the back end, groups are all stored as numbers anyway. And using a human-readable version means that you don't have to deal with extra training or documentation to translate your codes for new users.

---
Tags: import
---


# Question
Title: How to fetch CiViCRM events externally [ Drupal 7]
I'm new to CiViCRM. I want to fetch events which are created in CiViCRM which is hosted on another server. So basically I want to fetch CiViCRM data from one individual site to my site. I don't know that which are the ways to do it and which is the best one. But I think Rest option would be good if I'm not wrong. I'm not able to find any similar example which is near to my task. All I don't understand that how should I use my rest url with code:

1) Option 1:

$api = new civicrm\_api3(array ('server' =\> 'http://localhost/abc',

'api\_key'=\>'123456789', 'key'=\>'123xyzABC'));

2) Option 2:

```
 $contactxml =       simplexml_load_file("http://localhost/abc/sites/all/modules/civicrm/extern /rest.php?entity=contact&action=get&key=<site    key>&api_key=$apikey&last_name=Koot");
  foreach ($contactxml->children() as $contact) {
    $display = $contact->display_name;
  }

```

Is there any other options. I want to go for option 1 if that is possible. How to get response in JSON?

Any help would be appreciated.

Thanks

# Answer
Option one: API will be the best option

Please use this link in your instance http://localhost/abc/civicrm/api/explorer or http://d46.demo.civicrm.org/civicrm/api/explorer#explorer

you will get JSON output
> 2 votes

# Answer
It's probably easiest to use a wrapper around that call that hide the complexity.

You can copy api/class.api.php into your client server and use it as indicated in the example in the source:

```
 $api = new civicrm_api3 (array ('server' => 'http://example.org',
                                'api_key'=>'theusersecretkey',
                                'key'=>'thesitesecretkey'));

if $api->Contact->Get(array(
 'contact_type'=>'Individual',
 'last_name' => 'koot',
 'return'=>'sort_name,current_employer'))
{
  // each key of the result array is an attribute of the api
  echo "\n contacts found " . $api->count;
  foreach ($api->values as $c) {
    echo "\n".$c->sort_name. " working for ". $c->current_employer;
  }
  // in theory, doesn't append
} else {
  echo $api->errorMsg();
}

```

should fetch from the remote civicrm server and let you do the needed with the data on your client server
> 2 votes

---
Tags: drupal, civicrm-home, rest
---


title: Can discounts be combined?

text:
# Question
Title: Can discounts be combined?
I'm using the CiviDiscount extension and it works great - thank you.

Is it possible to combine an auto-discount (e.g. for qualifying logged-in members) and a manually entered discount (e.g. entered on an event registration page) combine? It's not working for me at the moment but am wondering if it's my set up or if this option is not available.

# Answer
To the best of my knowledge, the CiviDiscount module only allows one discount to be applied. So you may want to consider utilizing one manually entered discount code that adds up to the total discount you're hoping to give (presumably only to certain members?).

Hope this helps, Lesley
> 3 votes

---
Tags: cividiscount
---


# Question
Title: Multiple Roles in WordPress and CiviCRM access rights
By Default WordPress only lets users/admins set a single role per user. This is done by a dropdown on the user's profile (in WP).

However, additional roles can be added, either by using a plugin or with custom code. This works fine on the WP side granting the user the capabilities of all roles that they are added to.

The question is how does CiviCRM handle this? Does it read all roles and give the user the rights of all roles? I am testing this now, but would like any insights from others that have done this.

What have others done in this case? I don't want to create a ton of WP roles and even though CiviCRM ACLs are available, the end user won't be able to manage that.

# Answer
> 2 votes
I did testing today on this and from what I can tell, when setting a second user role in WP CiviCRM will read the security settings from both roles. It is optimistic security in that if one of the user roles has 'administer CiviCRM' and the other does not, the user can administer CiviCRM.

# Answer
> 0 votes
Not a WP expert but there are settings per role via this url wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Faccess%2Fwp-permissions&reset=1

which you also find via Administer \> Users and Permissions \> Permissions (Access Control) and then a link near the top to "WordPress Access Control"

---
Tags: wordpress, roles
---


title: How to retriev tag information via sql

text:
# Question
Title: How to retriev tag information via sql
I am working on a report and part of the requirement is to have pull the list of tags per individuals, households and organizations. I was able to pull the groups by using civicrm\_group\_contact and civicrm\_group tables and join by id. I see a table in civi called civicrm\_tag, it contains list of tags but I don't know how to connect it with the associated records or identify the people assigned to theses tags.

Thanks in advance

Regards

Edward

# Answer
> 2 votes
The table is `civicrm_entity_tag`; make sure you use a WHERE or JOIN to ensure that entity\_table = 'civicrm\_contact'.

# Answer
> 0 votes
If you are only pulling the list of tags per individual.., check out the search builder; /civicrm/contact/search/builder?reset=1

---
Tags: tags
---


title: How to search for Event Custom fields?

text:
# Question
Title: How to search for Event Custom fields?
Civi4.6.4 WP 4.2.2 I have a custom field for all Event Types called "Featured"(yes/no). We will have many events created and only a few will be "Featured"(Yes). So is there a way in the Manage Event List to search for just the "Featured" Events?

# Answer
> 1 votes
you can create a new report, go to Reports-\>Event Reports, click on New Event Report, Select Income Count Summary Report, you can customize the report and if the featured field is searchable you will find it here. Hope this helps

---
Tags: civievent
---


# Question
Title: Paid event but Pricing Options can not be required but they must chose a fee
Civi 4.6.4 and WP 4.2.2 I have an Event(3 day Conference) with 6 pricing options. The first is for the Full conference with different prices for a Member, Certified Member, and Non-Member. AND there are 5 other price options for daily activities with pricing options again for Member, Certified Member, and Non-Member. I can't make any of the pricing fields required since they can choose any of the options. My problem is, though, that they must pick one, but don't know how to make this happen.

# Answer
> 1 votes
My non-code way of (almost) solving this is to include a zero price "no-selection" option such as "I not attending the full event" or "I have selected a different workshop" in each price field and make each price field compulsory.

My experience has been that people forget to tick anything, rather than deliberately choose not to make a selection, so forcing people to make a selection for each field has worked for us.

I should point out that I have only done it with 3 sets of price options, and I didn't get any flack about making people tick so many boxes. I don't know how people would have reacted if they had been forced to make 6 "selections".

The "almost" in the first sentence is because each year we still got one or two out of 1000 people who chose the "no-selection" option in every set. I set up a smart group for people with a registration value of zero and sent them a standard email alerting them to that fact.

---
Tags: price-sets
---


title: Donor wall in CiviCRM

text:
# Question
Title: Donor wall in CiviCRM
Does CiviCRM ship with or have an extension for a donor wall? If so, how well does it work? If not, what is a good solution for creating and managing a donor wall that will work with CiviCRM installed under WordPress?

# Answer
> 1 votes
For wordpress I think you will have to write some custom development. I tried to use a search profile for this but found it was lacking. Perhaps you can figure it out but with drupal there are many possibilities. The code reference is very old but may get you part way there. I think this would be a great extension if you have funding.

---
Tags: extension
---


# Question
Title: Missing Contacts from Mailing Labels in Civi 4.4
We have a Civi 4.4.14 installation. When choosing the Make mailing label action from search results 5 contacts are missing from the finished labels.

I've recreated the error on the 4.4 demo site but see that it is fixed in the 4.5 and 4.6 sites.

The site currently uses the civibooking extension which doesn't work with 4.5 or 4.6, so an upgrade isn't (currently) an option.

Does anyone have a patch/ fix for this?

Cheers

Craig

# Answer
> 1 votes
How are you trying to reproduce the problem? Are you just running a search and comparing the number of labels to the number of results? If so, you should expect to have fewer labels because CiviCRM will automatically exclude contacts with "do not mail".

If that's not the issue, try looking at what shared attributes the excluded contacts have. If it is a bug, an important step to replicate and fix the issue is to know what kinds of contacts go missing (or alternatively if it's a new random group dropped on each search run).

---
Tags: search-results, address-labels
---


# Question
Title: PCP confirmation email doen't contain user-login details. [ Drupal ]
After creating a PCP page this email (message template) is sent to user who has contributed and created a PCP page.

> Dear supporter,
>
> Thanks for creating a personal campaign page in support of **\[Contribution page name\]**. Promoting Your Page
>
> You can begin your fundraising efforts using our "Tell a Friend" form:
>
> ```
> Login to your account
> Click this link and follow the prompts
>
> ```
>
> Managing Your Page
>
> Whenever you want to preview, update or promote your page:
>
> ```
> Login to your account
> Go to your page
>
> ```
>
> When you view your campaign page WHILE LOGGED IN, the page includes links to edit your page, tell friends, and update your contact info.
>
> Questions? Send email to: info@example.org

My question here is,

How user can login to site since I see that there is no new user created on the site. I am not sure how this works for other but without any user creation they won't be able to login to site or edit their PCP page.

Please correct me if I am missing something here, I think user should be created and one-time-login url should be sent to user on the same email (message template).

# Answer
> 4 votes
Site had a configuration **Who can register accounts?** as `administration only` because of which I was not getting the screen where the user will be created before you fill PCP informations. After I changed the settings everything seems to be working fine.

Configuration page link: `example.org/admin/config/people/accounts`

---
Tags: drupal, message-templates, system-workflow-messages
---


title: Contacts update

text:
# Question
Title: Contacts update
I have problem updating contacts data.

I know it has to do something with Dedupe rule that I have to use but I don't know how to ensure myself that I won't have duplicates.

# Answer
Try to simplify in every way possible, until the 500 Server error no longer occurs. Then progressively make small changes to what you are doing (moving towards what you actually want to do) until the problem reoccurs. By doing this you will isolate the precise trigger of the problem.

Some things to try:

1) Use the default dedupe rule or an "email only" dedupe rule and try to import one new contact with just a minimum of information - perhaps just one new email address. Does that give a 500 error?

2) Try importing one new contact with name, email and address, while using different dedupe rules. Does the dedupe rule you use make a difference to whether the 500 occurs?

3) Try the same, but with information matching (exactly or partially) an existing contact.

A 500 error shows that something is going wrong in a way that civi has not anticipated might go wrong.
> 1 votes

# Answer
Damir, have you had a look at the user guide's information on deduping? Also this page has a lot of information on deduping including importing contacts.

As Jonathan has already mentioned, you need to be a lot clearer on what your problem is and which approaches you have already tried to solve the problem.
> 0 votes

---
Tags: contacts, import
---


# Question
Title: Create event participate using OOP API in CiviCRM
There are 2 different sites in Drupal. In one of them there is CiviCRM is installed. Now I want to create event participate from first site which will use CiviCRM of second site. I have successfully get the list of events from second site to first site using:

```
$api = new civicrm_api3 (array ('server' => 'http://localhost/civicrm', 'api_key'=>'xxx', 'key'=>'xxx'));

if ($api->Event->Get()) {
    print_r($api);
} else {
    echo $api->errorMsg();
}

```

Now I want to create event participate using OOP API in CiviCRM. So I have create code something like that:

```
$params = array(
        'contact_id'    => 1,
        'event_id'      => 2,
        'status_id'     => 1,
        'role_id'       => 1,
        'register_date' => '2007-07-21',
        'source'        => 'Online Event Registration: API Testing',
        'event_level'   => 'Tenor'
);

if ($api->Participate->Create($params)) {
    print_r($api);
} else {
    echo $api->errorMsg();
}

```

But in response I'm getting: **API (Participate, create) does not exist (join the API team and implement it!)**

So is it still in development? any other way to do that?

# Answer
> 2 votes
I think you have a typo. Please try `$api->Participant->Create($params))` and let us know the result.

You can see an example here: https://github.com/civicrm/civicrm-core/blob/master/api/v3/examples/Participant/Create.php

---
Tags: drupal, civicrm-entity
---


# Question
Title: What can I do to fix my database that has been partially upgraded?
I have run into this problem on two of my websites that run Civicrm separately. Both are running version 4.5.8. When I run the automatic installer, the update process seems to freeze for an infinite amount of time and quits updating the database and all of the core files. With one of my sites, I was able to make a backup of the database prior to the error and reverted back to version 4.5.8, however, I wasnt able to make a backup of the other and now I am unable to update Civicrm at all, and it gives random errors when running certain tasks. I also am presented with the following error: "Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again."

What can I do to fix my database so that I can be able to update CiviCRM in the future or is there a way to bypass the database check and have it update CiviCRM without further error?

# Answer
This is a tricky one to resolve yourself. You basically need to identify whereabouts in the upgrade it failed. For example it might have done all the tasks for a particular point version & failed afterwards, or it might have run some sql & not completed.

If you look in the db the civicrm\_domain table has a field called version. Once you know where it got to you can go through the sql statements in that version's upgrade & figure out which ones it did & didn't complete - eg.

https://github.com/fuzionnz/civicrm-core/blob/4.6/CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl

There are also php functions so you need to evaluate those too https://github.com/fuzionnz/civicrm-core/tree/4.6/CRM/Upgrade/Incremental/php

Once you know where it fell over you can evaluate what needs to be applied to get it to the next point version. Once you have done all the things the upgrade script would have done to get to the next point version you can alter the value in civicrm\_domain.version to the next point version & remove the upgrade & then start the script running again
> 6 votes

# Answer
You can effectively reset the database structure by following the "Ensuring Schema Integrity" steps. Instructions are at http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades

This may cure the problems you're experiencing, or it may (via error messages!) illustrate where the database is no longer conforming.
> 2 votes

---
Tags: upgrade, database
---


# Question
Title: I need an online registration that contains multiple venues for an event
We are a not for profit organisation that runs masterclasses & Seminars across Australia. I need an event online registration page that the member selects the venue they want to attend from a list that states Venue, Day, Date, Time

# Answer
> 1 votes
Making a lot of assumptions here ... you could have a single event configured without enabling the location. Then use a priceset with each item in the priceset matching a location - set it to required.

e.g. "Select a Location" Canberra - $75 Melbourne - $75 Darwin - $75

You'll end up with a master list of all registrants, getting a list of registrants by location requires a price set report, either custom or in the Extended Reports extension.

# Answer
> 0 votes
Rather than trying to create one very complicated event in Civi, think of an Event as having two requirements: a place and a date/time. It may also have pricing (or not). Create an event for each class/seminar in each location. Otherwise you can expect to spend lots of time troubleshooting your pricing setup, and will have even more difficulty later when it's time to turn that mess of data into useful reporting or follow-up marketing.

Don't force Civi to be your event listing page by shoe-horning lots of real-life events into one pseudo-event. Instead let your CMS create the listing page, with links to register for the desired event. This could be a simple 15-minute exercise (using Drupal Views), or it could require some code or expense (a custom WordPress page or plugin). But you'll be better off in the end.

---
Tags: civievent
---


title: Event absences triggers an email?

text:
# Question
Title: Event absences triggers an email?
Given a weekly class that registers students into repeating CiviCRM events as a way to record attendance, is there a way to trigger an email to the teacher if a student is absent a set number of consecutive weeks?

I looked briefly at the new CiviRules extension, but didn't see such functionality.

In addition, something similar could be done manually by searching for contacts who are in the class, but who were not registered, for example, in the last three weekly events.

But, ideally, I'm looking for a automated solution.

# Answer
Thank you for all the help!

Ultimately, I believe I will use the following:

* Attendees are registered for a weekly event.
* Custom search smart group which includes class roster group, but excludes those who were present at least once in the last month.
* Report cron job to email these results on a monthly basis.

While it isn't *exactly* what I originally thought I needed, it works well enough to see those absent in the last month.

The key for me was realizing I could use a report to automatically email the data.

Thanks again!
> 2 votes

# Answer
I don't think there is a straight forward way to do this.

It **may** be possible if you register the entire class list for all the classes (events) and then set the participant status to "No-show" when a student misses a class. Then you might be able to do something by shuffling students between a series of groups - "no-show this week", "no-show this week & last", "no-show three consecutive weeks" using CiviRules and sending a weekly "Constituent summary" report to the teacher restricted to the people in the "no-show three consecutive week" group.

However, if you have more than one class you would need three groups for each class so you could get to an unmanageable number of groups fairly quickly.

Also, I am not sure if the existing conditions and actions in CiviRules would be enough for this purpose or if you would need to create additional conditions and/or actions
> 4 votes

# Answer
The two tools in Civi that can help you automate this are scheduled reminders and repeating events.

First create a single event and on the "Schedule reminder" tab configure a reminder for no-show attendees like so:

Then set up your event to repeat every week. Each weekly event will inherit this scheduled reminder setting.
> 2 votes

# Answer
Sometimes you just have to use spreadsheets!

In one tab, I would create a list of students that are supposed to attend. Export the attendants for each event, and add to the spreadsheet as a new tab, create a name range for the exported names. In the original tab do a look up (VLOOKUP) for each event in a separate column. You'll be able to see at a glance who has attended. You can also add a column to count the number of events attended.

I've used this method in the past to ensure all employees have entered time.
> 0 votes

---
Tags: civievent
---


# Question
Title: Why does Sourceforge not have the 4.6.5 files?
Sourceforge shows the latest release 4.6.5 for Drupal 7 but the files are 'not found' if you try to download them. Also Sourceforge shows the headline latest release to be 4.6.4. What's going on?

# Answer
Sourceforge had a major failure on 7/16 and their services have been slowly coming back online. Expect to see CiviCRM downloads working normally again soon.

In the meantime you can get the latest version directly from http://civicrm.org/download
> 2 votes

---
Tags: drupal
---


# Question
Title: CiviCRM Membership Status Change Summary Report
What is the best way to use CiviReports to show how many members changed from grace -\> expired in a given month (summary), not detail report.

# Answer
> 4 votes
When a Membership changes Status an Activity of type "Change Membership Status" is created, and for your example, has the Subject of "Status changed from Grace to Expired". These factors can be used either in Find Activities, or Report civicrm/report/instance/3, or in Drupal to make a View, and if we use Aggregation, to get summary statistics as requested in the question.

I decided to give the latter a Proof of Concept and have attached it. IF this is useful to you (or anyone) please consider 'giving back' (and forward) by chipping in to our project to get CiviCRM working fully with Drupal 8 ;-) http://www.fuzion.co.nz/civicrm/contribute/transact?reset=1&id=4.

Hmm can't see how to attach file so have put in the Fuzion Treasure Chest at http://www.fuzion.co.nz/blogs/getting-summary-stats-membership-status-changes-view

And in order to fully answer the question, if you use the Views CiviCRM Dashlet module described here you should be able to set it up on your dashboard https://civicrm.org/blogs/brandonferrell/drupal-views-civicrm-dashlets

# Answer
> 1 votes
Membership Summary report doesn't provide the information you're looking for out of the box. Is there a reason that using the Membership Detail report or Activity report and just using the "Statistics" section at the bottom doesn't meet your needs?

If you're committed to this path, you can write a custom report based on the existing Membership Detail or Activity report that doesn't show any results, just the "Statistics" section.

---
Tags: civireport
---


# Question
Title: How do I hide exposed filter options in Drupal View?
Using CiviCase and need to hide two case status' that we aren't using from Drupal Views exposed filters (Pending and Urgent).

Pending and Urgent are disabled in the CiviCRM Case Status UI.

Just want end users to see Ongoing and Resolved as options.

# Answer
Accomplished using Better Exposed Filters.

Went to BEF Settings, scrolled down to "More options for status"

Expanded Rewrite filter options

Under Rewrite the text displayed added

Pending|
Ongoing|Ongoing
Resolved|Resolved
Urgent|

Results in only Ongoing and Resolved as options.

Loved Better Exposed Filters prior to using this feature, now if you could alphabetize options I could get some sleep!
> 2 votes

---
Tags: civicase, drupal-views
---


# Question
Title: How to model and report on unintentional underpayment and overpayment?
The type of underpayment or overpayment I have in mind is as follows. An organisation signs up for a membership valued at £100, opting to pay later. So there's a pending pay-later contribution for £100. They send a cheque for £90 or £110. This is not an intentional extra £10 donation or partial payment: they just sent the wrong amount.

The common-sense solution might be to tell the member they sent an incorrect payment and ask for a correct one. Sadly the membership organisation doesn't want to do that, they want to record that an underpayment or overpayment was made and carry this forward.

They also want to be able to report on a set of contributions, seeing the amount due and the amount received.

I know that there have been relevant changes to Civi core as part of the CiviAccounts project, e.g. Phase 1 Implementation - Data Structure Changes, aimed at distinguishing 'commitments to pay' from 'payments'. I understand that some parts have been implemented, e.g. partial payment for events, but others not.

What isn't clear to me is whether or how this infrastructure can be made use of in current Civi 4.6 for the above scenario. Or whether, as things stand, we need to use an alternative approach such as...

1. Add a custom field on Contribution for Amount Received.
2. Add a custom field on Contribution for Amount Over/underpaid.
3. Record a separate positive or negative contribution for over or underpayment.
4. Suggest that this information is best recorded outside Civi, in an accounts package.

This section of the CiviContribute documentation sounds relevant:

> For example, a fund raising dinner that charges $100/person may now allocate the true costs toward the relevant accounts i.e. $75 donation posted to the Income account named "Donations" and the $25 Cost of Sales account to "Event Fees".

However I'm not clear whether that is the right thing to do in this case or how the person recording the payment would do it.

CiviCRM 4.6, Drupal 7.

*Edit 31 July 2015:* adding relevant details of the use case, which I foolishly omitted to keep things simple...

Each contribution may actually cover several items: 2 memberships, donation, fees, recorded with different financial types via price sets. The membership organisation wants a report showing, for each contribution, the membership, donation & fee elements as well as total due, amount received and amount of any over/underpayment.

I like the idea, in @JoAnne's answer, of changing the contribution amount from e.g. £100 to £90 when the £90 cheque is received: looked like this might allow a custom report to compare amount due (from line items) with amount received. Sadly the contribution edit form doesn't allow changing the contribution amount when the contribution has line items. I tracked this down to `templates/CRM/Contribute/Form/Contribution.tpl`, line 97:

```
{if $action eq 2 and $lineItem and !$defaultContribution}
  (...then view total instead of showing edit field...)

```

I assume this was done for good reason: Civi wants to keep the contribution amount consistent with the line items and it wouldn't know which line item to alter. So for underpayment, looks as though the admin would need to record an additional negative contribution for the amount underpaid.

# Answer
> 4 votes
With respect to the overpayments, I don't know whether this will fit standard British accounting practices but I'd be inclined to create a separate financial type for the overages - a holding fund, if you will - and record one payment for the membership fee and one for the overage. They could then add an adjustment transaction the following year to move those funds from the overage account to the subsequent year's membership fee; that would make what happened and why abundantly clear to any auditors who review the financials later. That would also enable searching/reporting on that financial type. (I have at least one client that does this when they receive overpayments.)

Regarding underpayment, perhaps the membership could be kept in pending status until the total amount has been collected; those pending members could be added to a smart group that could be used to filter contribution reports to find how much they've paid toward their membership, send email reminders, etc.

That may not get you 100% toward where you want to go but hopefully it's a start.

# Answer
> 2 votes
The quote from the documentation is perhaps alluding to the fact that you can create a price set where the various options can be allocated to different financial types, but I don't believe it is relevant for your situation where you already have a contribution record for the membership.

I agree with Lesley's suggestion of a separate financial type for overpayments.

If you don't want to keep a membership that is underpaid as pending then my non-code solution for underpayments would be as follows (assumes financial type for membership payments is Member Dues):

* Create an "Overdraft" financial type
* Create a new payment instrument of "transfer"
* When a cheque comes in for less than the full amount:
    + Record the cheque against the pending contribution changing it to completed
    + Record contribution for the amount not paid with financial type of "Member Dues" and paid by "transfer"
    + Record contribution of -(amount not paid) with financial type of "Overdraft" and paid by "transfer" .

If you like to have every contribution with the financial type of "Member Dues" linked to an actual membership, then you can "renew" the membership to record the additional $10 "payment" then edit the end date appropriately.

It is not exactly a speedy procedure, but does mean that the contribution records reflect the true situation.

---
Tags: civicontribute, civireport, accounting
---


# Question
Title: Is it possible to use Windows & Cygwin to run Selenium tests or does Selenium require a VM?
I know documentation suggests using a virtual machine w/Windows, but I don't know anything (yet) about Selenium /limitations so am asking

# Answer
Selenium testing can refer to a couple different situations:

* A. If you focus on *implementing custom sites for clients*, then you might create a custom Selenium test-suite which encompasses the configurations/customizations/addons. Basically everything in the tool-chain is at your discretion. Use Selenium (or something else!). Use Civi tarballs (or zipballs or `git`!). Use Windows (or not!).
* B. If you focus on *developing changes for `civicrm-core`*, then you're looking at the `WebTest` suite which is used for canonical QA of official releases. This comes with more rules/constraints, e.g. you need to install Civi from `git`.

In situation A, the testing methodology has little to do with Civi. Any tool or method for testing general webapps should work the same with Civi. So I'm assuming that you're interested in situation B -- the `WebTest` suite in `civicrm-core`.

The basic process of running the `WebTest` suite is the same on any platform:

1. Install Apache/MySQL/PHP/Composer/Java/Git/NodeJS/Bower/Drupal.
2. Install the desired version of Civi (from git).
3. Setup various config files for the test suite -- most notably `civicrm.settings.local.php` and `CiviSeleniumSettings.php`.

I've done #1 and #2 many ways on many platforms (OSX + Ubuntu + Debian + WinXP + Win7, in bare metal and VMs and containers), and I've done step #3 most places (albeit not Windows). Steps #1 and #2 on Windows are PITA -- mostly because they're not standardized (which makes them hard to document/automate/maintain).

Or to give it an upbeat spin: If you can get through step #1 and #2 to a produce a working git-based installation on Windows/Cygwin, then the Selenium bits in #3 will be easy by comparison.
> 4 votes

---
Tags: testing
---


title: Use Taxamo as a payment pre-processor

text:
# Question
Title: Use Taxamo as a payment pre-processor
The new 2015 VAT regulations of the EU are tough and Taxamo seems to offer a solution. The way it works is that Taxamo sits in the middle of the chain - between your site and the payment gateway. Taxamo integrates with payment gateways such as Paypal and Stripe.

The trouble is, then, to get CiviCRM talk to Taxamo. I don't know of any payment processor extension for CiviCRM that can do that. So I was wondering if anyone has an idea how to get a CiviCRM payment form work with Taxamo.

Thanks in advance!

P.S. The real need is to be VAT/MOSS compliant. I just don't know anything other than Taxamo that can automate that. If you know, please share.

# Answer
This would be implemented as a payment processor extension. There is not a current extension written for Taxamo, but the documentation for implementing one can be found here.

They also say (at the bottom of this page) that you can contact them to see about getting plugins developed for additional shopping carts, the "cart" being a Civi payment page in our case here.
> 2 votes

---
Tags: taxes
---


# Question
Title: User provided ratings of events and directory members
Has anyone created a way for users to provide feedback in the way of ratings similar to the product reviews on Amazon or Angie's List? There are two scenarios where we may be looking to do something like this.We are working in a WordPress install with Version 4.6.4 of CiviCRM

1. A recurring class, workshop or other event. Past attendee feedback so prospective attendees could decide if it is good for them.
2. A directory listing where service providers could be rated to help visitors make a choice on who they may contact.

Just looking to see if anyone had done something like this before we dive in.

# Answer
Under Drupal, you could do this with civicrm\_entity to link a Drupal entity with your CiviCRM entity. There's also the abandoned `civicrmentity` (no underscore) which lets you add Drupal fields directly to a CiviCRM entity without a corresponding Drupal entity.

AFAIK there's no equivalent functionality in Wordpress, so you'll have to find a Civi-native approach. You may want to get in touch with this person to get the self-service CiviEvent update functionality into core - then you could add a "rating" custom field for participants to fill out after a class. From there, a simple extension to calculate an average rating on the event would be trivial.

Doing this for contacts is a little trickier natively. I might try to do it using a new activity type - "created by" would be the user submitting the rating. "With" would be the person being rated. Again, you'd need an extension to average/count the ratings.
> 1 votes

# Answer
For the event rating, you may want to create a custom post type, and add a custom field to link it to a corresponding CiviCRM event, and then set up a plugin that allows post ratings.

For the user rating, what about creating WP user records for the service provider contacts? The you could use something like Users Ultra Membership Plugin to have the WP users receive ratings.

It's not ideal, but it's all I could come up with, that doesn't involve serious Civi extension writing.
> 1 votes

---
Tags: civievent, wordpress
---


# Question
Title: AJAX problem in CiviCase - Administer Case Types
I'm getting the same effect as reported here. I'm trying to set up CiviCase, and all seems fine except when I try to Administer-\>CiviCase-\>Case Types I just get blank screen. The JavaScript console shows a series of errors as shown below. I've been through all the standard trouble-shooting things, and am stumped now.

Joomla 3.3.6, CiviCrm 4.6.5

Any ideas much appreciated. Thanks.

Javascript console output:

option=com\_civicrm&task=civicrm/a/:109 Uncaught SyntaxError: Unexpected

?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=0KJad:5 Uncaught TypeError: Cannot set property 'userFramework' of undefined (anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=0KJad:5 (anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=0KJad:5

?option=com\_civicrm&task=civicrm/ajax/angular-modules&format=js&r=0KJad:11 Uncaught TypeError: Cannot read property 'modules' of undefined(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/angular-modules&format=js&r=0KJad:11(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/angular-modules&format=js&r=0KJad:19

?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/oQmyf7Hm:110 Uncaught TypeError: Cannot read property 'resourceBase' of undefined(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/oQmyf7Hm:110(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/oQmyf7Hm:111

angular.js:38 Uncaught Error: \[$injector:modulerr\] http://errors.angularjs.org/1.3.17/$injector/modulerr?p0=crmApp&p1=Error%3A…vicrm%2Fbower\_components%2Fangular%2Fangular.min.js%3Fr%3D0KJad%3A17%3A381)(anonymous function) @ angular.js:38(anonymous function) @ angular.js:4154q @ angular.js:326g @ angular.js:4115bb @ angular.js:4041d @ angular.js:1455xc @ angular.js:1476Od @ angular.js:1370(anonymous function) @ angular.js:26438m.Callbacks.j @ jquery.js:3148m.Callbacks.k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503

# Answer
OK, I found the problem. It was the same issue as reported here. It wasn't a CiviCRM problem at all. The JavaScript errors were caused by the K2 component, which alters the HTML output after CiviCRM does. K2 was passing text containing quotes (specifically 'prefix="og: http://ogp.me/ns#"') to JavaScript, so these quotes ended up unescaped. More info here. The solution was to apply this patch to K2 (or, in my case, to remove K2 altogether, since we decided not to use it).
> 0 votes

---
Tags: civicase, ajax
---


title: My dashbord - error

text:
# Question
Title: My dashbord - error
Using Civicrm 4.6.5 on joomla 6.6, when selecting "My \`Dashboard on the left panel this error appear backTrace

```
#0 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#4 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#5 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...", "DB_Error", TRUE)
#6 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column '0LEFT' in 'on clause'")
#7 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#9 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#10 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#11 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#12 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(1221): CRM_Core_DAO->query("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...", TRUE)
#13 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Query.php(4624): CRM_Core_DAO::singleValueQuery("SELECT count( DISTINCT ( civicrm_activity.id ) )  FROM civicrm_contact contac...")
#14 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Activity/Selector/Search.php(216): CRM_Contact_BAO_Query->searchQuery(0, 0, NULL, TRUE, FALSE, FALSE, FALSE, FALSE, NULL)
#15 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Selector/Controller.php(233): CRM_Activity_Selector_Search->getTotalCount(4, NULL)
#16 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Activity/Form/Search.php(283): CRM_Core_Selector_Controller->__construct(Object(CRM_Activity_Selector_Search), NULL, NULL, 4, Object(CRM_Activity_Form_Search), 1, "activity_")
#17 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Activity/Form/Search.php(119): CRM_Activity_Form_Search->postProcess()
#18 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(455): CRM_Activity_Form_Search->preProcess()
#19 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()
#20 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Activity_Form_Search), "display")
#21 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Activity_Form_Search), "display")
#22 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")
#23 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Activity/Page/UserDashboard.php(62): CRM_Core_Controller->run()
#24 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Activity/Page/UserDashboard.php(75): CRM_Activity_Page_UserDashboard->listActivities()
#25 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php(180): CRM_Activity_Page_UserDashboard->run()
#26 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php(207): CRM_Contact_Page_View_UserDashBoard->buildUserDashBoard()
#27 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Contact_Page_View_UserDashBoard->run((Array:2), NULL)
#28 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:14))
#29 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:2))
#30 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm.php(116): CRM_Core_Invoke::invoke((Array:2))
#31 /home/coursede/public_html/accueil/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
#32 /home/coursede/public_html/accueil/libraries/cms/component/helper.php(392): require_once("/home/coursede/public_html/accueil/administrator/components/com_civicrm/civic...")
#33 /home/coursede/public_html/accueil/libraries/cms/component/helper.php(372): JComponentHelper::executeComponent("/home/coursede/public_html/accueil/administrator/components/com_civicrm/civic...")
#34 /home/coursede/public_html/accueil/libraries/cms/application/administrator.php(98): JComponentHelper::renderComponent("com_civicrm")
#35 /home/coursede/public_html/accueil/libraries/cms/application/administrator.php(152): JApplicationAdministrator->dispatch()
#36 /home/coursede/public_html/accueil/libraries/cms/application/cms.php(252): JApplicationAdministrator->doExecute()
#37 /home/coursede/public_html/accueil/administrator/index.php(47): JApplicationCms->execute()
#38 {main}

DB Error: no such field

```

any explanation ?

Regards

# Answer
You've found a bug - it looks like a typo (a missing space), which is easy enough to fix. Unfortunately, you've left out some of the information needed to fix this. Please edit your post with the error info that appears BELOW the words "DB Error: no such field", which will contain the full SQL statement that failed - right now we can only see a snippet, which doesn't include the broken part.
> 1 votes

---
Tags: dashboard
---


title: Sorting by clicking on column headers

text:
# Question
Title: Sorting by clicking on column headers
I'm evaluating CiviCRM for my organization and noticed something about the demo report tables that concerns me. Hopefully I'm just missing something. Do I have to create a new report or modify an existing one in order to change the sort order of a field? For example, I'd like to view the Contribution Details report and quickly sort it by amount, but when I click on the amount column header, nothing happens. Why can't I sort by amount by clicking on its column heading? Did CiviCRM used to have that capability but there was a bug that caused problems, so you took it out?

# Answer
> 5 votes
How a report is sorted is defined in the Report Criteria. Depending on what data the report looks at, you can sort of different criteria. It's usually called something like "Order by columns" and appears below the Selected Columns. Reports generally sort in date order.

If you want to play about with the data, the easiest thing to do is export to CSV and save in Excel so you can sort, filter and build graphical representation of your data as you wish.

# Answer
> 3 votes
Something I did once was to apply DataTables to the output of a CiviReport, adding the necessary JS in the template. That let me sort by whatever column. It was a bit of a hack though. Not a good idea if your report has an alterDisplay function (eg. to make a contact name into a link to that contact). I also had to override CiviReport's limit() function so DataTables would see all the rows. But now I understand CiviReport a bit better as to what I can put in the configuration array.

# Answer
> 2 votes
I can't explain why the Column Headers trigger a 'mouseover' action that makes it look like you should be able to click to sort. But if that is 'how it is' and if you are using Drupal, it can be pretty quick to fire up a View that gives you the same columns and which is click sortable.

# Answer
> 0 votes
I'm reasonably sure that this is a feature available in CiviCRM 4.7 (the upcoming release, in 2-3 months) - I'm pretty sure that during the code sprint in Colorado, the DataTables plugin was applied to tables to address this. I haven't seen it in action though!

---
Tags: civireport, evaluating-civicrm
---


# Question
Title: I need to migrate data from one CiviCRM on Drupal instance to a clean one. HELP?
The person who was supposed to be maintaining my CiviCRM on Drupal instance flaked on my a while ago and my site has been sitting vulnerable. Due to hosting changes, I decided to just set up a clean new instance on the new host but I need help as to how best to move the Civi records (and also config if possible!) over considering my old MySQL database may have been compromised.

Help! Thanks a lot!

# Answer
Before pronouncing the old database deceased, I would make sure the structure is correct and if not what is broken. You can try this: https://github.com/progressivetech/civi-schema-harmonizer or http://wiki.civicrm.org/confluence/plugins/servlet/mobile#content/view/86213632. The current dB may be ok.
> 4 votes

# Answer
If you wish to transfer the content of the database a) export the existing data. You can do this as an action from the search/find screens. Export contacts, activities, memberships, contributions as separate files. b) on the new system, import each file. Use the old contact\_id field as the external\_identifier to help all the records match up.

This is easy in concept, not so easy in practice! If you have custom fields, you'll need to recreate them. If there are custom option lists, those will also need to be recreated ... as well as member types, financial types (if custom), etc.

So .. if you can, stick with moving the database. If necessary, you can roll up the sleeves and expect to spend quite a bit of time exporting and importing.
> 3 votes

# Answer
Sounds like you may be in over your head. I recommend hiring a professional to help you with this.

In general, questions on this site should be in the realm of "I understand X and Y but have a question about Z" rather than "I need you to walk me through X Y *and* Z and I haven't really read A B or C either." Your question sounds more like the latter category but it might just be the way it's worded. If you disagree, please feel free to edit your question to show more of your research and understanding of the migration process, and the specific step you need assistance with.
> 1 votes

# Answer
Agree with Coleman. It should be possible to get an audit done of your old civi db to look for any suspicious data and based on that determine if your db can be copied over or whether the data needs a full export/import. We are just about to rip in to a site that was compromised as a result of DrupalGeddon to see if we can assure ourselves and the client if the civi data is 'clean'. We will probably document how that went in case it is of help to others in the future.
> 1 votes

# Answer
Here's some tips that helped me when I had issues with a db that wouldn't upgrade due to errors.

My original database was stuck at 4.3.3 and had gone through many upgrades and a couple times had some errors on the upgrade. Even after switching to civihosting my 4.3.3 database gave a trigger error that triggers weren't enabled. We (Hershel and I) determined that it had to be with the db. So I got the bright idea to compare the structures of the corrupt db with a clean 4.3.3 structure. Here are the steps I took:

1. I did a structure dump of the Corrupt DB minus the custom tables. I imported the civicrm.mysql file from the 4.3.3 build into a clean db
2. I did a structure dump of the clean import and then compared the files using a Diff tool.
3. There were alot of issues that confirmed for me it was the db. I ensured that all column names matched between the two db's.
4. I then did a structure dump of the custom tables in the corrupt db, then a data dump of the custom tables in the corrupt db, then a data dump of all the other tables in the corrupt db.
5. Then I imported into the clean db in the following order: the structure of the custom tables, the data of the custom tables, the data of the other tables.
6. Then I ran the upgrade to 4.3.5 and it upgraded without any errors
> 1 votes

---
Tags: drupal, database, mysql, migration
---


# Question
Title: How can I most easily import Activities and Contacts together?
I'm working on some scripts to export data from our current CMS (a custom in-house tool) to CiviCRM. This is a first import, and CiviCRM is a blank slate.

When importing activities it seems like the "Source Contact" column must be a civicrm ID.

I think this means I have to first import all the contacts, then pull a mapping from their CiviCRM ID to their external ID, and then import activities with the source contact column updated to match the CiviCRM ID.

Of course, this is entirely feasible, but if there's a simpler way to do this I'd love to know about it.

# Answer
If it's a new civi installation (with no contacts) it's not bad because all of the external identifiers are available.

I don't know of a way to do them in one fell swoop.

We typically import contacts using their old id as the external identifier and then import the activities.
> 3 votes

# Answer
If you are on Drupal you can use the Eileen's CiviMigrate module to pull in the Contacts and the Activities. It still is effectively two runs of the import, since the Contacts 'have' to be created first, but the Migrate method lets you easily tweak, rerun, destroy, tweak, rerun etc

You can read a blog about the process here
> 2 votes

---
Tags: import
---


# Question
Title: How do I make dropdowns work on CiviCase edit case type?
I upgraded from 4.5.8 to 4.6 and wanted to start exploring CiviCase. I think I've poked at it a little bit in the past without this problem, but may be wrong. After enabling the component, I go to Administer-\>CiviCase-\>Case Types and create a new type or edit one of the existing types. On the edit screen, the "Add role" and "Add activity" boxes don't do anything when I click on them.

I'm running Joomla.

This works on the joomla demo site. I notice in the source code there, that early on jquery is loaded:

```
<link rel="stylesheet" href="/administrator/components/com_civicrm/civicrm/css/angular-crmCaseType.css?r=ztjZx" type="text/css" />
<script src="/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>
<script src="/media/jui/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/administrator/templates/isis/js/template.js?09064904c3098f5b2b2e8bc1eb2d9972" type="text/javascript"></script>
<script type="text/javascript">
var CRM = {"config":{"isFrontend":false},"crmMailing":{"civiMails":[],"campaignEnabled":true,"groupNames":[{"id":"1","title":"Case ...and a lot more raw scripting

```

In my installation, jquery is never loaded. It loads:

```
<link rel="stylesheet" href="/administrator/components/com_civicrm/civicrm/css/angular-crmCaseType.css?r=bLDq0" type="text/css" />
<script src="/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="/media/system/js/core.js" type="text/javascript"></script>
<script src="/media/system/js/modal.js" type="text/javascript"></script>
<script type="text/javascript">

    window.addEvent('domready', function() {

        SqueezeBox.initialize({});
        SqueezeBox.assign($$('a.modal'), {
            parse: 'rel'
        });
    });
</script>
<script type="text/javascript">
var CRM = {"config":{"isFrontend":false},"crmMailing":{"civiMails":[],"campaignEnabled":false,"groupNames": ... and a bunch of raw script.
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/jquery-ui/jquery-ui.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/lodash-compat/lodash.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.mousewheel.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.tableHeader.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.textarearesizer.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.form.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.timeentry.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.blockUI.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/DataTables/media/js/jquery.dataTables.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/jquery-validation/dist/jquery.validate.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.ui.datepicker.validation.pack.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/Common.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/crm.ajax.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.menu.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.jeditable.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/jquery/plugins/jquery.notify.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/jquery/jquery.crmeditable.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/crm.optionEdit.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/crm.joomla.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/?option=com_civicrm&task=civicrm/ajax/l10n-js/en_US&r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular/angular.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-route/angular-route.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-file-upload/angular-file-upload.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmApp.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmAttachment.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmAutosave.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmResource/all.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crm-ui.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/packages/ckeditor/ckeditor.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crm-util.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-jquery-dialog-service/dialog-service.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-ui-utils/ui-utils.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-ui-sortable/sortable.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailing.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailing/directives.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailing/services.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailingAB.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailingAB/directives.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmMailingAB/services.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/d3/d3.min.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmD3.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/angular-crmCaseType.js?r=Fv3Zh">
</script>
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/noconflict.js?r=Fv3Zh">
</script>

<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=tc945">
</script>

<!--[if IE 7]>
<link href="templates/bluestork/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if gte IE 8]>
<link href="templates/bluestork/css/ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>

```

**Note:** the last instance of the jquery.min.js script is the one I added, which seems to fix the problem.

At http://forum.civicrm.org/index.php/topic,36265 there's discussion of jquery being moved in this version...is this related?

In my browser console I see:

```
TypeError: undefined is not a function
at b     (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:6971)
at O.initContainerWidth (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:7155)
at O.initContainer (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:12997)
at O.init (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:1:19472)
at HTMLInputElement.<anonymous> (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:31011)
at Function.m.extend.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:2975)
at m.fn.m.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:835)
at a.fn.select2 (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:30756)
at crmCaseType.directive.link (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/js/angular-crmCaseType.js?r=bLDq0:104:18)
at $ (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/angular/angular.min.js?r=bLDq0:70:197) <span crm-add-name="" crm-options="relationshipTypeNames" crm-var="newRole" crm-on-add="addRole(caseType.definition.caseRoles, newRole)">

angular.js:11655 TypeError: undefined is not a function
at b (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:6971)
at O.initContainerWidth (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:7155)
at O.initContainer (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:12997)
at O.init (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:1:19472)
at HTMLInputElement.<anonymous> (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:31011)
at Function.m.extend.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:2975)
at m.fn.m.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:835)
at a.fn.select2 (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:30756)
at crmCaseType.directive.link (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/js/angular-crmCaseType.js?r=bLDq0:104:18)
at $ (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/angular/angular.min.js?r=bLDq0:70:197) <span crm-add-name="" crm-options="activityTypeNames" crm-var="newActivity" crm-on-add="addActivityType(newActivity)">

angular.js:11655 TypeError: undefined is not a function
at b (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:6971)
at O.initContainerWidth (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:7155)
at O.initContainer (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:12997)
at O.init (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:1:19472)
at HTMLInputElement.<anonymous> (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:31011)
at Function.m.extend.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:2975)
at m.fn.m.each (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/jquery/dist/jquery.min.js?r=bLDq0:2:835)
at a.fn.select2 (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/select2/select2.min.js?r=bLDq0:2:30756)
at crmCaseType.directive.link (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/js/angular-crmCaseType.js?r=bLDq0:104:18)
at $ (https://deepgreenresistance.org/administrator/components/com_civicrm/civicrm/bower_components/angular/angular.min.js?r=bLDq0:70:197) <span crm-add-name="" crm-options="activityTypeNames" crm-var="newActivity" crm-on-add="addActivity(activitySet, newActivity)">

24angular.js:11655 TypeError: undefined is not a function
at b (select2.min.js?r=bLDq0:2)
at O.initContainerWidth (select2.min.js?r=bLDq0:2)
at O.initContainer (select2.min.js?r=bLDq0:2)
at O.init (select2.min.js?r=bLDq0:1)
at HTMLSelectElement.<anonymous> (select2.min.js?r=bLDq0:2)
at Function.m.extend.each (jquery.js:384)
at m.fn.m.each (jquery.js:136)
at a.fn.select2 (select2.min.js?r=bLDq0:2)
at ui-utils.min.js?r=bLDq0:7
at angular.js:16299angular.js:11655 (anonymous function)angular.js:8596 $getangular.js:16302 (anonymous function)angular.js:4924 eangular.js:5312 (anonymous function)

```

# Answer
> 2 votes
If CiviCRM's jQuery never loaded at all, you'd be having a lot more problems than just that one screen. It's hard to tell because in your second snippet, you cut it off just when things were getting interesting. The line starting with `var CRM = ...` is the *start* of CiviCRM's scripts, and jQuery and other plugins should be just a few lines down from it.

So (guessing from incomplete information) I'd say that's not the problem, and you have some other javascript error on your site. Have you looked in your console for errors?

Have you gone through the steps at Troubleshooting popups, autocompletes, or other javascript problems?

# Answer
> 0 votes
Do you have K2 installed? If so, there is an incompatibility between K2 2.6.9 and CiviCRM, which caused JavaScript errors. If you do have K2, then you need to install a patch. See my other related post here.

---
Tags: civicase
---


# Question
Title: KCFinder in https context doesn't browse
First of all, I use CiviCRM 4.6.2 with Drupal 4.7 My website works with a ssl certificate, so the url is https://www... In CiviCRM I try to send a new email. In The text editor there is a button to insert or edit an image. It open KCFinder but when i click on "browse" to browse and find an image, it doesn't work. In the Google Developer Console it says : "Mixed Content: The page at 'https://www.xxx.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?opener=tinymce&cms=civicrm&type=image' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Oxygen:400,300,700'. This request has been blocked; the content must be served over HTTPS."

I understand this message but I don't know how to fix it... Any advise ? Regards, HashKey

# Answer
I changed http to https in my theme css and the message disappeared.

Now there's still one error.

I changed the editor from tiny or CKE to "default drupal editor". And it WORKS !
> 1 votes

---
Tags: images
---


# Question
Title: Firing a hook on smart group status change?
The use case I have is as follows:

An organization has multiple chapters, and it's important to record which chapter the person is in. For a variety of good reasons (e.g. ACLs), chapters are represented by adding the contact to a group. When adding a contact to a group, a `hook_post` in an extension fires, and fills out a custom field with the name of the chapter they're in.

However, the chapter of a member is determined by location, so we want to move to using smart groups that can automatically classify contacts into chapters. However, when a user is added via Smart Group, the hook doesn't fire, and the custom field's not filled in.

Any suggestions? I'm open to reorganizing the data - but the users would really like to have folks automatically classified into chapters by geography (zip code ranges, etc.) and so I think this requires that chapters be set by smart group. It's OK if an answer requires coding, I'm civix-savvy.

This site is using CiviCRM 4.4.16, Wordpress 4.2.2.

# Answer
I think we have a client where a postcode look up (on Contact save) triggers creation of a Relationship being made. The Relationship connects the Individual to the Regional Group (contact of type Org'n). You could then use our Relationships as ACL extension to run your 'access rules' from. I will ping JoAnne to comment further if she can.

From JoAnne: I'll add to this rather than comment.

There is a table in the db linking every postcode/suburb combination to one of the 200+ organisations of type "local group".

The initial relationship is created when a person signs up for a specified membership type.

With any change in a member's primary address, the relationship is re-checked. If warranted, that relationship is ended and a new one created with the new local group.
> 1 votes

# Answer
Use a post hook on Address instead? You could even have that hook take care of the group move as well as the custom field move. Editing someone so that they meet Smart Group criteria probably wouldn't cause an update hook right away because the content of a smart group is only updated when someone looks at it (and that lookup exceeds the cache timeout).
> 0 votes

---
Tags: extension, hooks, smartgroups
---


# Question
Title: Capture country field selection with JS/jQuery
I have developed a site for a client that uses a profile to capture address and contact information for event registrations using CiviEvent. One of the fields on the registration form is a 'Country' field. There is a requirement from the client to fill in another form field with a default value based upon the Country selected. I have done similar things with jQuery in relation to other fields on the form, but the country field widget is quite complicated and I can't quite figure out how to target the user's selecting a country and get the country value with jQuery. I am sure there must be some code in CiviCRM that does this, in order to display the correct set of state/province fields based upon the country selection. But I have not been able to locate such code. Can anyone give me any pointers in terms of where I can find the CiviCRM code that does this, or sample JS/jQuery code that will detect the country field selection on a profile form? Note that this is on CiviCRM 4.6.2.

Many thanks, -Ian

# Answer
> 2 votes
The select2 is indeed complicated but you don't need to go there. The underlying select element is still there (just hidden) and still fires regular "change" events and you can still get it's value using the ordinary `$(element).val()` jQuery.

---
Tags: profile
---


# Question
Title: Update contact via REST and JSON request body
We are trying to update a contact via the REST API. But instead of submitting the changed values as separate post parameters (e.g. "nick\_name")

```
http://d46.demo.civicrm.org/sites/all/modules/civicrm/extern/rest.php?api_key=myscretapikey&key=sitekey&json=1&version=3&contact_id=2&entity=Contact&action=create&nick_name=Kathy

```

we want to submit the **whole contact** JSON object with its changed values as part of the **request body**:

```
POST http://d46.demo.civicrm.org/sites/all/modules/civicrm/extern/rest.php?api_key=myscretapikey&key=sitekey&json=1&version=3&contact_id=2&entity=Contact&action=create
Content-Type: application/json
{ "id":"2", "contact_type":"Individual", "contact_sub_type":"", "do_not_email":"0", "do_not_phone":"0", "do_not_mail":"0", "do_not_sms":"0", "do_not_trade":"0", "is_opt_out":"0", "legal_identifier":"", "external_identifier":"", "sort_name":"Adams, Kathleen", "display_name":"Kathleen Adams", "nick_name":"Kathy", "legal_name":"", "image_URL":"", "preferred_communication_method":["3"], "preferred_language":"", "preferred_mail_format":"Both", "hash":"163700750", "api_key":"", "first_name":"Kathleen", "middle_name":"", "last_name":"Adams", "prefix_id":"", "suffix_id":"", "formal_title":"", "communication_style_id":"", "email_greeting_id":"1", "email_greeting_custom":"", "email_greeting_display":"Dear Kathleen", "postal_greeting_id":"1", "postal_greeting_custom":"", "postal_greeting_display":"Dear Kathleen", "addressee_id":"1", "addressee_custom":"", "addressee_display":"Kathleen Adams", "job_title":"", "gender_id":"1", "birth_date":"1979-03-17", "is_deceased":"0", "deceased_date":"", "household_name":"", "primary_contact_id":"", "organization_name":"", "sic_code":"", "user_unique_id":"", "created_date":"", "modified_date":"2015-05-14 06:03:56"}

```

Mostly this seems to work, but we have some issues. Is this an official way to update a contact? And if not, which would be a better one?

# Answer
> 5 votes
Please, do not put the api\_key nor key into the get parameter, to they don't end up in logs and other places, they are better as a post param.

As for your question, you can have json="{'id':2..."} as a param, ie json encode the whole contact and put as as a string param into a (post) json param

You might be safer to return only the modified param, as some are likely to be ignored (eg. the modification\_date) or might expect a different format when modified than read (less and less a problem, but you might bump into edge cases still)

---
Tags: contacts, api, rest
---


# Question
Title: Can I use tokens in Civi profile Cancel Redirect URL?
Custom profile to edit a contact's activity.

Redirect URL is formed: **www.example.com/activities/{contact.id}** and works correctly.

I'd like to use the same redirect for Cancel Redirect URL. Is it possible? Are tokens supported in the cancel url or do I have to set a static page for cancel?

# Answer
I'm pretty sure that token availability is the exception rather than the rule. You shouldn't expect tokens to be replaced in the redirect URL.
> 1 votes

---
Tags: profile, redirect
---


# Question
Title: How to show Civicrm Event in fullcalendar?
In drupal view i want to show civicrm events and selecting display format is Fullcalendar ....Error is showing Display "Page" requires at least one date field." I am taking fullcalendar module version 7.x-2.0 and FullCalendar jQuery plugin version 1.5.0. I am not getting any solutions from anywhere.

# Answer
> 2 votes
There was an Extension built that says it integrates with Drupal FullCalendar https://civicrm.org/extensions/event-calendar-extension but it doesn't show a release version for civi since 4.4

Otherwise if you are wanting to do this directly with Drupal Views have you tried enabling the CiviCRM Entity module to see if that can help you?

And there is now a sample View that works with 4.6 with civicrm\_entity enabled here

# Answer
> 1 votes
You might want to read this issue and fix here:

https://www.drupal.org/node/1888812

In general for drupal modules and drupal specific errors, asking on the drupal forums / issue queue might be a better solution

---
Tags: drupal
---


# Question
Title: Create a Personal Campaign Page links to a page that does not exist
When I enable the "Create a Personal Campaign" within the contribution page manager, the link to share to create a personal campaign page is provided at the bottom of the contribution page manager as shown here:

The link provided leads to a Page Not Found error:

This is the link https://lofcenter.org/civicrm?page=CiviCRM&q=civicrm/contribute/campaign&action=add&reset=1&pageId=1&component=contribute

This is the resulting error:

Any suggestions on how to proceed trouble shooting this error?

# Answer
Please try to create a new page in wordpress and then include CiviCRM component in the wordpress page and then please try the same
> 1 votes

---
Tags: wordpress, contribution-page
---


# Question
Title: Why do Smart Groups now give database errors?
I just updated from 4.6.3 to 4.6.5, on Joomla. I have a number of Smart Groups which worked fine before, but now inconsistently fail to load contacts or settings, giving a database error instead. The error seems related to building the cache, so I assume the inconsistency comes from whether or not it's refreshing the cache entry.

The database query that causes problems is:

```
SELECT id, cache_date, saved_search_id, children
FROM   civicrm_group
WHERE  id 0
  AND  ( saved_search_id != 0
   OR    saved_search_id IS NOT NULL
   OR    children IS NOT NULL )

```

Clearly "WHERE id 0" is invalid syntax. The problem seems to be with changes to the CRM/Contact/BAO/Query.php code. The function addGroupContactCache used to create a clause within the function, something like "WHERE ID IN (4, 7, 10)". Now it calls self::buildClause.

From some debugging I did, buildClause is usually called with "IN" as the $op value, in which case it generates a valid clause. But sometimes the $op value is "=", and it returns that "id 0" clause which breaks things.

The code changes between 4.6.3 and 4.6.5 are complicated enough that I'm not sure how to quick-fix it. Any suggestions to get our smart groups working again are very welcome!

# Answer
> 4 votes
To standardize Get.api and Search form underlying where clause(s), buildClause() fn expects value(s) to be in array(operator =\> array(values)) format \[I call it "Operator as Key" - OK format :p \]. Earlier in prior version most of the Get.api aren't working because the buildClause() was designed according to Search formValues format \[array(values)\], so there is conflict in how the values got retrieved and eventually result into Fatal Error/Empty Value for get.Apis. Whereas in some worst-case scenario the get.Api was only working proper with '=' operator as the buildClause didn't got the flexibility to work with any other operator other then '='. But recent changes ( 4.6 onward ) in buildClause expects values atleast for n-nary operators IN/NOT IN in the desired OK format. On the otherhand recent changes has ALSO ensured that the Search Form formvalues processed first into OK format before passing it to build-Clause.

Now back to the bug mentioned here, here's my fix https://github.com/civicrm/civicrm-core/pull/6320. In addition buildClause will also support previous format but will through a e-notice to notify the wrong value format.

---
Tags: smartgroups, issues
---


# Question
Title: Different search results in Adv Search vs Search Builder
We upgraded yesterday from 4.5.8 to 4.6.5 (with Drupal 7.38). We have a number of custom fields for Individuals which are type multi-select (child's grade in school, marital status, etc.). When we search on those fields from the Advanced search screen, the search yields no results. However, if I create the same search in Search Builder, I get results.

**Search Builder example** (this is the only search criteria):

> Individual \> Marriage:Marital Status \> = \> Widow/Widower

I get 16 results.

If I build that same search in Advanced search, I get 0 results.

Any ideas?

I turned on CIVICRM\_DEBUG\_LOG\_QUERY per this post: How can I tell what the query that is executing when I do an Advanced Search looks like?. But, not knowing exactly what I was looking for in the log file, I can't tell what is amiss in the Adv Search.

# Answer
> 1 votes
This is fixed recently fixed against coming 4.6.6 code-base and here's the fix https://github.com/civicrm/civicrm-core/pull/6256/files and https://github.com/civicrm/civicrm-core/pull/6299/files

# Answer
> 2 votes
After you have made your advanced search and get no results, you will stay on the advanced search page.

If you look at the bottom of that page it will say "No matches found for:" and then list the options you have chosen. Can you see anything in there that wasn't related to the options you picked?

I only mention this as I have a similar problem and I can see that the "Preferred Language" field is being set to Afrikaans, so therefore making any advanced searches yield no results.

# Answer
> 0 votes
This was resolved by reloading my 4.5.8 database and code then upgrading to 4.6.4. Not a proper solution because I still don't know why the search results differed, but effective for our production environment. When 4.6.6 comes out, I'll test to see if this is truly fixed.

---
Tags: custom-fields, search, search-results, search-builder
---


# Question
Title: Why don't date selections via the pop-up stick when adding an event?
On events, manage events, add event, on the start date, even though you select a new date from the pop up calendar, the date doesn't change from the current date. This seems to be the same issue with the End date and sometimes when you select the month, the calendar automatically changes the year to 1995 if you key in the date manually, it works.

I am using CiviCRM version 4.5.5 and i have also tested on the demo site currently running 4.5.9 on firefox 39.0 and chrome Version 44.0.2403.107 m

I can file an issue if any other person can confirm this

# Answer
> 1 votes
Changing the month and year in the calendar doesn't have any effect until you click on a date. This can be a little confusing - is that your issue? This UX never seemed quite right to me but it's jQuery UI's thing, not ours.

---
Tags: civievent
---


title: Where/how do you tag an attachment?

text:
# Question
Title: Where/how do you tag an attachment?
Whilst looking at tags for other reasons, I noticed that you can create tags to be **Used for Attachments**.

I haven't found where this is covered in our documentation (certainly not in the section on tags that only refers to tagging contacts, activities or cases).

I can't include it in the documentation, because I haven't come across a situation where I can tag an attachment and I have no idea how it to do it.

If someone can explain when/where/how/why you tag attachments I can include it in the documentation for 4.7.

# Answer
JoAnne -

It seems to me that the most likely scenario for adding/tagging attachments is in the creation of activities - I tested adding a tag for attachments in the demo site, and when I created a meeting activity and opened up the attachment section, the tag field was there: http://screencast.com/t/fNc98uR6Uq

What puzzles me, however, is that there is no apparent way to search for attachments or activities/contacts with attachments (which is different from searching within the attachments, which would be an entirely different ballgame), other than Search Builder (which is somewhat opaque for a lot of the Civi users with whom I work). I see from this message that others have asked the same question - until the attachment tags are searchable, the usability is a bit limited IMHO.

Hope this helps, Lesley
> 3 votes

---
Tags: tags, documentation
---


# Question
Title: CIVI Dashboard display settings broken in Wordpress install
New to CIVI. Working with an install of CIVI in Wordpress. When logged as Admin AND visit the Civi Dashboard, it loads, but displays broken, with settings and displays all over the place. Attached is a screenshot of the 'Manage Events Tab' as an example of what the settings currently look like.

I have checked civicrm.settings.php for BASE URL issues etc, and all is pointing to the correct WP install in the directory.

Has anyone experienced this issue and can shine some much need light on.

Many thanks

# Answer
I would double check the `define( 'CIVICRM_UF_BASEURL' , 'http://example.com/' );` line and make sure that the url exactly matches the `Site Address (URL)` in http://yoursite.com//wp-admin/options-general.php

I've had issues where one is http://www.example.com and the other is http://example.com

Next check the CiviCRM resource URL: http://example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/setting/url&reset=1 The `CiviCRM Resource URL` parameter should point to http://example.com/wp-content/plugins/civicrm/civicrm/

Lastly, I'd fire up Firebug or chrome inspector and see if there are any console errors. I'd want to know which css file is loading for civicrm. For me it is `/wp-content/plugins/civicrm/civicrm/css/civicrm.css`
> 2 votes

---
Tags: wordpress
---


# Question
Title: Create new contacts every time someone makes a contribution ( with duplicate emails )
Currently, we have a `custom profile field` on our contribution page named: "**Designation**" which user need to have, but also we have contributors that make more than one donation and therefore the designation they selected the first time may not be the same the second time they donate.

Can we have a contact created not based on unique email rather based on other fields? because a donor might use the same email id when making the contributions.

# Answer
> 2 votes
Perhaps the answer is to attach the custom field to Contributions rather than Contacts? This way the same contact could make multiple contributions and designate on each contribution (rather than a field associated with their contact record directly) what the designation is.

# Answer
> 0 votes
Yes you can create user based on any field by ignoring email. you can find the option in

Contacts -\> Find and Merge Duplicate contacts

The below link will explain more regarding the issue http://wiki.civicrm.org/confluence/display/CRMDOC/Find+and+Merge+Duplicate+Contacts

# Answer
> 0 votes
In order to assure a new contact is created when the form is completed you want to create an unsupervised rule that cannot reach the threshold to mark as duplicate. This will only work with anonymous visitors (those not logged in). If a user is logged in their information will be updated. Attaching the custom field to the contribution as suggested might be a better approach. You can then get a comprehensive history of contact contributions.

---
Tags: drupal, contribution-page, duplicate-contacts
---


title: Enforce uniqueness of custom field

text:
# Question
Title: Enforce uniqueness of custom field
I created a custom field on groups, which contains a string. When this string is not empty, I want it to be unique. What is the preferred way to do this? Should I implement a hook?

# Answer
I think a hook's the way to go. For non-custom fields you can specify this a little more easily in the XML definition of the field, but for a custom field, I think the hook is your best best.

I think I'd use `hook_validateForm` or `hook_pre`. The first is more user-friendly, but since it's at the form level you have to identify everywhere the field can be edited. It's a fairly easy hook to write though - just make an API "get" call to CustomValue with that value and see if you get a count \> 0.
> 2 votes

---
Tags: custom-fields, hooks
---


# Question
Title: Can a contribution page that has a membership section be forced to create a new membership?
For our use-case, individuals never directly hold memberships, only organizations do, so we force the On Behalf Of Organization part of the contribution page. There's a different contribution page for New Membership than for Membership Renewal, but they both behave identically more or less for users that already have memberships.

We need the New Membership profile to ALWAYS create a new Organization and a new membership for the created org; currently when a logged-in user with existing current or expired memberships goes to the New Membership page, the membership section shows the renewal options instead of the New Membership options. When a user selects "Create A New Organization" and fills in the details, the membership part of the page just picks the existing membership that is uppermost in the Organization Name dropdown and renews it for another year instead of creating a new membership.

Is this the expected behaviour, and can it be suppressed? Is there a URL parameter I can pass in that will force a new membership?

**Edit:**

I should say, this is with version 4.4.10 for Drupal.

It looks like it makes the decision in civicrm/CRM/Member/Form/Membership.php, line 205:

`if ($this->_contactID) {
 //check whether contact has a current membership so we can alert user that they may want to do a renewal instead`

Any thoughts about how to programmatically suppress this without hacking core? My unhealthy temptation would be to do something along these lines:

`if ($this->_contactID AND !($_REQUEST["forceNew"]=1)) {
 //check whether contact has a current membership so we can alert user that they may want to do a renewal instead, check for "forceNew" flag in request params`

which of course would be a maintenance nightmare. Is there a hook I can use instead that will allow me to change the form's behaviour? Unsetting $this-\>\_contactID with a hook sounds unwise, but that's how it makes the call.

Thanks!

# Answer
> 1 votes
I think you can add `cid=0` to your url.

For example, `https://example.com/civicrm/contribute/transact?reset=1&id=1&cid=0` will force the creation of a new contact and new membership even you are logged in and already have a membership.

---
Tags: civimember, contributions, contribution-page
---


# Question
Title: How do you set CiviCRM to be the default page for users in Wordpress?
In Drupal, you can go to **Configuration menu \> Site Information** and set http://mysite.org/civicrm to be the default front page. That way, once a user is authenticated, they're dropped right on to the CiviCRM dashboard. How do you perform an equivalent task in Wordpress?

# Answer
You could try Peter's Login Redirect to set the landing page to /wp-admin/admin.php?page=CiviCRM after successful authentication.

see https://wordpress.org/plugins/peters-login-redirect/
> 6 votes

# Answer
If you didn't want to install a plugin, you could also add a redirect directly to functions.php in your theme. Something like the below would let you redirect only administrators to CiviCRM.

```
function civicrm_login_redirect( $url, $request, $user ){
    if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
        if( $user->has_cap( 'administrator' ) ) {
            $url = admin_url( 'admin.php?page=CiviCRM', 'https' );
        } else {
            $url = home_url('/some-landing-page/');
        }
    }
    return $url;
}
add_filter('login_redirect', 'civicrm_login_redirect', 10, 3 );

```

https://codex.wordpress.org/Plugin\_API/Filter\_Reference/login\_redirect
> 4 votes

# Answer
There is also a plugin available in the WordPress Repository that allows you to set redirects depending on WP user roles. https://wordpress.org/plugins/login-with-ajax/
> 1 votes

---
Tags: wordpress
---