I would like to add IBAN field to the invoices list, I tried to create an extra field in invoices using the following formula: (($reloadedobj = new bank_account($db)) && ($reloadedobj->fetchNoCompute($obj->id) > 0)) ? $reloadedobj->iban_prefix: ’ ’
But it doesn’t work, can anyone help me?
The payment method is already present, I need to have the IBAN field which is found in the Banks table, and which cannot be selected in the invoice list.
I can use this Extra field, to display it in an email template. I think it can be done via the substitution variable EXTRAFIELD_XXX putting iban in place of XXX; Unfortunately it’s not working, am I doing something wrong?
The extra field for the list view does not work in the detail view, because the environment is different.
Define an extra field eg. iban1 for the detail view with visibility set to 0
I used the formula you indicated to me, it works because I can view it in the invoice detail, if I put visibility 1. Then I put visibility 0, as you suggested and I created an email type, (see screenshot), unfortunately this doesn’t work, I have something wrong?
Ok, I looked at the related code and noticed that the name of the extra field in email templates is to be written in uppercase only.
So please wrote in the template __EXTRAFIELD_IBAN1__ and it should work.
The display or replacement is imho independent of the visibility.
My guess is that no bank account was selected in 2023-00311, because if not replaced, the text __EXTRAFIELD_IBAN1__ would be displayed.
No, the value is present, because I see it in the list through the formula you indicated first.
The second formula you sent me works, because I tried to put visibility 1 and it is also seen in the invoice view, but it is not seen if I recall it in the email. Sorry but I can’t figure out how to resolve this.
I think the best way to troubleshoot is to temporarily change the getCommonSubstitutionArray function.
Search in the file ~htdocs\core\lib\functions.lib.php in the function getCommonSubstitutionArray(…
the lines as in the screenshot and add the two lines (7923 and 7924)
You will hopefully see the extrafields and their substitutions.
The __extrafield_account__ shows the rowid of the table bank_account.
For this you have to add another extrafield with $object->fk_account as computed field.