Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the XML CDR Importer more resilient #6543

Merged
merged 1 commit into from Feb 9, 2023

Conversation

daniel-lucio
Copy link
Contributor

So I discovered 2 things,

  1. If a user adds the default config cdr-field-array with the content of a database field Let's pretend they want to show the xml_cdr_uuid column (for support purposes) - it could be any column (please don't argue with the column name, it is an example only), the SQL construction will fail as not Postgresql, Not MariaDB/MySQL allow having a column repeated twice. Adding array_unique() fixes this issue.

  2. This one is for developers: If a developer wants to create more columns in the v_xml_cdr table and make them visible in the CDR app, common sense tells to add the default setting cdr-field-array to show it. As the code is now, this will look into the freeswitch variables and overwrite it with NULL. I am adding a condition that verifies if the value has been already assigned, if it is, it won't overwrite it. This allows any developer who may be interested in extending the CDR to simply extend the class without touching it; very handy to keep the original code untouched.

So I discovered 2 things,

1. If a user adds the default config cdr-field-array with the content of a database field Let's pretend they want to show the xml_cdr_uuid column (for support purposes) - it could be any column (please don't argue with the column name, it is an example only), the SQL construction will fail as not Postgresql, Not MariaDB/MySQL allow having a column repeated twice. Adding array_unique() fixes this issue.

2. This one is for developers: If a developer wants to create more columns in the v_xml_cdr table and make them visible in the CDR app, common sense tells to add the default setting cdr-field-array to show it. As the code is now, this will look into the freeswitch variables and overwrite it with NULL. I am adding a condition that verifies if the value has been already assigned, if it is, it won't overwrite it. This allows any developer who may be interested in extending the CDR to simply extend the class without touching it; very handy to keep the original code untouched.
@markjcrane
Copy link
Contributor

markjcrane commented Feb 9, 2023

Looks like a good improvement good job. Accepting the changes.

@markjcrane markjcrane merged commit 9aa88dc into fusionpbx:master Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants