myparcelnl / prestashop

PrestaShop module to integrate with MyParcel NL and BE
https://developer.myparcel.nl/nl/documentatie/11.prestashop.html
10 stars 5 forks source link

[BETA]: (beta-3) error in order list's myparcel column #258

Closed mariuszsienkiewicz closed 1 month ago

mariuszsienkiewicz commented 3 months ago

Version check

PrestaShop version

8.1.6

PHP version

8.1

What went wrong?

We have upgraded our PS test instance to 8.1.6. After the upgrade and installation of beta-3, we encountered this error in our error.log:

[PDK]: Failed to flush entity manager

This error causes the MyParcel order list column to be empty.

During debugging, I discovered that the issue lies in an integrity check violation in the myparcelnl_order_data table. It appears that the getFromCart method (in the PsOrderService class) uses the updateOrderData method, which does not set the notes value. The notes field cannot be null.

Please see the log below.

I resolved this issue in our instance by modifying the following code::

    /**
     * @var string
     * @ORM\Column(name="notes", type="text")
     */
    private $notes;

to that:

    /**
     * @var string
     * @ORM\Column(name="notes", type="text")
     */
    private $notes = "";

Reproduction steps

I don't know how to reproduce this issue. We have just upgraded to 8.1.6 and that error happened.

Relevant log output

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'notes' cannot be null
An exception occurred while executing 'INSERT INTO ps_myparcelnl_order_data (notes, order_id, date_upd, date_add, data) VALUES (?, ?, ?, ?, ?)' with params [null, 153590, "2024-05-23 14:51:22", "2024-05-23 14:51:22", "{\"deliveryOptions\":{\"carrier\":{\"externalIdentifier\":\"postnl\"},\"labelAmount\":1,\"shipmentOptions\":{\"insurance\":-1,\"ageCheck\":-1,\"hideSender\":-1,\"largeFormat\":-1,\"onlyRecipient\":0,\"return\":-1,\"sameDayDelivery\":-1,\"signature\":0,\"tracked\":-1},\"deliveryType\":\"standard\",\"packageType\":\"package\"}}"]

Additional context

No response

myparcel-bot[bot] commented 1 month ago

:tada: This issue has been resolved in version 4.0.0-beta.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: