dysath / seat-fitting

A Fitting/Doctrine module for SeAT
GNU General Public License v2.0
14 stars 21 forks source link

Fits do not show up under Doctrine Tab #18

Closed 73udz closed 6 years ago

73udz commented 6 years ago

There are 10 fits under the fittings tab, but when you go to make a doctrine, None of them show up under the "Select Fits to Add to Doctrine" area, and the "Chosen Fits" are is also blank.

STRogers commented 6 years ago

We ran into the same problem. This happens when there are no doctrines in the database and you attempt to create one by pressing the Edit icon next to the dropdown. I was able to create one using the smaller plus icon in the header control, or by just adding an entry in the table seat_doctrine. It would probably be best if that control was disabled until a valid doctrine was selected in the dropdown or if it was treated as "create" instead of "edit" when no valid one is selected.

The call to open the edit dialog when no valid doctrine is selected generates crashes the request, which you can see in a developer console. It still loads the edit dialog, but the list of fittings is broken.

If there are no doctrines in the database then line 124 in src/Http/Controllers/FittingController.php throws an Error since it assumes the doctrine must exist. Instead find() returns null and the error is thrown.

$doctrine_fittings = Doctrine::find($doctrine_id)->fittings()->get();

This is the laravel log entry:

local.ERROR: Call to a member function fittings() on null (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function fittings() on null at src/Http/Controllers/FittingController.php:124)

[stacktrace]
#0 [internal function]: Denngarr\\Seat\\Fitting\\Http\\Controllers\\FittingController->getDoctrineEdit('1')
dysath commented 6 years ago

Great idea.. will put that into the next release. I need to stabilize the release anyhow.

dysath commented 6 years ago

I patched this in the 3.0.0 release.