partkeepr / PartKeepr

Open Source Inventory Management
http://www.partkeepr.org
GNU General Public License v3.0
1.38k stars 401 forks source link

Critical error when deleting parts #1143

Open boiddude opened 4 years ago

boiddude commented 4 years ago

System: Linux Ubuntu 20.04 Using docker mhubig/partkeepr latest using docker-compose (just installed 7/22/2020)

Part was clicked on in the Part Manager -> Parts List tab and then the Delete Part was clicked. Part is not deleted.

Full Report: Critical Error

Details

The server returned a response which we were not able to interpret.

Request

DELETE /api/parts/278?_dc=1595524141903

[object Object]

Response Status Code

200

Response


Fatal error: Method PartKeepr\ProjectBundle\Entity\ProjectPart::toString() must not throw an exception, caught Error: Call to a member function getName() on null in /var/www/html/src/PartKeepr/DoctrineReflectionBundle/Services/DeletionService.php on line 0
{"@context":"\/api\/contexts\/Error","@type":"Error","hydra:title":"An error occurred","hydra:description":"Error: Method PartKeepr\ProjectBundle\Entity\ProjectPart::
toString() must not throw an exception, caught Error: Call to a member function getName() on null"}

Server Configuration

doctrine_orm_version: 2.5.4 doctrine_dbal_version: 2.5.2 doctrine_common_version: 2.6.0-DEV php_version: 7.1.33 auto_start_session: true maxUploadSize: 2097152 isOctoPartAvailable: false availableImageFormats: JPG,GIF,PNG max_users: unlimited authentication_provider: PartKeepr.Auth.WSSEAuthenticationProvider tip_of_the_day_uri: https://partkeepr.org/tips/%s password_change: true patreonStatus: defaultGridPresets: []

trembel commented 2 years ago

Looking into the mysql database it seems as if the ProjectPart is not deleted in case a Project is being deleted:

mysql> SELECT * FROM ProjectPart;
+-----+---------+------------+----------+------------------+-------------+---------+-----------+
| id  | part_id | project_id | quantity | remarks          | overageType | overage | lotNumber |
+-----+---------+------------+----------+------------------+-------------+---------+-----------+
| 404 |     124 |       NULL |        0 |                  | absolute    |       0 |           |
| 405 |      84 |       NULL |        1 | C17              | absolute    |       0 |           |
| 406 |     100 |       NULL |        1 | D1               | absolute    |       0 |           |
| 407 |     113 |       NULL |        1 | D2               | absolute    |       0 |           |
| 408 |     125 |       NULL |        1 | J1               | absolute    |       0 |           |
| 409 |     125 |       NULL |        1 | J2               | absolute    |       0 |           |
| 410 |     105 |       NULL |        1 | J3               | absolute    |       0 |           |
| 411 |     157 |       NULL |        1 | L1               | absolute    |       0 |           |
| 412 |     125 |       NULL |        1 | P1               | absolute    |       0 |           |
| 413 |     158 |       NULL |        1 | Q1               | absolute    |       0 |           |
| 414 |      77 |       NULL |        1 | R4               | absolute    |       0 |           |
| 415 |      72 |       NULL |        1 | R6               | absolute    |       0 |           |
| 416 |     128 |       NULL |        1 | R9               | absolute    |       0 |           |
trembel commented 2 years ago

When deleting the entries in the ProjectPart table manually, deletion works again.