mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
mkdir not recursive (#2460)
* Fix path to snipeit-ssl.crt (#2428) * Modified 'recursive' part of the tuple to true
This commit is contained in:
parent
bcc6ca5180
commit
580091269d
|
@ -231,7 +231,7 @@ class AssetsController extends Controller
|
||||||
$directory= public_path('uploads/assets/');
|
$directory= public_path('uploads/assets/');
|
||||||
// Check if the uploads directory exists. If not, try to create it.
|
// Check if the uploads directory exists. If not, try to create it.
|
||||||
if (!file_exists($directory)) {
|
if (!file_exists($directory)) {
|
||||||
mkdir($directory, 0755);
|
mkdir($directory, 0755, true);
|
||||||
}
|
}
|
||||||
$path = public_path('uploads/assets/'.$file_name);
|
$path = public_path('uploads/assets/'.$file_name);
|
||||||
try {
|
try {
|
||||||
|
@ -288,7 +288,7 @@ class AssetsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function getEdit($assetId = null)
|
public function getEdit($assetId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Check if the asset exists
|
// Check if the asset exists
|
||||||
if (!$asset = Asset::find($assetId)) {
|
if (!$asset = Asset::find($assetId)) {
|
||||||
// Redirect to the asset management page
|
// Redirect to the asset management page
|
||||||
|
@ -407,7 +407,7 @@ class AssetsController extends Controller
|
||||||
$directory= public_path('uploads/assets/');
|
$directory= public_path('uploads/assets/');
|
||||||
// Check if the uploads directory exists. If not, try to create it.
|
// Check if the uploads directory exists. If not, try to create it.
|
||||||
if (!file_exists($directory)) {
|
if (!file_exists($directory)) {
|
||||||
mkdir($directory, 0755);
|
mkdir($directory, 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_name = str_random(25).".".$extension;
|
$file_name = str_random(25).".".$extension;
|
||||||
|
@ -840,7 +840,7 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
// Check if the uploads directory exists. If not, try to create it.
|
// Check if the uploads directory exists. If not, try to create it.
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
mkdir($path, 0755);
|
mkdir($path, 0755, true);
|
||||||
}
|
}
|
||||||
if ($handle = opendir($path)) {
|
if ($handle = opendir($path)) {
|
||||||
|
|
||||||
|
@ -1424,7 +1424,7 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);
|
return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} elseif (Input::get('bulk_actions')=='delete') {
|
} elseif (Input::get('bulk_actions')=='delete') {
|
||||||
|
|
||||||
|
@ -1854,12 +1854,12 @@ class AssetsController extends Controller
|
||||||
$users_list = Helper::usersList();
|
$users_list = Helper::usersList();
|
||||||
// Filter out assets that are not deployable.
|
// Filter out assets that are not deployable.
|
||||||
$assets = Asset::RTD()->get();
|
$assets = Asset::RTD()->get();
|
||||||
|
|
||||||
$assets_list = Company::scopeCompanyables($assets, 'assets.company_id')->lists('detailed_name', 'id')->toArray();
|
$assets_list = Company::scopeCompanyables($assets, 'assets.company_id')->lists('detailed_name', 'id')->toArray();
|
||||||
|
|
||||||
return View::make('hardware/bulk-checkout')->with('users_list', $users_list)->with('assets_list', $assets_list);
|
return View::make('hardware/bulk-checkout')->with('users_list', $users_list)->with('assets_list', $assets_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postBulkCheckout(Request $request)
|
public function postBulkCheckout(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1869,31 +1869,31 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
$user = User::find(e(Input::get('assigned_to')));
|
$user = User::find(e(Input::get('assigned_to')));
|
||||||
$admin = Auth::user();
|
$admin = Auth::user();
|
||||||
|
|
||||||
$asset_ids = array_filter(Input::get('selected_assets'));
|
$asset_ids = array_filter(Input::get('selected_assets'));
|
||||||
|
|
||||||
if ((Input::has('checkout_at')) && (Input::get('checkout_at')!= date("Y-m-d"))) {
|
if ((Input::has('checkout_at')) && (Input::get('checkout_at')!= date("Y-m-d"))) {
|
||||||
$checkout_at = e(Input::get('checkout_at'));
|
$checkout_at = e(Input::get('checkout_at'));
|
||||||
} else {
|
} else {
|
||||||
$checkout_at = date("Y-m-d H:i:s");
|
$checkout_at = date("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('expected_checkin')) {
|
if (Input::has('expected_checkin')) {
|
||||||
$expected_checkin = e(Input::get('expected_checkin'));
|
$expected_checkin = e(Input::get('expected_checkin'));
|
||||||
} else {
|
} else {
|
||||||
$expected_checkin = '';
|
$expected_checkin = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$has_errors = false;
|
$has_errors = false;
|
||||||
$errors = [];
|
$errors = [];
|
||||||
DB::transaction(function() use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids)
|
DB::transaction(function() use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids)
|
||||||
{
|
{
|
||||||
foreach($asset_ids as $asset_id)
|
foreach($asset_ids as $asset_id)
|
||||||
{
|
{
|
||||||
$asset = Asset::find($asset_id);
|
$asset = Asset::find($asset_id);
|
||||||
|
|
||||||
$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);
|
$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);
|
||||||
|
|
||||||
if($error)
|
if($error)
|
||||||
{
|
{
|
||||||
$has_errors = true;
|
$has_errors = true;
|
||||||
|
@ -1901,12 +1901,12 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
// Redirect to the new asset page
|
// Redirect to the new asset page
|
||||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
|
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the asset management page with error
|
// Redirect to the asset management page with error
|
||||||
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
|
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue