mirror of https://github.com/itflow-org/itflow
Updated bulk action js to pass the checkboxe names into the get array this allows the use of multiple checkbox name arrays to be passed at once instead of just selected_ids had to update each bulk model from selected_ids to to the array that was passed. This was important so we could mix files and documents together
This commit is contained in:
parent
0347382a34
commit
53178b8d20
|
|
@ -94,26 +94,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/expense/expense_bulk_edit_category.php"
|
data-modal-url="modals/expense/expense_bulk_edit_category.php"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-list mr-2"></i>Set Category
|
<i class="fas fa-fw fa-list mr-2"></i>Set Category
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/expense/expense_bulk_edit_account.php"
|
data-modal-url="modals/expense/expense_bulk_edit_account.php"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-piggy-bank mr-2"></i>Set Account
|
<i class="fas fa-fw fa-piggy-bank mr-2"></i>Set Account
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/expense/expense_bulk_edit_client.php"
|
data-modal-url="modals/expense/expense_bulk_edit_client.php"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-user mr-2"></i>Set Client
|
<i class="fas fa-fw fa-user mr-2"></i>Set Client
|
||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger text-bold ajax-modal" href="#"
|
<a class="dropdown-item text-danger text-bold ajax-modal" href="#"
|
||||||
data-modal-url="modals/expense/expense_bulk_delete.php"
|
data-modal-url="modals/expense/expense_bulk_delete.php"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
|
|
@ -143,7 +143,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_vendors_filter = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE EXISTS (SELECT 1 FROM expenses WHERE expense_vendor_id = vendor_id) ORDER BY vendor_name ASC");
|
$sql_vendors_filter = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE EXISTS (SELECT 1 FROM expenses WHERE expense_vendor_id = vendor_id) ORDER BY vendor_name ASC");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_vendors_filter)) {
|
while ($row = mysqli_fetch_array($sql_vendors_filter)) {
|
||||||
$vendor_id = intval($row['vendor_id']);
|
$vendor_id = intval($row['vendor_id']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
|
@ -286,7 +286,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pr-0 bg-light">
|
<td class="pr-0 bg-light">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="selected_ids[]" value="<?= $expense_id ?>">
|
<input class="form-check-input bulk-select" type="checkbox" name="expense_ids[]" value="<?= $expense_id ?>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
|
|
@ -371,8 +371,8 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle" data-toggle="dropdown"><i class="fas fa-fw fa-plus mr-2"></i>New</button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle" data-toggle="dropdown"><i class="fas fa-fw fa-plus mr-2"></i>New</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
|
||||||
|
|
||||||
<a class="dropdown-item text-dark ajax-modal" href="#"
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
data-modal-url="modals/file/file_upload.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>">
|
data-modal-url="modals/file/file_upload.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>">
|
||||||
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload File
|
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload File
|
||||||
|
|
@ -447,24 +447,15 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/file/file_bulk_move.php?client_id=<?= $client_id ?>"
|
data-modal-url="modals/file/file_bulk_move.php?client_id=<?= $client_id ?>¤t_folder_id=<?= $get_folder_id ?>"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move Files
|
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move Files
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_bulk_move.php?client_id=<?= $client_id ?>"
|
|
||||||
data-bulk="true">
|
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move Documents
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<button class="dropdown-item text-danger text-bold"
|
<button class="dropdown-item text-danger text-bold"
|
||||||
type="submit" form="bulkActions" name="bulk_delete_files">
|
type="submit" form="bulkActions" name="bulk_delete_files">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete Files
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete Files
|
||||||
</button>
|
</button>
|
||||||
<button class="dropdown-item text-danger text-bold"
|
|
||||||
type="submit" form="bulkActions" name="bulk_delete_documents">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete Documents
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||||
<?php
|
<?php
|
||||||
$sql_tags_filter = mysqli_query($mysqli, "
|
$sql_tags_filter = mysqli_query($mysqli, "
|
||||||
SELECT tags.tag_id, tags.tag_name, tag_type
|
SELECT tags.tag_id, tags.tag_name, tag_type
|
||||||
FROM tags
|
FROM tags
|
||||||
LEFT JOIN location_tags ON location_tags.tag_id = tags.tag_id
|
LEFT JOIN location_tags ON location_tags.tag_id = tags.tag_id
|
||||||
LEFT JOIN locations ON location_tags.location_id = locations.location_id
|
LEFT JOIN locations ON location_tags.location_id = locations.location_id
|
||||||
WHERE tag_type = 2
|
WHERE tag_type = 2
|
||||||
|
|
@ -148,7 +148,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_clients_filter = mysqli_query($mysqli, "
|
$sql_clients_filter = mysqli_query($mysqli, "
|
||||||
SELECT DISTINCT client_id, client_name
|
SELECT DISTINCT client_id, client_name
|
||||||
FROM clients
|
FROM clients
|
||||||
JOIN locations ON location_client_id = client_id
|
JOIN locations ON location_client_id = client_id
|
||||||
WHERE $archive_query
|
WHERE $archive_query
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Priority <strong class="text-danger">*</strong></label>
|
<label>Priority <strong class="text-danger">*</strong></label>
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
$client_id = intval($_GET['client_id']);
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
$client_id = intval($_GET['client_id']);
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="remove_tags" value="0">
|
<input type="hidden" name="remove_tags" value="0">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$asset_ids = array_map('intval', $_GET['asset_ids'] ?? []);
|
||||||
$count = count($selected_ids);
|
$count = count($asset_ids);
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id'] ?? 0);
|
$client_id = intval($_GET['client_id'] ?? 0);
|
||||||
if ($client_id) {
|
if ($client_id) {
|
||||||
|
|
@ -25,7 +25,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="asset_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($asset_ids as $asset_id) { ?><input type="hidden" name="asset_ids[]" value="<?= $asset_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ ob_start();
|
||||||
<option value="">- Select Client -</option>
|
<option value="">- Select Client -</option>
|
||||||
<?php
|
<?php
|
||||||
$clients_sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $client_select_query");
|
$clients_sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $client_select_query");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($clients_sql)) {
|
while ($row = mysqli_fetch_array($clients_sql)) {
|
||||||
$client_id_select = intval($row["client_id"]);
|
$client_id_select = intval($row["client_id"]);
|
||||||
$client_name_select = nullable_htmlentities($row["client_name"]);
|
$client_name_select = nullable_htmlentities($row["client_name"]);
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -20,7 +20,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Priority <strong class="text-danger">*</strong></label>
|
<label>Priority <strong class="text-danger">*</strong></label>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,9 +19,9 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
<input type="hidden" name="bulk_remove_tags" value="0">
|
<input type="hidden" name="bulk_remove_tags" value="0">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,8 +18,8 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$client_ids = array_map('intval', $_GET['client_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($client_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="client_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($client_ids as $client_id) { ?><input type="hidden" name="client_ids[]" value="<?= $client_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
$client_id = intval($_GET['client_id']);
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="bulk_remove_tags" value="0">
|
<input type="hidden" name="bulk_remove_tags" value="0">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<label>Department / Group</label>
|
<label>Department / Group</label>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<label>Phone</label>
|
<label>Phone</label>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
<input type="hidden" name="bulk_contact_important" value="0">
|
<input type="hidden" name="bulk_contact_important" value="0">
|
||||||
<input type="hidden" name="bulk_contact_billing" value="0">
|
<input type="hidden" name="bulk_contact_billing" value="0">
|
||||||
<input type="hidden" name="bulk_contact_technical" value="0">
|
<input type="hidden" name="bulk_contact_technical" value="0">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$contact_ids = array_map('intval', $_GET['contact_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($contact_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="contact_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($contact_ids as $contact_id) { ?><input type="hidden" name="contact_ids[]" value="<?= $contact_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<label>From Email / Display Name</label>
|
<label>From Email / Display Name</label>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$credential_ids = array_map('intval', $_GET['credential_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($credential_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="credential_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($credential_ids as $credential_id) { ?><input type="hidden" name="credential_ids[]" value="<?= $credential_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="bulk_remove_tags" value="0">
|
<input type="hidden" name="bulk_remove_tags" value="0">
|
||||||
|
|
||||||
|
|
@ -64,4 +64,4 @@ ob_start();
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once '../../../includes/modal_footer.php';
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$expense_ids = array_map('intval', $_GET['expense_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($expense_ids);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -13,7 +13,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($expense_ids as $expense_id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $expense_id ?>"><?php } ?>
|
||||||
<div class="modal-body text-center">
|
<div class="modal-body text-center">
|
||||||
|
|
||||||
<div class="mb-4" style="text-align: center;">
|
<div class="mb-4" style="text-align: center;">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$expense_ids = array_map('intval', $_GET['expense_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($expense_ids);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($expense_ids as $expense_id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $expense_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$expense_ids = array_map('intval', $_GET['expense_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($expense_ids);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -21,8 +21,8 @@ ob_start();
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php
|
<?php
|
||||||
foreach ($selected_ids as $id) { ?>
|
foreach ($expense_ids as $expense_id) { ?>
|
||||||
<input type="hidden" name="expense_ids[]" value="<?= $id ?>">
|
<input type="hidden" name="expense_ids[]" value="<?= $expense_id ?>">
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$expense_ids = array_map('intval', $_GET['expense_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($expense_ids);
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -19,9 +19,9 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($expense_ids as $expense_id) { ?> <input type="hidden" name="expense_ids[]" value="<?= $expense_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,26 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id']);
|
$client_id = intval($_GET['client_id'] ?? 0);
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$current_folder_id = intval($_GET['current_folder_id'] ?? 0);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
// Selected IDs from JS (may be empty arrays)
|
||||||
|
$file_ids = array_map('intval', $_GET['file_ids'] ?? []);
|
||||||
|
$document_ids = array_map('intval', $_GET['document_ids'] ?? []);
|
||||||
|
|
||||||
|
$count_files = count($file_ids);
|
||||||
|
$count_docs = count($document_ids);
|
||||||
|
$total = $count_files + $count_docs;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-exchange-alt mr-2"></i>Move <strong><?= $count ?></strong> Files</h5>
|
<h5 class="modal-title">
|
||||||
|
<i class="fa fa-fw fa-exchange-alt mr-2"></i>
|
||||||
|
Move <strong><?= $total ?></strong> Item<?= $total === 1 ? '' : 's' ?>
|
||||||
|
</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -20,10 +29,22 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="file_ids[]" value="<?= $id ?>"><?php } ?>
|
|
||||||
|
<?php foreach ($file_ids as $id): ?>
|
||||||
|
<input type="hidden" name="file_ids[]" value="<?= $id ?>">
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<?php foreach ($document_ids as $id): ?>
|
||||||
|
<input type="hidden" name="document_ids[]" value="<?= $id ?>">
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Files: <strong><?= $count_files ?></strong><br>
|
||||||
|
Documents: <strong><?= $count_docs ?></strong>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Target Folder</label>
|
<label>Target Folder</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
@ -32,75 +53,81 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="bulk_folder_id">
|
<select class="form-control select2" name="bulk_folder_id">
|
||||||
<option value="0">/</option>
|
<option value="0">/</option>
|
||||||
<?php
|
<?php
|
||||||
// Fetch all folders for the client
|
// NOTE: folder_location is gone now, so just use folder_client_id
|
||||||
$sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
$sql_all_folders = mysqli_query(
|
||||||
$folders = array();
|
$mysqli,
|
||||||
|
"SELECT folder_id, folder_name, parent_folder
|
||||||
|
FROM folders
|
||||||
|
WHERE folder_client_id = $client_id
|
||||||
|
ORDER BY folder_name ASC"
|
||||||
|
);
|
||||||
|
|
||||||
// Build an associative array of folders indexed by folder_id
|
$folders = [];
|
||||||
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
|
||||||
$folders[$row['folder_id']] = array(
|
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
|
||||||
'folder_id' => intval($row['folder_id']),
|
$folders[$row['folder_id']] = [
|
||||||
'folder_name' => nullable_htmlentities($row['folder_name']),
|
'folder_id' => (int)$row['folder_id'],
|
||||||
'parent_folder' => intval($row['parent_folder']),
|
'folder_name' => nullable_htmlentities($row['folder_name']),
|
||||||
'children' => array()
|
'parent_folder'=> (int)$row['parent_folder'],
|
||||||
);
|
'children' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build hierarchy
|
||||||
|
foreach ($folders as $id => &$folder) {
|
||||||
|
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
||||||
|
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
unset($folder);
|
||||||
|
|
||||||
// Build the folder hierarchy
|
$root_folders = [];
|
||||||
foreach ($folders as $id => &$folder) {
|
foreach ($folders as $id => $folder) {
|
||||||
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
|
if ($folder['parent_folder'] == 0) {
|
||||||
$folders[$folder['parent_folder']]['children'][] = &$folder;
|
$root_folders[] = $folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: if you want to default-select current folder, pass it in GET
|
||||||
|
$current_folder_id = intval($_GET['current_folder_id'] ?? 0);
|
||||||
|
|
||||||
|
$stack = [];
|
||||||
|
foreach (array_reverse($root_folders) as $folder) {
|
||||||
|
$stack[] = ['folder' => $folder, 'level' => 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!empty($stack)) {
|
||||||
|
$node = array_pop($stack);
|
||||||
|
$folder = $node['folder'];
|
||||||
|
$level = $node['level'];
|
||||||
|
|
||||||
|
$indentation = str_repeat(' ', $level * 4);
|
||||||
|
|
||||||
|
$selected = ($folder['folder_id'] === $current_folder_id) ? 'selected' : '';
|
||||||
|
|
||||||
|
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
||||||
|
|
||||||
|
if (!empty($folder['children'])) {
|
||||||
|
foreach (array_reverse($folder['children']) as $child) {
|
||||||
|
$stack[] = ['folder' => $child, 'level' => $level + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($folder); // Break the reference
|
}
|
||||||
|
?>
|
||||||
// Prepare a list of root folders
|
|
||||||
$root_folders = array();
|
|
||||||
foreach ($folders as $id => $folder) {
|
|
||||||
if ($folder['parent_folder'] == 0) {
|
|
||||||
$root_folders[] = $folder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display the folder options iteratively
|
|
||||||
$stack = array();
|
|
||||||
foreach (array_reverse($root_folders) as $folder) {
|
|
||||||
$stack[] = array('folder' => $folder, 'level' => 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!empty($stack)) {
|
|
||||||
$node = array_pop($stack);
|
|
||||||
$folder = $node['folder'];
|
|
||||||
$level = $node['level'];
|
|
||||||
|
|
||||||
// Indentation for subfolders
|
|
||||||
$indentation = str_repeat(' ', $level * 4);
|
|
||||||
|
|
||||||
// Check if this folder is selected
|
|
||||||
$selected = '';
|
|
||||||
if ($folder['folder_id'] == $get_folder_id) {
|
|
||||||
$selected = 'selected';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
|
|
||||||
|
|
||||||
// Add children to the stack
|
|
||||||
if (!empty($folder['children'])) {
|
|
||||||
foreach (array_reverse($folder['children']) as $child_folder) {
|
|
||||||
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="bulk_move_files" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move Files</button>
|
<button type="submit" name="bulk_move_files" class="btn btn-primary text-bold">
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<i class="fa fa-check mr-2"></i>Move Files
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$invoice_ids = array_map('intval', $_GET['invoice_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($invoice_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="invoice_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($invoice_ids as $invoice_id) { ?><input type="hidden" name="invoice_ids[]" value="<?= $invoice_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$location_ids = array_map('intval', $_GET['location_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($location_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="location_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($location_ids as $location_id) { ?><input type="hidden" name="location_ids[]" value="<?= $location_id ?>"><?php } ?>
|
||||||
<input type="hidden" name="bulk_remove_tags" value="0">
|
<input type="hidden" name="bulk_remove_tags" value="0">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$recurring_ticket_ids = array_map('intval', $_GET['recurring_ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($recurring_ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($recurring_ticket_ids as $recurring_ticket_id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>"><?php } ?>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -34,7 +34,7 @@ ob_start();
|
||||||
$sql_users_select = mysqli_query($mysqli, "SELECT user_id, user_name FROM users
|
$sql_users_select = mysqli_query($mysqli, "SELECT user_id, user_name FROM users
|
||||||
WHERE user_type = 1
|
WHERE user_type = 1
|
||||||
AND user_status = 1
|
AND user_status = 1
|
||||||
AND user_archived_at IS NULL
|
AND user_archived_at IS NULL
|
||||||
ORDER BY user_name DESC"
|
ORDER BY user_name DESC"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql_users_select)) {
|
while ($row = mysqli_fetch_array($sql_users_select)) {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$recurring_ticket_ids = array_map('intval', $_GET['recurring_ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($recurring_ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($recurring_ticket_ids as $recurring_ticket_id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$recurring_ticket_ids = array_map('intval', $_GET['recurring_ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($recurring_ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($recurring_ticket_ids as $recurring_ticket_id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$recurring_ticket_ids = array_map('intval', $_GET['recurring_ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($recurring_ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($recurring_ticket_ids as $recurring_ticket_id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$recurring_ticket_ids = array_map('intval', $_GET['recurring_ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($recurring_ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($recurring_ticket_ids as $recurring_ticket_id) { ?><input type="hidden" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -32,7 +32,7 @@ ob_start();
|
||||||
<select class="form-control select2" name="project_id">
|
<select class="form-control select2" name="project_id">
|
||||||
<option value="0">No Project</option>
|
<option value="0">No Project</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_projects_select = mysqli_query($mysqli, "SELECT project_id, project_name, project_prefix, project_number FROM projects
|
$sql_projects_select = mysqli_query($mysqli, "SELECT project_id, project_name, project_prefix, project_number FROM projects
|
||||||
WHERE project_archived_at IS NULL
|
WHERE project_archived_at IS NULL
|
||||||
AND project_completed_at IS NULL
|
AND project_completed_at IS NULL
|
||||||
ORDER BY project_name DESC"
|
ORDER BY project_name DESC"
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ ob_start();
|
||||||
$sql_users_select = mysqli_query($mysqli, "SELECT user_id, user_name FROM users
|
$sql_users_select = mysqli_query($mysqli, "SELECT user_id, user_name FROM users
|
||||||
WHERE user_type = 1
|
WHERE user_type = 1
|
||||||
AND user_status = 1
|
AND user_status = 1
|
||||||
AND user_archived_at IS NULL
|
AND user_archived_at IS NULL
|
||||||
ORDER BY user_name ASC"
|
ORDER BY user_name ASC"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql_users_select)) {
|
while ($row = mysqli_fetch_array($sql_users_select)) {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -46,4 +46,4 @@ ob_start();
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once '../../../includes/modal_footer.php';
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
<input type="hidden" id="current_ticket_id" value="0"> <!-- Can't currently bulk check this -->
|
<input type="hidden" id="current_ticket_id" value="0"> <!-- Can't currently bulk check this -->
|
||||||
<input type="hidden" name="merge_move_replies" value="0"> <!-- Default 0 -->
|
<input type="hidden" name="merge_move_replies" value="0"> <!-- Default 0 -->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
<input type="hidden" name="bulk_private_reply" value="0">
|
<input type="hidden" name="bulk_private_reply" value="0">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$selected_ids = array_map('intval', $_GET['selected_ids'] ?? []);
|
$ticket_ids = array_map('intval', $_GET['ticket_ids'] ?? []);
|
||||||
|
|
||||||
$count = count($selected_ids);
|
$count = count($ticket_ids);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ ob_start();
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<?php foreach ($selected_ids as $id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $id ?>"><?php } ?>
|
<?php foreach ($ticket_ids as $ticket_id) { ?><input type="hidden" name="ticket_ids[]" value="<?= $ticket_id ?>"><?php } ?>
|
||||||
<input type="hidden" name="bulk_private_note" value="0">
|
<input type="hidden" name="bulk_private_note" value="0">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
|
||||||
|
|
@ -68,15 +68,15 @@ if (isset($_POST['upload_files'])) {
|
||||||
$file_hash = strstr($file_reference_name, '.', true) ?: $file_reference_name;
|
$file_hash = strstr($file_reference_name, '.', true) ?: $file_reference_name;
|
||||||
|
|
||||||
// Insert file metadata into the database
|
// Insert file metadata into the database
|
||||||
$query = "INSERT INTO files SET
|
$query = "INSERT INTO files SET
|
||||||
file_reference_name = '$file_reference_name',
|
file_reference_name = '$file_reference_name',
|
||||||
file_name = '$file_name',
|
file_name = '$file_name',
|
||||||
file_description = '$description',
|
file_description = '$description',
|
||||||
file_ext = '$file_extension',
|
file_ext = '$file_extension',
|
||||||
file_mime_type = '$file_mime_type',
|
file_mime_type = '$file_mime_type',
|
||||||
file_size = $file_size,
|
file_size = $file_size,
|
||||||
file_created_by = $session_user_id,
|
file_created_by = $session_user_id,
|
||||||
file_folder_id = $folder_id,
|
file_folder_id = $folder_id,
|
||||||
file_client_id = $client_id";
|
file_client_id = $client_id";
|
||||||
mysqli_query($mysqli, $query);
|
mysqli_query($mysqli, $query);
|
||||||
$file_id = mysqli_insert_id($mysqli);
|
$file_id = mysqli_insert_id($mysqli);
|
||||||
|
|
@ -90,7 +90,7 @@ if (isset($_POST['upload_files'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
logAction("File", "Upload", "$session_name uploaded file $file_name", $client_id, $file_id);
|
logAction("File", "Upload", "$session_name uploaded file $file_name", $client_id, $file_id);
|
||||||
|
|
||||||
flash_alert("Uploaded file <strong>$file_name</strong>");
|
flash_alert("Uploaded file <strong>$file_name</strong>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -255,47 +255,117 @@ if (isset($_POST['bulk_delete_files'])) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unified bulk move for Files + Documents
|
||||||
if (isset($_POST['bulk_move_files'])) {
|
if (isset($_POST['bulk_move_files'])) {
|
||||||
|
|
||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
enforceUserPermission('module_support', 2);
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
$folder_id = intval($_POST['bulk_folder_id']);
|
$folder_id = intval($_POST['bulk_folder_id']);
|
||||||
|
|
||||||
// Get folder name for logging and Notification
|
// Default values (for root or missing folder)
|
||||||
$sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id");
|
$folder_name = "/";
|
||||||
$row = mysqli_fetch_array($sql);
|
$log_client_id = 0;
|
||||||
$folder_name = sanitizeInput($row['folder_name']);
|
|
||||||
$client_id = intval($row['folder_client_id']);
|
|
||||||
|
|
||||||
// Check array for data
|
// If moving into a real folder, get folder name + client for logging
|
||||||
if (isset($_POST['file_ids'])) {
|
if ($folder_id > 0) {
|
||||||
// Get Selected file Count
|
$sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id");
|
||||||
$file_count = count($_POST['file_ids']);
|
if ($row = mysqli_fetch_array($sql)) {
|
||||||
|
$folder_name = sanitizeInput($row['folder_name']);
|
||||||
|
$log_client_id = intval($row['folder_client_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_count = 0;
|
||||||
|
$document_count = 0;
|
||||||
|
|
||||||
|
// -------------------------
|
||||||
|
// Move FILES (if any)
|
||||||
|
// -------------------------
|
||||||
|
if (!empty($_POST['file_ids']) && is_array($_POST['file_ids'])) {
|
||||||
|
|
||||||
|
$file_ids = array_map('intval', $_POST['file_ids']);
|
||||||
|
$file_count = count($file_ids);
|
||||||
|
|
||||||
|
foreach ($file_ids as $file_id) {
|
||||||
|
|
||||||
// Move Documents to Folder Loop
|
|
||||||
foreach($_POST['file_ids'] as $file_id) {
|
|
||||||
$file_id = intval($file_id);
|
|
||||||
|
|
||||||
// Get file name for logging
|
// Get file name for logging
|
||||||
$file_name = sanitizeInput(getFieldById('files', $file_id, 'file_name'));
|
$file_name = sanitizeInput(getFieldById('files', $file_id, 'file_name'));
|
||||||
|
|
||||||
// file move query
|
// Move file
|
||||||
mysqli_query($mysqli,"UPDATE files SET file_folder_id = $folder_id WHERE file_id = $file_id");
|
mysqli_query($mysqli,"UPDATE files SET file_folder_id = $folder_id WHERE file_id = $file_id");
|
||||||
|
|
||||||
logAction("File", "Move", "$session_name moved file $file_name to folder $folder_name", $client_id, $file_id);
|
// Per-file log
|
||||||
|
logAction(
|
||||||
|
"File",
|
||||||
|
"Move",
|
||||||
|
"$session_name moved file $file_name to folder $folder_name",
|
||||||
|
$log_client_id,
|
||||||
|
$file_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
logAction("File", "Bulk Move", "$session_name moved $file_count file(s) to folder $folder_name", $client_id);
|
// Bulk summary log for files
|
||||||
|
logAction(
|
||||||
|
"File",
|
||||||
|
"Bulk Move",
|
||||||
|
"$session_name moved $file_count file(s) to folder $folder_name",
|
||||||
|
$log_client_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
flash_alert("Moved <strong>$file_count</strong> files to the folder <strong>$folder_name</strong>");
|
// -------------------------
|
||||||
|
// Move DOCUMENTS (if any)
|
||||||
|
// -------------------------
|
||||||
|
if (!empty($_POST['document_ids']) && is_array($_POST['document_ids'])) {
|
||||||
|
|
||||||
|
$document_ids = array_map('intval', $_POST['document_ids']);
|
||||||
|
$document_count = count($document_ids);
|
||||||
|
|
||||||
|
foreach ($document_ids as $document_id) {
|
||||||
|
|
||||||
|
// Get document name for logging
|
||||||
|
$document_name = sanitizeInput(getFieldById('documents', $document_id, 'document_name'));
|
||||||
|
|
||||||
|
// Move document
|
||||||
|
mysqli_query($mysqli,"UPDATE documents SET document_folder_id = $folder_id WHERE document_id = $document_id");
|
||||||
|
|
||||||
|
// Per-document log
|
||||||
|
logAction(
|
||||||
|
"Document",
|
||||||
|
"Move",
|
||||||
|
"$session_name moved document $document_name to folder $folder_name",
|
||||||
|
$log_client_id,
|
||||||
|
$document_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bulk summary log for documents
|
||||||
|
logAction(
|
||||||
|
"Document",
|
||||||
|
"Bulk Move",
|
||||||
|
"$session_name moved $document_count document(s) to folder $folder_name",
|
||||||
|
$log_client_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------
|
||||||
|
// Flash message
|
||||||
|
// -------------------------
|
||||||
|
if ($file_count && $document_count) {
|
||||||
|
flash_alert("Moved <strong>$file_count</strong> file(s) and <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>");
|
||||||
|
} elseif ($file_count) {
|
||||||
|
flash_alert("Moved <strong>$file_count</strong> file(s) to the folder <strong>$folder_name</strong>");
|
||||||
|
} elseif ($document_count) {
|
||||||
|
flash_alert("Moved <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>");
|
||||||
|
} else {
|
||||||
|
flash_alert("No items were moved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect();
|
redirect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($_POST['link_asset_to_file'])) {
|
if (isset($_POST['link_asset_to_file'])) {
|
||||||
|
|
||||||
enforceUserPermission('module_support', 2);
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,18 @@
|
||||||
$(document).on('click', '.ajax-modal', function (e) {
|
$(document).on('click', '.ajax-modal', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const $trigger = $(this);
|
const $trigger = $(this);
|
||||||
let modalUrl = $trigger.data('modal-url');
|
|
||||||
|
// Prefer data-modal-url, fallback to href
|
||||||
|
let modalUrl = $trigger.data('modal-url') || $trigger.attr('href') || '#';
|
||||||
const modalSize = $trigger.data('modal-size') || 'md';
|
const modalSize = $trigger.data('modal-size') || 'md';
|
||||||
const modalId = 'ajaxModal_' + new Date().getTime();
|
const modalId = 'ajaxModal_' + Date.now();
|
||||||
|
|
||||||
// -------- Optional bulk mode (activated via data-bulk="true") --------
|
// If no usable URL, bail
|
||||||
if ($trigger.data('bulk') === true || $trigger.data('bulk') === 'true') {
|
if (!modalUrl || modalUrl === '#') {
|
||||||
const selector = $trigger.data('bulk-selector') || '.bulk-select:checked';
|
console.warn('ajax-modal: No modal URL found on trigger:', this);
|
||||||
const param = $trigger.data('bulk-param') || 'selected_ids[]';
|
return;
|
||||||
|
|
||||||
const ids = Array.from(document.querySelectorAll(selector)).map(cb => cb.value);
|
|
||||||
|
|
||||||
if (!ids.length) {
|
|
||||||
alert('Please select at least one item.');
|
|
||||||
return; // abort opening modal
|
|
||||||
}
|
|
||||||
|
|
||||||
// Merge ids into existing query string safely
|
|
||||||
const urlObj = new URL(modalUrl, window.location.href);
|
|
||||||
ids.forEach(id => urlObj.searchParams.append(param, id));
|
|
||||||
|
|
||||||
// Preserve path + updated query (avoid absolute origin for relative AJAX)
|
|
||||||
modalUrl = urlObj.pathname + (urlObj.search ? '?' + urlObj.searchParams.toString() : '');
|
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Show loading spinner while fetching content
|
// Show loading spinner while fetching content
|
||||||
const loadingSpinner = `
|
const loadingSpinner = `
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,19 @@
|
||||||
// bulk_actions.js
|
// bulk_actions.js
|
||||||
// Allow selecting and editing multiple records at once (no <form> dependency)
|
// Shared bulk helper: selection count + simple URL enrichment for bulk actions
|
||||||
|
|
||||||
// --- Helpers ---
|
// --- Helpers ---
|
||||||
function getCheckboxes() {
|
function getBulkCheckboxes() {
|
||||||
// Always query fresh in case rows are re-rendered
|
// Always query fresh in case rows are re-rendered
|
||||||
return Array.from(document.querySelectorAll('input[type="checkbox"].bulk-select'));
|
return Array.from(document.querySelectorAll('input[type="checkbox"].bulk-select'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedIds() {
|
function getSelectedCount() {
|
||||||
return getCheckboxes()
|
return getBulkCheckboxes().filter(cb => cb.checked).length;
|
||||||
.filter(cb => cb.checked)
|
|
||||||
.map(cb => cb.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelectedCount() {
|
function updateSelectedCount() {
|
||||||
const count = getSelectedIds().length;
|
const count = getSelectedCount();
|
||||||
|
|
||||||
const selectedCountEl = document.getElementById('selectedCount');
|
const selectedCountEl = document.getElementById('selectedCount');
|
||||||
if (selectedCountEl) {
|
if (selectedCountEl) {
|
||||||
selectedCountEl.textContent = count;
|
selectedCountEl.textContent = count;
|
||||||
|
|
@ -28,95 +27,96 @@ function updateSelectedCount() {
|
||||||
|
|
||||||
// --- Select All Handling ---
|
// --- Select All Handling ---
|
||||||
function checkAll(source) {
|
function checkAll(source) {
|
||||||
getCheckboxes().forEach(cb => {
|
getBulkCheckboxes().forEach(cb => {
|
||||||
cb.checked = source.checked;
|
cb.checked = source.checked;
|
||||||
});
|
});
|
||||||
updateSelectedCount();
|
updateSelectedCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wire select-all checkbox if present
|
// --- Wire up once DOM is ready ---
|
||||||
const selectAllCheckbox = document.getElementById('selectAllCheckbox');
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
if (selectAllCheckbox) {
|
|
||||||
selectAllCheckbox.addEventListener('click', function () {
|
|
||||||
checkAll(this);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Per-row Checkbox Handling ---
|
// Initialize count
|
||||||
document.addEventListener('click', function (e) {
|
|
||||||
const cb = e.target.closest('input[type="checkbox"].bulk-select');
|
|
||||||
if (!cb) return;
|
|
||||||
updateSelectedCount();
|
updateSelectedCount();
|
||||||
|
|
||||||
|
// Wire select-all checkbox if present
|
||||||
|
const selectAllCheckbox = document.getElementById('selectAllCheckbox');
|
||||||
|
if (selectAllCheckbox) {
|
||||||
|
selectAllCheckbox.addEventListener('click', function () {
|
||||||
|
checkAll(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Per-row checkbox handling
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
const cb = e.target.closest('input[type="checkbox"].bulk-select');
|
||||||
|
if (!cb) return;
|
||||||
|
updateSelectedCount();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ------------------------------------------------------
|
||||||
|
// Generic bulk handler
|
||||||
|
//
|
||||||
|
// For ANY element with data-bulk="true":
|
||||||
|
// - Reads base URL from data-modal-url or href
|
||||||
|
// - Collects ALL checked .bulk-select checkboxes
|
||||||
|
// - Appends:
|
||||||
|
// <cb.name> = cb.value
|
||||||
|
// e.g. file_ids[]=12, document_ids[]=27, client_ids[]=3, etc.
|
||||||
|
// - Writes URL back to data-modal-url or href
|
||||||
|
// - DOES NOT prevent default, so ajax-modal / normal links still work
|
||||||
|
// ------------------------------------------------------
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
const trigger = e.target.closest('[data-bulk="true"]');
|
||||||
|
if (!trigger) return;
|
||||||
|
|
||||||
|
const base = trigger.getAttribute('data-modal-url') || trigger.getAttribute('href');
|
||||||
|
if (!base || base === '#') return;
|
||||||
|
|
||||||
|
let url;
|
||||||
|
try {
|
||||||
|
url = new URL(base, window.location.href);
|
||||||
|
} catch (err) {
|
||||||
|
// Invalid URL, bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const params = url.searchParams;
|
||||||
|
const checked = getBulkCheckboxes().filter(cb => cb.checked);
|
||||||
|
|
||||||
|
if (!checked.length) {
|
||||||
|
// Nothing selected; do nothing (no ids appended)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect all unique names (file_ids[], document_ids[], client_ids[], etc.)
|
||||||
|
const namesToClear = new Set();
|
||||||
|
checked.forEach(cb => {
|
||||||
|
if (cb.name) {
|
||||||
|
namesToClear.add(cb.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear any existing values for those names
|
||||||
|
namesToClear.forEach(name => params.delete(name));
|
||||||
|
|
||||||
|
// Append each checked checkbox as name=value
|
||||||
|
checked.forEach(cb => {
|
||||||
|
if (!cb.name) return;
|
||||||
|
params.append(cb.name, cb.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
const finalUrl = url.pathname + '?' + params.toString();
|
||||||
|
|
||||||
|
if (trigger.hasAttribute('data-modal-url')) {
|
||||||
|
trigger.setAttribute('data-modal-url', finalUrl);
|
||||||
|
} else {
|
||||||
|
trigger.setAttribute('href', finalUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IMPORTANT:
|
||||||
|
// We do NOT call preventDefault().
|
||||||
|
// Your existing ajax-modal handler / normal link click will continue normally,
|
||||||
|
// now using the updated URL.
|
||||||
|
}, true); // capture so we run before other click handlers
|
||||||
});
|
});
|
||||||
|
|
||||||
// --- Initialize count on page load ---
|
|
||||||
document.addEventListener('DOMContentLoaded', updateSelectedCount);
|
|
||||||
|
|
||||||
// ------------------------------------------------------
|
|
||||||
// Generic bulk handler driven by data-bulk / data-bulk-names
|
|
||||||
// ------------------------------------------------------
|
|
||||||
// Behavior:
|
|
||||||
//
|
|
||||||
// 1) If NO data-bulk-names:
|
|
||||||
// - all checked .bulk-select => ?selected_ids[]=1&selected_ids[]=2...
|
|
||||||
//
|
|
||||||
// 2) If data-bulk-names="file_ids[],document_ids[]":
|
|
||||||
// - checked name="file_ids[]" => ?file_ids[]=1&file_ids[]=2...
|
|
||||||
// - checked name="document_ids[]" => ?document_ids[]=5...
|
|
||||||
//
|
|
||||||
// Works with either data-modal-url or href.
|
|
||||||
// Does NOT open modal or prevent default; it just rewrites the URL.
|
|
||||||
document.addEventListener('click', function (e) {
|
|
||||||
const trigger = e.target.closest('[data-bulk="true"]');
|
|
||||||
if (!trigger) return;
|
|
||||||
|
|
||||||
// Base URL: prefer data-modal-url (ajax-modal style), fallback to href
|
|
||||||
const baseUrl = trigger.getAttribute('data-modal-url') || trigger.getAttribute('href');
|
|
||||||
if (!baseUrl || baseUrl === '#') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const url = new URL(baseUrl, window.location.origin);
|
|
||||||
const params = url.searchParams;
|
|
||||||
|
|
||||||
const bulkNamesAttr = trigger.getAttribute('data-bulk-names');
|
|
||||||
const checkboxes = getCheckboxes().filter(cb => cb.checked);
|
|
||||||
|
|
||||||
// Clear previous ids (in case link is reused)
|
|
||||||
params.delete('selected_ids[]');
|
|
||||||
|
|
||||||
if (bulkNamesAttr && bulkNamesAttr.trim() !== '') {
|
|
||||||
// New behavior: group by checkbox name
|
|
||||||
const bulkNames = bulkNamesAttr
|
|
||||||
.split(',')
|
|
||||||
.map(s => s.trim())
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
// Clear specific names first
|
|
||||||
bulkNames.forEach(name => params.delete(name));
|
|
||||||
|
|
||||||
// Append values by name
|
|
||||||
bulkNames.forEach(name => {
|
|
||||||
checkboxes.forEach(cb => {
|
|
||||||
if (cb.name === name) {
|
|
||||||
params.append(name, cb.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Old behavior: everything as selected_ids[]
|
|
||||||
checkboxes.forEach(cb => {
|
|
||||||
params.append('selected_ids[]', cb.value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalUrl = url.pathname + '?' + params.toString();
|
|
||||||
|
|
||||||
// Write back to data-modal-url if present, else to href
|
|
||||||
if (trigger.hasAttribute('data-modal-url')) {
|
|
||||||
trigger.setAttribute('data-modal-url', finalUrl);
|
|
||||||
} else {
|
|
||||||
trigger.setAttribute('href', finalUrl);
|
|
||||||
}
|
|
||||||
// NOTE: we do NOT call preventDefault(), we do NOT open modals here.
|
|
||||||
}, true); // use capture so this runs before other click handlers
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue