User IBAN on quote

Hi,

Im having a trouble with getting user IBAN data in quote template.
In invoice tmpl i use

echo ($invoice->user_iban);

and it works fine, in quote tmpl when I try to use

echo ($quote->user_iban);

it returns error:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$user_iban
Filename: pdf/quote-pdf.php
Line Number: 193
Backtrace:
File: /[cut]/application/views/quote_templates/pdf/quote-pdf.php
Line: 193
Function: _error_handler
File: /[cut]/application/third_party/MX/Loader.php
Line: 464
Function: include
File: /[cut]/application/third_party/MX/Loader.php
Line: 415
Function: _ci_load
File: /[cut]/application/helpers/pdf_helper.php
Line: 255
Function: view
File: /[cut]/application/modules/quotes/controllers/Quotes.php
Line: 193
Function: generate_quote_pdf
File: /[cut]/index.php
Line: 325
Function: require_once

in other hand

$quote->user_mobile

and

$quote->user_email

also works fine

Anybody got any ideas?
Thanks

The function default_select() in the file “/invoiceplane-v15/application/modules/invoices/models/Mdl_invoices.php” includes queries the database for the value of ip_users.user_iban.

Unfortunately, the same function default_select() in the file “/invoiceplane-v15/application/modules/quotes/models/Mdl_quotes.php” does not query the database for this information, hence, it is not available when you type $quote->user_iban.

@kovah to me this is a bug: the default_select() in the quotes model retrieves less information about the user from the database than the same function in the invoices model. These are the missing lines of code:

ip_users.user_subscribernumber,
ip_users.user_iban,
ip_users.user_gln,
ip_users.user_rcc,

Should I add all of them to a pull request? Maybe we should just replace all those lines with ip_users.* to retrieve all columns from the ip_users table instead of having to update the models each time that table is modified. For instance, this is what is done for ip_clients.* and/or ip_invoice_sumex.* in these queries.

@gregorb I have checked the code and I have seen nothing that would break if you add the missing lines

ip_users.user_subscribernumber,
ip_users.user_iban,
ip_users.user_gln,
ip_users.user_rcc,

to your “invoiceplane-v15/application/modules/quotes/models/Mdl_quotes.php” between the lines ip_users.user_tax_code and ip_clients.*, but just in case, make a backup copy of the file before editing it. And do not forget to tell us if that solved your problem.

Thanks for reply, I can confirm that @miquel_cabanas solution works.
Thanks!

Ticket created:

  • IP-740 - Retrieve all columns from ip_users table in invoices & quotes default_select()

and PR submitted for v1.5.10.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.