Answers.Body: <p>I guess you have disabled the CiviContribute Component which lead the function to return NULL for account relationship. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-27T18:11:05.477Z
Answers.LastActivityDate: 2017-12-27T18:11:05.477Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>If you can reproduce this [and give us your exact steps] on one of the demo sites (Wordpress or Drupal - <a href="http://dmaster.demo.civicrm.org/civicrm" rel="nofollow noreferrer">http://dmaster.demo.civicrm.org/civicrm</a> - does not really matter) - then this (a Fatal Error) will get prompt attention; There are several code Sprints going on this week - reporting live from Montreal!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-28T14:13:30.553Z
Answers.Text: Thanks for the link, that's really useful. I couldn't reproduce the problem. However I have since found another issue which may be related. I can no longer edit or add Payment Processors. If I try I get an error saying: This financial account cannot have '' relationship. I can't try to reproduce this on the demo as I do not have enough permission to make those changes.
Answers.UserDisplayName: Slingshot Design
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-29T10:58:46.747Z
Answers.Text: Ah - so that sounds like the underlying issue - perhaps somehow some Financial Accounts got deleted?
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-02T09:34:24.793Z
Answers.Text: Thanks for your reply. I've compared all of the *financial* tables with a backup of my database and they are exactly the same apart from 2 extra records in the civicdm_finalncial_account table in the newest database. I tried deleting them but made no difference.
Answers.UserDisplayName: Slingshot Design
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-28T12:23:43.153Z
Answers.LastActivityDate: 2017-09-28T12:23:43.153Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p>Similar issue when CiviContribute is disabled is with price sets: menu for new price set is active, but throws a DB syntax error when new price set is submitted.</p>
  
  <p>See more here: <a href="https://civicrm.stackexchange.com/questions/28371/civimember-price-sets-are-depending-on-civicontribute">CiviMember price sets are depending on CiviContribute?</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-20T19:27:20.223Z
Answers.Text: Thanks Doka - could you expand this to make it clearly an Answer eg "therefore disable Price Sets before disabling CiviContribute"?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-20T13:45:28.247Z
Answers.LastActivityDate: 2019-02-20T13:45:28.247Z
Answers.UserDisplayName: Doka
Body: <p>after upgrading to CiviCRM 4.7.23 for Wordpress I can no longer configure Event Fees and get a DB Error: syntax error.</p>
  
  <p>I tried upgrading to 4.7.24 and still no joy.</p>
  
  <p>The log file contains this:</p>
  
  <pre><code>    Sep 28 12:41:10  [info] $Fatal Error Details = Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; exceptionHandler
          )
  
      [code] =&gt; -2
      [message] =&gt; DB Error: syntax error
      [mode] =&gt; 16
      [debug_info] =&gt; SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]
      [type] =&gt; DB_Error
      [user_info] =&gt; SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]
      [to_string] =&gt; [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]"]
  )
  </code></pre>
  
  <p>I have since found more issues which may be related.</p>
  
  <p>I can no longer edit or add Payment Processors and get an error saying: This financial account cannot have '' relationship.</p>
  
  <p>I also can't add or edit Price Sets.</p>
  
  <p>Further digging found this in my tracestack:</p>
  
  <p>/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/FinancialType.php(196): CRM_Core_PseudoConstant::populate(NULL, "CRM_Financial_DAO_EntityFinancialAccount", TRUE, "entity_id", NULL, "account_relationship =  AND entity_table = 'civicrm_financial_type' ")</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-29T04:58:57.863Z
Comments.Text: Is it possible you installed an extension that adds a payment processor (e.g. Stripe), created a payment processor, then uninstalled/deleted the extension without deleting the payment processor record?
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-02T09:05:12.683Z
Comments.Text: Hi, thanks for the response. Unfortunately this is not the case as I only ever used the built in Paypal payment processor.
Comments.UserDisplayName: Slingshot Design
Tags: <wordpress><civievent>
Title: Event Fees - DB Error: syntax error
ThreadText: # Event Fees - DB Error: syntax error
  
  (Asked by: username_0 on 2017-09-28)
  
  after upgrading to CiviCRM 4.7.23 for Wordpress I can no longer configure Event Fees and get a DB Error: syntax error.
  I tried upgrading to 4.7.24 and still no joy.
  The log file contains this:
      Sep 28 12:41:10  [info] $Fatal Error Details = Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => exceptionHandler
          )
  
      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]
      [type] => DB_Error
      [user_info] => SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT  id, entity_id  
   FROM civicrm_entity_financial_account 
  
   WHERE ( account_relationship =  AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id  
   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND entity_table = 'civicrm_financial_type'  )  
  
  
   ORDER BY entity_id' at line 4]"]
  )
  
  I have since found more issues which may be related.
  I can no longer edit or add Payment Processors and get an error saying: This financial account cannot have '' relationship.
  I also can't add or edit Price Sets.
  Further digging found this in my tracestack:
  /wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/FinancialType.php(196): CRM_Core_PseudoConstant::populate(NULL, "CRM_Financial_DAO_EntityFinancialAccount", TRUE, "entity_id", NULL, "account_relationship =  AND entity_table = 'civicrm_financial_type' ")
  
  **Tags:** wordpress, civievent
  
  > **Comments:**
  > **username_1**: Is it possible you installed an extension that adds a payment processor (e.g. Stripe), created a payment processor, then uninstalled/deleted the extension without deleting the payment processor record?  
  > **username_0**: Hi, thanks for the response. Unfortunately this is not the case as I only ever used the built in Paypal payment processor.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2017-12-27. Score: 3 | Accepted answer
  
  I guess you have disabled the CiviContribute Component which lead the function to return NULL for account relationship.
  
  
  ---
  
  ### Answer by username_3 on 2017-09-28. Score: 0
  
  If you can reproduce this [and give us your exact steps] on one of the demo sites (Wordpress or Drupal - <http://dmaster.demo.civicrm.org/civicrm> - does not really matter) - then this (a Fatal Error) will get prompt attention; There are several code Sprints going on this week - reporting live from Montreal!
  
  > **Comments:**
  > **username_0**: Thanks for the link, that's really useful. I couldn't reproduce the problem. However I have since found another issue which may be related. I can no longer edit or add Payment Processors. If I try I get an error saying: This financial account cannot have '' relationship. I can't try to reproduce this on the demo as I do not have enough permission to make those changes.  
  > **username_3**: Ah - so that sounds like the underlying issue - perhaps somehow some Financial Accounts got deleted?  
  > **username_0**: Thanks for your reply. I've compared all of the *financial* tables with a backup of my database and they are exactly the same apart from 2 extra records in the civicdm_finalncial_account table in the newest database. I tried deleting them but made no difference.  
  
  ---
  
  ### Answer by username_4 on 2019-02-20. Score: 0
  
  Similar issue when CiviContribute is disabled is with price sets: menu for new price set is active, but throws a DB syntax error when new price set is submitted.
  
  See more here: [CiviMember price sets are depending on CiviContribute?](https://civicrm.stackexchange.com/questions/28371/civimember-price-sets-are-depending-on-civicontribute)
  
  > **Comments:**
  > **username_5**: Thanks username_4 - could you expand this to make it clearly an Answer eg "therefore disable Price Sets before disabling CiviContribute"?  
  
  ---
  
  