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

Adding custom field does not affect output. #41

Open
phtmgt opened this issue Dec 13, 2019 · 7 comments
Open

Adding custom field does not affect output. #41

phtmgt opened this issue Dec 13, 2019 · 7 comments

Comments

@phtmgt
Copy link

phtmgt commented Dec 13, 2019

Using the below code from instructions:

const paymentId = {
  key: 'invoice_header_paymentId_value',
  value: '123 - test value'
};
const phrases = ['invoice_header_payment_reference', paymentId];
invoice.getInvoice(phrases).toPDF()

produces no changes in output. Am I missing something?

Thanks.

@mkhoussid
Copy link

Sounds tedious, but have you tried manually adding fields after instantialization, as per the docs?

const invoice = invoiceIt.create();
 
invoice.recipient.company_name = 'Receiver company';
invoice.recipient.first_name = 'Will';
. . . .

@rimiti
Copy link
Owner

rimiti commented Mar 30, 2020

Hello @plamenh ,

Did you tried it ?

Note: 🙏 Thank you @mkhoussid 🚀

@phtmgt
Copy link
Author

phtmgt commented Apr 12, 2020

Yeah, this has been working all along, but anyways, I was talking about the ‘phrases’ part. It produces no difference to the output. What is it supposed to do?

@ahbbvc
Copy link

ahbbvc commented Jan 7, 2021

Anyone found solution?

@phtmgt
Copy link
Author

phtmgt commented Jan 8, 2021

@ahabibovic1 Just use the class methods instead. I don't think this has been fixed (seems it's not worth the effort, given that class methods work). In the end I forked the repo and did all the changes and improvements that we needed myself. It's not hard, code is not complicated and is relatively clear how it works.

@ahbbvc
Copy link

ahbbvc commented Jan 8, 2021

@plamenh Thank you. Started doing the same thing.

@ahbbvc
Copy link

ahbbvc commented Jan 11, 2021

@plamenh or anyone else interested, this is solution:

const object = {
    key: 'key_name',
    value: '[email protected]'
  };

  const phrases = ['key_name', object];   // key has to match with one defined above
  const invoice = invoiceIt.create(recipient, emitter, phrases);
  invoice.getInvoice(phrases).toPDF()

Of course you need to override default template file if you want to show custom fields in generated files.

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

4 participants