Body: <p>while dealing with a white screen, I found a suspicious message in php_errorlog. In debugging that, I think I hit a bug. The documentation says that instead of directly reporting it, I should ask here if it is actually a bug.</p>
  <ul>
  <li>civicrm 5.26.2</li>
  <li>wordpress</li>
  </ul>
  <p>In the logging, I see this line:</p>
  <pre><code>[22-Jun-2020 16:58:39 Europe/Amsterdam] PHP Notice:  Undefined offset: 0 in /home/user/public_html/civicrm-nw/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/FinancialAccount.php on line 255
  </code></pre>
  <p>This is in function <em>getFinancialAccountForFinancialTypeByRelationship</em>; I put in some print statements and found out that it gets value 'Income Account is' in parameter $relationshipType. The line of the message uses the hard coded value instead:</p>
  <pre><code>$incomeAccountRelationshipID = array_search('Income Account is', $accountRelationships);
  </code></pre>
  <p>which is suspicious in itself. But the array $accountRelationships does not contain that value, which causes the message. The array appears to contain the <em>dutch</em> equivalents of the relationships:</p>
  <pre><code>LOC103 Array 
  (
      [1] =&gt; Inkomsten rekening is
      [2] =&gt; Credit/Contra Revenue Account is
  ....more
  }
  </code></pre>
  <p>I am no php programmer, so I fixed it for my site by changing the hard code value to 'Inkomsten rekening is', making the message disappear.
  I think the code should be changed to somethink like</p>
  <pre><code>$incomeAccountRelationshipID = array_search(translation_of ($relationshipType), $accountRelationships);
  </code></pre>
  <p>Is it OK to file a bug report on this?</p>
  <p>Ruud</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-23T08:07:58.353Z
Comments.Text: Ik vind van wel Ruud :-) (For the non-Dutch: I would say yes)
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-23T12:59:04.980Z
Comments.Text: thanks, I raised https://lab.civicrm.org/dev/wordpress/-/issues/61
Comments.UserDisplayName: ruud
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-23T13:00:05.773Z
Comments.Text: should I delete this question now?
Comments.UserDisplayName: ruud
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-23T15:10:43.303Z
Comments.Text: I'd leave the question here so others can find it too in case they have the same problem. It does sound like a bug, but I think it's not because of hardcoding it's because the line before is retrieving labels instead of names. Civi has an internal machine name for each value which doesn't change, and then the label which is what you see on screen and can change. So it should be comparing to the internal name not the label.
Comments.UserDisplayName: Demerit
Tags: <error><financial-types><translation>
Title: confirmation undefined offset bug in BAO/FinancialAccount.php
ThreadText: # confirmation undefined offset bug in BAO/FinancialAccount.php
  
  (Asked by: username_0 on 2020-06-23)
  
  while dealing with a white screen, I found a suspicious message in php\_errorlog. In debugging that, I think I hit a bug. The documentation says that instead of directly reporting it, I should ask here if it is actually a bug.
  
  * civicrm 5.26.2
  * wordpress
  
  In the logging, I see this line:
  
  ```
  [22-Jun-2020 16:58:39 Europe/Amsterdam] PHP Notice:  Undefined offset: 0 in /home/user/public_html/civicrm-nw/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/FinancialAccount.php on line 255
  
  ```
  
  This is in function *getFinancialAccountForFinancialTypeByRelationship*; I put in some print statements and found out that it gets value 'Income Account is' in parameter $relationshipType. The line of the message uses the hard coded value instead:
  
  ```
  $incomeAccountRelationshipID = array_search('Income Account is', $accountRelationships);
  
  ```
  
  which is suspicious in itself. But the array $accountRelationships does not contain that value, which causes the message. The array appears to contain the *dutch* equivalents of the relationships:
  
  ```
  LOC103 Array 
  (
      [1] => Inkomsten rekening is
      [2] => Credit/Contra Revenue Account is
  ....more
  }
  
  ```
  
  I am no php programmer, so I fixed it for my site by changing the hard code value to 'Inkomsten rekening is', making the message disappear.
  I think the code should be changed to somethink like
  
  ```
  $incomeAccountRelationshipID = array_search(translation_of ($relationshipType), $accountRelationships);
  
  ```
  
  Is it OK to file a bug report on this?
  
  username_0
  
  **Tags:** error, financial-types, translation
  
  > **Comments:**
  > **username_1**: Ik vind van wel username_0 :-) (For the non-Dutch: I would say yes)  
  > **username_0**: thanks, I raised https://lab.civicrm.org/dev/wordpress/-/issues/61  
  > **username_0**: should I delete this question now?  
  > **username_2**: I'd leave the question here so others can find it too in case they have the same problem. It does sound like a bug, but I think it's not because of hardcoding it's because the line before is retrieving labels instead of names. Civi has an internal machine name for each value which doesn't change, and then the label which is what you see on screen and can change. So it should be comparing to the internal name not the label.  
  
  ---
  
  ## 0 answers
  
  