mirror of https://github.com/itflow-org/itflow
Feature: Records per page is now user specific and persists with logout/login sessions
This commit is contained in:
parent
94caee4aa6
commit
ce2ba6d3d2
|
|
@ -42,6 +42,7 @@ if ($session_user_role == 3) {
|
|||
} else {
|
||||
$session_user_role_display = "Accountant";
|
||||
}
|
||||
$user_config_records_per_page = intval($row['user_config_records_per_page']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
|
|
|||
1977
database_updates.php
1977
database_updates.php
File diff suppressed because it is too large
Load Diff
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.6.9");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.7.0");
|
||||
|
|
|
|||
3
db.sql
3
db.sql
|
|
@ -1557,6 +1557,7 @@ DROP TABLE IF EXISTS `user_settings`;
|
|||
CREATE TABLE `user_settings` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`user_role` int(11) NOT NULL,
|
||||
`user_config_records_per_page` int(11) NOT NULL DEFAULT 10,
|
||||
PRIMARY KEY (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
|
@ -1669,4 +1670,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-08-17 16:03:19
|
||||
-- Dump completed on 2023-08-17 19:41:13
|
||||
|
|
|
|||
|
|
@ -38,9 +38,4 @@ if (!empty($_SESSION['alert_message'])) {
|
|||
|
||||
}
|
||||
|
||||
//Set Records Per Page
|
||||
if (empty($_SESSION['records_per_page'])) {
|
||||
$_SESSION['records_per_page'] = 10;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
$total_found_rows = $num_rows[0];
|
||||
$total_pages = ceil($total_found_rows / $_SESSION['records_per_page']);
|
||||
$total_pages = ceil($total_found_rows / $user_config_records_per_page);
|
||||
|
||||
if ($total_found_rows > 10) {
|
||||
$i = 0;
|
||||
|
|
@ -21,12 +21,12 @@ if ($total_found_rows > 10) {
|
|||
<div class="col-sm mb-3">
|
||||
<form action="post.php" method="post">
|
||||
<select onchange="this.form.submit()" class="form-control select2 col-sm-2" name="change_records_per_page">
|
||||
<option <?php if ($_SESSION['records_per_page'] == 5) { echo "selected"; } ?> >5</option>
|
||||
<option <?php if ($_SESSION['records_per_page'] == 10) { echo "selected"; } ?> >10</option>
|
||||
<option <?php if ($_SESSION['records_per_page'] == 20) { echo "selected"; } ?> >20</option>
|
||||
<option <?php if ($_SESSION['records_per_page'] == 50) { echo "selected"; } ?> >50</option>
|
||||
<option <?php if ($_SESSION['records_per_page'] == 100) { echo "selected"; } ?> >100</option>
|
||||
<option <?php if ($_SESSION['records_per_page'] == 500) { echo "selected"; } ?> >500</option>
|
||||
<option <?php if ($user_config_records_per_page == 5) { echo "selected"; } ?> >5</option>
|
||||
<option <?php if ($user_config_records_per_page == 10) { echo "selected"; } ?> >10</option>
|
||||
<option <?php if ($user_config_records_per_page == 20) { echo "selected"; } ?> >20</option>
|
||||
<option <?php if ($user_config_records_per_page == 50) { echo "selected"; } ?> >50</option>
|
||||
<option <?php if ($user_config_records_per_page == 100) { echo "selected"; } ?> >100</option>
|
||||
<option <?php if ($user_config_records_per_page == 500) { echo "selected"; } ?> >500</option>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ unset($get_copy['order']);
|
|||
// Paging
|
||||
if (isset($_GET['page'])) {
|
||||
$page = intval($_GET['page']);
|
||||
$record_from = (($page)-1)*$_SESSION['records_per_page'];
|
||||
$record_to = $_SESSION['records_per_page'];
|
||||
$record_from = (($page)-1)*$user_config_records_per_page;
|
||||
$record_to = $user_config_records_per_page;
|
||||
} else {
|
||||
$record_from = 0;
|
||||
$record_to = $_SESSION['records_per_page'];
|
||||
$record_to = $user_config_records_per_page;
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
if(isset($_POST['change_records_per_page'])){
|
||||
|
||||
$_SESSION['records_per_page'] = intval($_POST['change_records_per_page']);
|
||||
$records_per_page = intval($_POST['change_records_per_page']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE user_settings SET user_config_records_per_page = $records_per_page WHERE user_id = $session_user_id");
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue