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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Contributions without transaction ID not working
Pages: 1 [2]

Author Topic: Contributions without transaction ID not working  (Read 4374 times)

civichris

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Contributions without transaction ID not working
May 21, 2013, 06:44:51 am
It's a bug. The list of permissions listed in the upgrade documentation are incorrect - see civiwiki: /confluence/display/CRMDOC43/Upgrade+Drupal+Sites+to+4.3+-+Drupal+7
Specifically: CREATE VIEW, TRIGGER, CREATE ROUTINE, ALTER ROUTINE are new requirements for update to CiviCRM 4.3, the others were needed before on 4.2.x.

You actually need SUPER access. Having TRIGGER is not enough.

Sloppy.

Can replicate readily on Mysql 5.5.31 on a box that I control.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Contributions without transaction ID not working
May 21, 2013, 01:56:06 pm
Can you provide more details on why SUPER is needed and why the specific permissions listed (including TRIGGER) is not enough?
Protect your investment in CiviCRM by  becoming a Member!

civichris

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Contributions without transaction ID not working
May 27, 2013, 10:48:29 pm
I think I've worked it out in the process of accidentally breaking something else.

There's at least one FUNCTION used in CiviCRM:

  CREATE FUNCTION civicrm_strip_non_numeric  ...

and... consequently:

http colon slash slash dev.mysql.com/doc/refman/5.0/en/create-procedure.html
"As of MySQL 5.0.3, CREATE PROCEDURE and CREATE FUNCTION require the CREATE ROUTINE privilege. They might also require the SUPER privilege, depending on the DEFINER value, as described later in this section. If binary logging is enabled, CREATE FUNCTION might require the SUPER privilege, as described in Section 18.6... "

That's my guess anyway. I haven't run through a manual check to test specifically. I can however reliably make the standard installation fail for a user who has ALL PRIVILEGES but not SUPER.

I stumbled across this because I managed to hose our database by creating too many custom field groups and hitting the 64 table Left join limit, so dropped it, restored from backup and found that it's now missing the function because mysqldump's default behaviour is to ignore functions / stored procs. So in nosing through the CREATE FUNCTION doco to try and fix it I found this. But I'll raise another post to ask for help with this as I'm now digressing from the original thread!

Cheers

civichris

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Contributions without transaction ID not working
May 27, 2013, 11:10:34 pm
OK here's the actual SQL AFAICT;

'CREATE DEFINER=`<myciviuser>`@`<MyMySQLServer>` FUNCTION `civicrm_strip_non_numeric`(input VARCHAR(255) CHARACTER SET utf8) RETURNS varchar(255) CHARSET utf8
    NO SQL
    DETERMINISTIC
BEGIN
      DECLARE output   VARCHAR(255) CHARACTER SET utf8 DEFAULT '''';
      DECLARE iterator INT          DEFAULT 1;
      WHILE iterator < (LENGTH(input) + 1) DO
        IF SUBSTRING(input, iterator, 1) IN (''0'', ''1'', ''2'', ''3'', ''4'', ''5'', ''6'', ''7'', ''8'', ''9'') THEN
          SET output = CONCAT(output, SUBSTRING(input, iterator, 1));
        END IF;
        SET iterator = iterator + 1;
      END WHILE;
      RETURN output;
    END'

Note that it's creating a DEFINER which is in the list identified on that MySQL page as requiring super privs.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Contributions without transaction ID not working
May 28, 2013, 09:23:09 pm
@civichris can you think of a better way to achieve what we're trying to do with the phone_numeric field? Perhaps using a sql function is not the best option if it requires extra permissions.
Try asking your question on the new CiviCRM help site.

civichris

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Contributions without transaction ID not working
May 29, 2013, 03:33:25 am
Umm. This is stock civicrm installation and stock civicrm code / sql? So not sure how to interpret your comment?

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Contributions without transaction ID not working
October 16, 2013, 11:08:54 am
I think I've found the reason for the "Column 'trxn_id' cannot be null" error - if you have logging enabled. I had this error and found that while civicrm_financial_trxn had:

Code: [Select]
  `trxn_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
and no other constraints preventing it from being NULL, by contrast in the logging db, log_civicrm_financial_trxn had:

Code: [Select]
  `trxn_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'unique processor transaction id, bank id + trans id,... depending on payment_method',
I changed the latter with:

Code: [Select]
ALTER TABLE log_civicrm_financial_trxn MODIFY `trxn_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL;
- taking the definition from the former. This fixed the problem for me.

Cheers,

Dave J

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contributions without transaction ID not working
October 16, 2013, 12:59:30 pm
hey davej:

seems like logging is still a work in progress :)

i think trxn_id changed the constraint in 4.2 but this change was not reflected on existing log table. IN general i dont think we do a great job with keeping the logging tables in sync with the main schema with regard to changes. Would be good to at least fix this specific instance in 4.4.1. Any chance u can work on this and commit a PR

basically if logging is enabled, we need to alter the log table, check:

CRM/Upgrade/Incremental/php/FourThree.php (search for: log_civicrm_line_item)

for some examples

thanx

lobo

lobo
« Last Edit: October 16, 2013, 01:02:58 pm by Donald Lobo »
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Stuart Parker

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 2
  • CiviCRM version: 4.5.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.63
  • PHP version: 5.2.14
Re: Contributions without transaction ID not working
October 17, 2013, 01:09:23 am
Thanks Dave for finding the solution to this.  ;D Yes, I have been using logging tables. I didn't think to try turning them off. Presumably your fix will sort out the civicrm_contribution table too.

Stuart

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Contributions without transaction ID not working
October 18, 2013, 06:55:31 am
Hi Stuart,

Quote from: Stuart Parker on October 17, 2013, 01:09:23 am
Thanks Dave for finding the solution to this.  ;D Yes, I have been using logging tables. I didn't think to try turning them off. Presumably your fix will sort out the civicrm_contribution table too.

On the site where I encountered this error, it only occurred for the civicrm_financial_trxn table. I didn't make any changes for civicrm_contribution, the trxn_id field in the logging table for that was already allowing NULL for trxn_id:

Code: [Select]
show create table log_civicrm_contribution;
...
  `trxn_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method',

Cheers,

Dave

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Contributions without transaction ID not working

This forum was archived on 2017-11-26.