CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Multiple Record Print PDF Letter Broke
Pages: [1] 2

Author Topic: Multiple Record Print PDF Letter Broke  (Read 3162 times)

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Multiple Record Print PDF Letter Broke
October 31, 2012, 12:41:44 am
For some reason I cannot select multiple records, and Print PDF letter.

I was able to do it about 6 hours ago, but now nothing.  :o

This is mostly gibberish to me.. can someone help point me in the right direction?

Here's the backtrace..
Code: [Select]
#0 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\Error.php(148): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB.php(968): PEAR_Error->PEAR_Error("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...")
#4 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\PEAR.php(564): DB_Error->DB_Error(-3, 16, (Array:2), "INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...")
#5 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\common.php(1903): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...", "DB_Error", TRUE)
#6 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\mysql.php(898): DB_common->raiseError(-3, NULL, NULL, NULL, "1452 ** Cannot add or update a child row: a foreign key constraint fails (`wp...")
#7 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\mysql.php(327): DB_mysql->mysqlRaiseError()
#8 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...")
#9 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\DataObject.php(2421): DB_common->query("INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...")
#10 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\DB\DataObject.php(1055): DB_DataObject->_query("INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES...")
#11 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\DAO.php(287): DB_DataObject->insert()
#12 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Activity\BAO\Activity.php(289): CRM_Core_DAO->save()
#13 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Contact\Form\Task\PDFLetterCommon.php(361): CRM_Activity_BAO_Activity::createActivityTarget((Array:2))
#14 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Contact\Form\Task\PDFLetterCommon.php(318): CRM_Contact_Form_Task_PDFLetterCommon::createActivities(Object(CRM_Contact_Form_Task_PDF), "", (Array:2))
#15 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Contact\Form\Task\PDF.php(114): CRM_Contact_Form_Task_PDFLetterCommon::postProcess(Object(CRM_Contact_Form_Task_PDF))
#16 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\Form.php(246): CRM_Contact_Form_Task_PDF->postProcess()
#17 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\StateMachine.php(159): CRM_Core_Form->mainProcess()
#18 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\QuickForm\Action\Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Contact_Form_Task_PDF), "next", "Next")
#19 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\HTML\QuickForm\Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Form_Task_PDF), "next")
#20 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\packages\HTML\QuickForm\Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Task_PDF), "next")
#21 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\Controller.php(289): HTML_QuickForm_Page->handle("next")
#22 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm\CRM\Core\Invoke.php(228): CRM_Core_Controller->run((Array:3), (Array:0))
#23 D:\xampp\htdocs\wp-content\plugins\civicrm\civicrm.php(271): CRM_Core_Invoke::invoke((Array:3))
#24 [internal function](): civicrm_wp_invoke("")
#25 D:\xampp\htdocs\wp-includes\plugin.php(403): call_user_func_array("civicrm_wp_invoke", (Array:1))
#26 D:\xampp\htdocs\wp-admin\admin.php(151): do_action("toplevel_page_CiviCRM")
#27 {main}

Here's the Error it's throwing at me..
Code: [Select]
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`wp_civicrm_internal`.`civicrm_activity_target`, CONSTRAINT `FK_civicrm_activity_target_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE), 1452
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 1 ,  1 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`wp_civicrm_internal`.`civicrm_activity_target`, CONSTRAINT `FK_civicrm_activity_target_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 1 ,  1 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`wp_civicrm_internal`.`civicrm_activity_target`, CONSTRAINT `FK_civicrm_activity_target_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_activity_target (activity_id , target_contact_id ) VALUES ( 1 ,  1 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`wp_civicrm_internal`.`civicrm_activity_target`, CONSTRAINT `FK_civicrm_activity_target_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE)]"]
)


Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 12:53:19 am
I should add that i've tried logging out and logging back in.

I've also tried generating the letters with a few different contacts and still nada.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 06:04:03 am
The main part of the message is:

Quote
Cannot add or update a child row: a foreign key constraint fails (`wp_civicrm_internal`.`civicrm_activity_target`, CONSTRAINT `FK_civicrm_activity_target_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`)

which means that it's trying to refer to an activity ID which doesn't exist. Did you delete any activities?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 09:44:23 am
Not that I know of.

So should I just recreate an activity in the database?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 09:46:39 am
No, recreating won't help because IDs are consecutive and never repeated. Seems that activity id 1 is missing. Do you know how to examine your database via phpMyAdmin or similar?

If so, look for the first id in the civicrm_activity table and see if it's NOT 1.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 11:36:11 am
Oddly my activity ID's start at 384.  ???

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 11:47:23 am
I looked at a backup of my database, and it looks like the activities start with 384 on that one as well.. so i'm guessing that's not it.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 11:48:39 am
OK, I'm not sure what happened nor why the code would be attempting to refer to a non-existent record BUT that does seem to be the problem.

Can you try to make a fake record #1 just to see if it will work? :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 11:54:52 am
SUCCESS  ;D Thank you Hershel

I created a new record with ID 1 as suggested, and now it just works... now.. WHY does this work? Seems like something fishy is going on.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 12:06:08 pm
I do not know. Something is fishy but it would probably require a more in-depth analysis of your DB to determine what.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 12:24:36 pm
well.. do we go by the old addage if it ain't broke don't fix it?

or are you really curious?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 12:50:46 pm
Quote from: Maeda on October 31, 2012, 12:24:36 pm
well.. do we go by the old addage if it ain't broke don't fix it?

I suppose "old" is relative. According to this article it's from 1977. :)

Anyhow, yours was broken--now we fixed it. More or less.

Quote from: Maeda on October 31, 2012, 12:24:36 pm
or are you really curious?

No, one dead cat is enough.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Maeda

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.5.16
  • PHP version: 5.3.8
Re: Multiple Record Print PDF Letter Broke
October 31, 2012, 03:43:44 pm
Thanks again Hershel. Our members will be getting their renewal letters on time.  ;D

jcasharpe

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 5
    • Woodlands Church
  • CiviCRM version: 4.4.6
  • CMS version: Drupal 7
  • MySQL version: MariaDB 10.0.13
  • PHP version: 5.5
Re: Multiple Record Print PDF Letter Broke
November 17, 2012, 05:30:24 am
We also saw this issue some time back in our DB. Again the fix was to manually create the activity id that it was trying to use.

jern

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 0
    • SEN Magazine
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28
  • MySQL version: 5.5.40
  • PHP version: 5.4.33
Re: Multiple Record Print PDF Letter Broke
May 21, 2013, 02:08:53 am
Quote from: Maeda on October 31, 2012, 12:41:44 am
For some reason I cannot select multiple records, and Print PDF letter.

Hello. This still seems to be a problem, and is reproducable on the (Joomla) demo. If you select multiple contacts and "Print PDF letter for contacts" with a template, the result is blank. Did anyone ever get to the bottom of this?

Thanks.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Multiple Record Print PDF Letter Broke

This forum was archived on 2017-11-26.