mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Only set the category_type in postEdit if the category is empty. (#2337)
Fixes #2333
This commit is contained in:
parent
399e70763b
commit
a401986ef5
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Category as Category;
|
use App\Models\Category as Category;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
@ -133,7 +134,7 @@ class CategoriesController extends Controller
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function postEdit($categoryId = null)
|
public function postEdit(Request $request, $categoryId = null)
|
||||||
{
|
{
|
||||||
// Check if the blog post exists
|
// Check if the blog post exists
|
||||||
if (is_null($category = Category::find($categoryId))) {
|
if (is_null($category = Category::find($categoryId))) {
|
||||||
|
@ -142,12 +143,14 @@ class CategoriesController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the category data
|
// Update the category data
|
||||||
$category->name = e(Input::get('name'));
|
$category->name = e($request->input('name'));
|
||||||
$category->category_type = e(Input::get('category_type'));
|
// If the item count is > 0, we disable the category type in the edit. Disabled items
|
||||||
$category->eula_text = e(Input::get('eula_text'));
|
// don't POST, so if the category_type is blank we just set it to the default.
|
||||||
$category->use_default_eula = e(Input::get('use_default_eula', '0'));
|
$category->category_type = e($request->input('category_type', $category->category_type));
|
||||||
$category->require_acceptance = e(Input::get('require_acceptance', '0'));
|
$category->eula_text = e($request->input('eula_text'));
|
||||||
$category->checkin_email = e(Input::get('checkin_email', '0'));
|
$category->use_default_eula = e($request->input('use_default_eula', '0'));
|
||||||
|
$category->require_acceptance = e($request->input('require_acceptance', '0'));
|
||||||
|
$category->checkin_email = e($request->input('checkin_email', '0'));
|
||||||
|
|
||||||
if ($category->save()) {
|
if ($category->save()) {
|
||||||
// Redirect to the new category page
|
// Redirect to the new category page
|
||||||
|
|
Loading…
Reference in a new issue