From c3b6980d4eaba48476def8a8a87d92275fc72547 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Thu, 20 Sep 2018 13:58:31 +0200 Subject: [PATCH] Update releases with proper movieinfo_id when updating movies on movies list --- Changelog | 1 + app/Http/Controllers/Admin/MovieController.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 9a46ab7c9f..58673ec7a8 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-09-20 DariusIII + * Chg: Update releases with proper movieinfo_id when updating movies on movies list * Chg: Update API v2 movie lookup description by adding traktid lookup example * Chg: Update profile template * Chg: Check for false response from getRawHtml function in FanartTV class diff --git a/app/Http/Controllers/Admin/MovieController.php b/app/Http/Controllers/Admin/MovieController.php index 9d71f20ee5..80bd39d981 100644 --- a/app/Http/Controllers/Admin/MovieController.php +++ b/app/Http/Controllers/Admin/MovieController.php @@ -53,7 +53,17 @@ public function create(Request $request) if ($request->has('id') && \strlen($id) === 7) { $movCheck = $movie->getMovieInfo($id); - if ($movie->updateMovieInfo($id) === true && ($movCheck === null || ($request->has('update') && $request->input('update') === 1))) { + $movieInfo = $movie->updateMovieInfo($id); + if ($movieInfo === true && ($movCheck === null || ($request->has('update') === true && (int) $request->input('update') === 1))) { + $forUpdate = Release::query()->where('imdbid', $id)->get(['id']); + if ($forUpdate !== null) { + $movieInfoId = MovieInfo::query()->where('imdbid', $id)->first(['id']); + if ($movieInfoId !== null) { + foreach ($forUpdate as $movie) { + Release::query()->where('id', $movie->id)->update(['movieinfo_id' => $movieInfoId->id]); + } + } + } return redirect('admin/movie-list'); }