Merge pull request #1225 from itflow-org/bulk-assign-phyloc
Add physical location modal - not working
This commit is contained in:
34
assets.php
34
assets.php
@@ -316,6 +316,9 @@ if (mysqli_num_rows($os_sql) > 0) {
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignLocationModal">
|
||||
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Assign Location
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignPhysicalLocationModal">
|
||||
<i class="fas fa-fw fa-map-marker-alt mr-2"></i>Set Physical Location
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditStatusModal">
|
||||
<i class="fas fa-fw fa-info mr-2"></i>Set Status
|
||||
@@ -325,22 +328,22 @@ if (mysqli_num_rows($os_sql) > 0) {
|
||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Create Tickets
|
||||
</a>
|
||||
<?php if ($archived) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-info"
|
||||
type="submit" form="bulkActions" name="bulk_unarchive_assets">
|
||||
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
||||
</button>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger text-bold"
|
||||
type="submit" form="bulkActions" name="bulk_delete_assets">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</button>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-info"
|
||||
type="submit" form="bulkActions" name="bulk_unarchive_assets">
|
||||
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
||||
</button>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger text-bold"
|
||||
type="submit" form="bulkActions" name="bulk_delete_assets">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</button>
|
||||
<?php } else { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger confirm-link"
|
||||
type="submit" form="bulkActions" name="bulk_archive_assets">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</button>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger confirm-link"
|
||||
type="submit" form="bulkActions" name="bulk_archive_assets">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -686,6 +689,7 @@ if (mysqli_num_rows($os_sql) > 0) {
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "modals/asset_bulk_assign_location_modal.php"; ?>
|
||||
<?php require_once "modals/asset_bulk_assign_physical_location_modal.php"; ?>
|
||||
<?php require_once "modals/asset_bulk_assign_contact_modal.php"; ?>
|
||||
<?php require_once "modals/asset_bulk_transfer_client_modal.php"; ?>
|
||||
<?php require_once "modals/asset_bulk_edit_status_modal.php"; ?>
|
||||
|
||||
31
modals/asset_bulk_assign_physical_location_modal.php
Normal file
31
modals/asset_bulk_assign_physical_location_modal.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="modal" id="bulkAssignPhysicalLocationModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Bulk Set Physical Location</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Physical Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="bulk_assign_asset_physical_location" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Assign</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -211,10 +211,10 @@ if (isset($_POST['bulk_assign_asset_location'])) {
|
||||
$location_name = sanitizeInput($row['location_name']);
|
||||
$client_id = intval($row['location_client_id']);
|
||||
|
||||
// Assign Location to Selected Contacts
|
||||
// Assign Location to Selected Assets
|
||||
if (isset($_POST['asset_ids'])) {
|
||||
|
||||
// Get Selected Contacts Count
|
||||
// Get Selected Asset Count
|
||||
$asset_count = count($_POST['asset_ids']);
|
||||
|
||||
foreach($_POST['asset_ids'] as $asset_id) {
|
||||
@@ -242,6 +242,45 @@ if (isset($_POST['bulk_assign_asset_location'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['bulk_assign_asset_physical_location'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
$physical_location = sanitizeInput($_POST['physical_location']);
|
||||
|
||||
// Assign Physical Location to Selected Assets
|
||||
if (isset($_POST['asset_ids'])) {
|
||||
|
||||
// Get Selected Assets Count
|
||||
$asset_count = count($_POST['asset_ids']);
|
||||
|
||||
foreach($_POST['asset_ids'] as $asset_id) {
|
||||
$asset_id = intval($asset_id);
|
||||
|
||||
// Get Asset Details for Logging
|
||||
$sql = mysqli_query($mysqli,"SELECT asset_name, asset_client_id FROM assets WHERE asset_id = $asset_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$asset_name = sanitizeInput($row['asset_name']);
|
||||
$client_id = intval($row['asset_client_id']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE assets SET asset_physical_location = '$physical_location' WHERE asset_id = $asset_id");
|
||||
|
||||
//Logging
|
||||
logAction("Asset", "Edit", "$session_name set asset $asset_name to physical location $physical_location", $client_id, $asset_id);
|
||||
|
||||
} // End Assign Location Loop
|
||||
|
||||
// Bulk Logging
|
||||
logAction("Asset", "Bulk Edit", "$session_name set $asset_count assets to physical location $physical_location", $client_id);
|
||||
|
||||
$_SESSION['alert_message'] = "You moved <strong>$asset_count</strong> assets to location <strong>$location_name</strong>";
|
||||
}
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['bulk_transfer_client_asset'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
Reference in New Issue
Block a user