VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: rednaxela on September 03, 2023, 14:21:34 PM

Title: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: rednaxela on September 03, 2023, 14:21:34 PM
Hi,

I upgraded to the latest Virtuemart (VirtueMart 4.2.2 10908) and Joomla (4.3.4) version. Since then, I can no longer generate invoices from the orders page. Error: vmError: getInvoicePDF Cant create pdf, no entry

I have removed the overrides for the invoice template, but I still receive the same error.

Any help would be greatly appreciated

Best, Alexander
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: rednaxela on September 04, 2023, 12:36:46 PM
It is likely failing as no invoice number is generated/available:

com_virtuemart > controllers > invoice.php

if( $layout == 'invoice' and (!$invoiceNumber or empty($invoiceNumber))){
   $r = 'getInvoicePDF Cant create pdf, no entry for layout '.$layout;
   vmError($r, $r);
   return 0;

When and where is the invoice number generated? Can I set it manually?
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: rednaxela on September 06, 2023, 20:18:23 PM
From Max Milbers via support ticket.

I think I found the problem. A fast solution, open the invoice model at /administrator/components/com_virtuemart/models/inovice.php around line 162, search for

function getExistingIfUnlockedCreateNewInvoiceNumber($orderDetails, &$invoiceNumber, $force_create_invoice = 0){

and just change the last 0 to null
function getExistingIfUnlockedCreateNewInvoiceNumber($orderDetails, &$invoiceNumber, $force_create_invoice = null){
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: Kuubs on October 05, 2023, 14:30:43 PM
Quote from: rednaxela on September 06, 2023, 20:18:23 PM
From Max Milbers via support ticket.

I think I found the problem. A fast solution, open the invoice model at /administrator/components/com_virtuemart/models/inovice.php around line 162, search for

function getExistingIfUnlockedCreateNewInvoiceNumber($orderDetails, &$invoiceNumber, $force_create_invoice = 0){

and just change the last 0 to null
function getExistingIfUnlockedCreateNewInvoiceNumber($orderDetails, &$invoiceNumber, $force_create_invoice = null){

I have the same error, and I cannot find that line of code...
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: jenkinhill on October 05, 2023, 15:53:02 PM
The file is /administrator/components/com_virtuemart/models/invoice.php   not  inovice.php  (a Max typo)

It is correct in current member version 4.2.4 10922
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: Kuubs on October 06, 2023, 16:49:14 PM
Quote from: jenkinhill on October 05, 2023, 15:53:02 PM
The file is /administrator/components/com_virtuemart/models/invoice.php   not  inovice.php  (a Max typo)

It is correct in current member version 4.2.4 10922

function getExistingIfUnlockedCreateNewInvoiceNumber($orderDetails, &$invoiceNumber, $force_create_invoice = 0){

this function does not have the force create invoice parameter.
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: Can.Y on October 18, 2023, 11:36:57 AM
Quote from: jenkinhill on October 05, 2023, 15:53:02 PM
The file is /administrator/components/com_virtuemart/models/invoice.php   not  inovice.php  (a Max typo)

It is correct in current member version 4.2.4 10922

I have the same issue and apply this fix in VM 4.2.0 10905
Then I got a new error msg: array_push(): Argument #1 ($array) must be of type array, null given

Does anyone know what can be done?
Really appreciated
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: jenkinhill on October 18, 2023, 12:18:59 PM
There have been more bugfixes in the latest member version.  https://extensions.virtuemart.net/support/virtuemart-supporter-membership-bronze-detail
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: Kuubs on October 18, 2023, 20:57:02 PM
Quote from: jenkinhill on October 18, 2023, 12:18:59 PM
There have been more bugfixes in the latest member version.  https://extensions.virtuemart.net/support/virtuemart-supporter-membership-bronze-detail

You got a changelog perhaps?
Title: Re: PDF Invoice gen failing with vmError: getInvoicePDF Cant create pdf, no entry
Post by: jenkinhill on October 19, 2023, 11:50:30 AM
You can examine the list of revisions:   https://dev.virtuemart.net/projects/virtuemart/repository/virtuemart/revisions