-
Notifications
You must be signed in to change notification settings - Fork 0
CIVIMM-349: Add Credit Note Transaction Details To Sage50 Report #31
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
CIVIMM-349: Add Credit Note Transaction Details To Sage50 Report #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the Sage50 CSV export by including credit note details—number, line item description, and financial type—whenever credit notes are present.
- Extend the SELECT query to pull credit note fields and join the relevant tables conditionally.
- Map the new credit note values into the Details, Reference, and Project Refn columns.
- Only apply the additional joins and columns when
$supportCreditNoteis enabled.
Comments suppressed due to low confidence (2)
CRM/Financial/BAO/ExportFormat/DataProvider/Sage50CSVProvider.php:255
- New behavior for credit note details should be covered by automated tests. Add or update a test case to verify that credit note descriptions override standard item descriptions in the CSV export.
$item[self::DETAILS_LABEL] = !empty($exportResultDao->credit_note_description) ? $exportResultDao->credit_note_description
CRM/Financial/BAO/ExportFormat/DataProvider/Sage50CSVProvider.php:87
- The SELECT list is missing a comma after
credit_note_financial_type, which will cause a SQL syntax error. Add a trailing comma before the FROM clause.
. ($supportCreditNote ? "ftycn.name" : "''") . " AS credit_note_financial_type
| AND (fii.financial_account_id IN ($taxAccounts))) | ||
| LEFT JOIN civicrm_line_item li ON (li.id = fi.entity_id AND fi.entity_table = 'civicrm_line_item') | ||
| " . ($supportCreditNote ? "LEFT JOIN financeextras_credit_note_line fcli ON (fcli.id = fi.entity_id AND fi.entity_table = 'financeextras_credit_note_line')" : "") . " | ||
| " . ($supportCreditNote ? "LEFT JOIN financeextras_credit_note_line fcli ON (fcli.id = fi.entity_id AND fi.entity_table = 'financeextras_credit_note_line') LEFT JOIN financeextras_credit_note fcn ON (fcli.credit_note_id = fcn.id) LEFT JOIN civicrm_financial_type ftycn ON fcli.financial_type_id = ftycn.id" : "") . " |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Combining multiple JOIN clauses into one long concatenated string reduces readability. Consider splitting each JOIN into its own concatenated segment or formatting them on separate lines.
@shahrukh-compuco can u check the copilot comment especially. |
@erawat I think the suggestion is wrong as adding a comma before from will cause the syntax error |
Overview
This PR adds credit note details to the sage 50 report, mainly it adds following three files as currently these fields are empty for credit note transactions
Before
before.csv
After
after.csv