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

Reports service drops date_macro if options are also provided #432

Open
conceivably opened this issue May 30, 2018 · 1 comment
Open

Reports service drops date_macro if options are also provided #432

conceivably opened this issue May 30, 2018 · 1 comment

Comments

@conceivably
Copy link

Steps to reproduce:

Quickbooks::Service::Reports.new(company_id: <some_realm_id>, access_token: <some_access_token>).query('ProfitAndLoss', 'Last Fiscal Quarter', summarize_column_by: 'Month')

Result:

The same result as running the query above without date_macro, which defaults to 'This Fiscal Year-to-date', both on the quickbooks-ruby side and the Quickbooks API side.

Expected:

A report that only includes months from the last fiscal quarter, with columns summarized by month.


Proposed solution:

Looking at url_for_query in quickbooks-ruby/lib/quickbooks/service/reports.rb (https://github.com/ruckus/quickbooks-ruby/blob/master/lib/quickbooks/service/reports.rb), it appears that date_macro simply gets dropped when options are provided.
Changing the returned string to "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}&#{options_string}" yields the expected response, respecting both date_macro and options.


I'm unsure about what your preference w/r/t pull requests is. If the above looks good and I haven't missed anything, I'd be happy to open one :)

@ruckus
Copy link
Owner

ruckus commented Jun 4, 2018

Hi @conceivably - thanks for the great write-up. Yes, all PRs are much appreciated! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants