Skip to content

Commit

Permalink
mkdir not recursive (#2460)
Browse files Browse the repository at this point in the history
* Fix path to snipeit-ssl.crt (#2428)

* Modified 'recursive' part of the tuple to true
  • Loading branch information
ehanlon authored and snipe committed Sep 21, 2016
1 parent bcc6ca5 commit 5800912
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions app/Http/Controllers/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function postCreate(AssetRequest $request)
$directory= public_path('uploads/assets/');
// Check if the uploads directory exists. If not, try to create it.
if (!file_exists($directory)) {
mkdir($directory, 0755);
mkdir($directory, 0755, true);
}
$path = public_path('uploads/assets/'.$file_name);
try {
Expand Down Expand Up @@ -288,7 +288,7 @@ public function postCreate(AssetRequest $request)
*/
public function getEdit($assetId = null)
{

// Check if the asset exists
if (!$asset = Asset::find($assetId)) {
// Redirect to the asset management page
Expand Down Expand Up @@ -407,7 +407,7 @@ public function postEdit(AssetRequest $request, $assetId = null)
$directory= public_path('uploads/assets/');
// Check if the uploads directory exists. If not, try to create it.
if (!file_exists($directory)) {
mkdir($directory, 0755);
mkdir($directory, 0755, true);
}

$file_name = str_random(25).".".$extension;
Expand Down Expand Up @@ -840,7 +840,7 @@ public function getImportUpload()

// Check if the uploads directory exists. If not, try to create it.
if (!file_exists($path)) {
mkdir($path, 0755);
mkdir($path, 0755, true);
}
if ($handle = opendir($path)) {

Expand Down Expand Up @@ -1424,7 +1424,7 @@ public function postBulkEdit($assets = null)

return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);



} elseif (Input::get('bulk_actions')=='delete') {

Expand Down Expand Up @@ -1854,12 +1854,12 @@ public function getBulkCheckout()
$users_list = Helper::usersList();
// Filter out assets that are not deployable.
$assets = Asset::RTD()->get();

$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);
}

public function postBulkCheckout(Request $request)
{

Expand All @@ -1869,44 +1869,44 @@ public function postBulkCheckout(Request $request)

$user = User::find(e(Input::get('assigned_to')));
$admin = Auth::user();

$asset_ids = array_filter(Input::get('selected_assets'));

if ((Input::has('checkout_at')) && (Input::get('checkout_at')!= date("Y-m-d"))) {
$checkout_at = e(Input::get('checkout_at'));
} else {
$checkout_at = date("Y-m-d H:i:s");
}

if (Input::has('expected_checkin')) {
$expected_checkin = e(Input::get('expected_checkin'));
} else {
$expected_checkin = '';
}

$has_errors = false;
$errors = [];
DB::transaction(function() use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids)
{
{
foreach($asset_ids as $asset_id)
{
$asset = Asset::find($asset_id);

$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);

if($error)
{
$has_errors = true;
array_merge_recursive($errors, $asset->getErrors()->toArray());
}
}
});

if (!$errors) {
// Redirect to the new asset page
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
}

// Redirect to the asset management page with error
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
}
Expand Down

0 comments on commit 5800912

Please sign in to comment.