-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error in hookActionSetInvoice function #1
Comments
Hello @mathieuhen Thanks for reporting this issue. |
OK, thanks. So I let you check how resolve that ;) |
Hello @mathieuhen. Once again, thanks for reporting this issue. I am sorry to have delayed an answer during the day of yesterday. A problem related to PrestaShop; was preventing me to install and execute a PrestaShop 1.7.7.3 version to confirm the problem in the same version. Fortunately they have resolved this. In relation to your problem: I have not been able to reproduce the problem in a clean installation of PrestaShop 1.7.7.3 . For us this is working correctly. I wonder if some other module may be overwriting the "Order" or "OrderInvoice" object; or maybe some other module is executing actions on this hook; avoiding the invoice id being assigned to the Order. Or we might have some bug or use another hook. In any case; I would like to get to the bottom of this. Please, could you open a ticket with us at integration@multisafepay.com with a reference to this GitHub issue. I will retake this issue from there. Being our system, we can ask you for a staging environment, while we keep sensitive information safe, and reproduce the error, and finally understand if we should adjust something in the plugin; or maybe it's due to some other conflict in your setup. I will be waiting your answer to continue my investigation. |
Hello Daniel, sorry for the delay. I will open a ticket. Thanks, |
Thanks again for your report @mathieuhen. I am closing this; since it was reported by you in release 5.1.1. |
Hello,
I installed the plugin and I got an error in the function hookActionSetInvoice on these lines :
$orderInvoice = OrderInvoice::getInvoiceByNumber($params['OrderInvoice']->id);
$orderInvoiceNumber = $orderInvoice->getInvoiceNumberFormatted($order->id_lang, $order->id_shop);
The error :
Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getInvoiceNumberFormatted() on bool
We are on PS 1.7.7.3.
I changed the line
$orderInvoice = OrderInvoice::getInvoiceByNumber($params['OrderInvoice']->id);
by
$orderInvoice = $params['OrderInvoice'];
And that is OK now.
It seems logical because on the hook ActionSetInvoice in the class Order, the variables sent are
$invoice_number = Hook::exec('actionSetInvoice', [
get_class($this) => $this,
get_class($order_invoice) => $order_invoice,
'use_existing_payment' => (bool) $use_existing_payment,
]);
So the var 'OrderInvoice' is already an object 'OrderInvoice' so no need to refetch again the invoice by number, we already have it.
Or I'm wrong ?
The text was updated successfully, but these errors were encountered: