Overview
Comment:Do not paginate list of services
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 68e5f07fc33fcc7aa33be81eb06b19ce28a70b06d2b3ba2a446f11c43ab8005d
User & Date: bohwaz on 2022-06-07 16:40:35
Other Links: manifest | tags
Context
2022-06-07
16:40
Add list of debts and credits for a user check-in: 328a714b2c user: bohwaz tags: trunk
16:40
Do not paginate list of services check-in: 68e5f07fc3 user: bohwaz tags: trunk, stable
16:22
Show an alert message if no user accounts can be listed check-in: 76274520cf user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Services/Services.php from [0a2a598e1a] to [8596a5134e].

99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
				'select' => '(SELECT COUNT(DISTINCT id_user) FROM services_list_stats WHERE id_service = services.id AND paid = 0)',
			],
		];

		$current_condition = $current_only ? '(end_date IS NULL OR end_date >= datetime())' : '(end_date IS NOT NULL AND end_date < datetime())';

		$list = new DynamicList($columns, 'services', $current_condition);

		$list->orderBy('label', false);
		return $list;
	}

	static public function countOldServices(): int
	{
		return DB::getInstance()->count(Service::TABLE, 'end_date IS NOT NULL AND end_date < datetime()');
	}
}







>









99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
				'select' => '(SELECT COUNT(DISTINCT id_user) FROM services_list_stats WHERE id_service = services.id AND paid = 0)',
			],
		];

		$current_condition = $current_only ? '(end_date IS NULL OR end_date >= datetime())' : '(end_date IS NOT NULL AND end_date < datetime())';

		$list = new DynamicList($columns, 'services', $current_condition);
		$list->setPageSize(null);
		$list->orderBy('label', false);
		return $list;
	}

	static public function countOldServices(): int
	{
		return DB::getInstance()->count(Service::TABLE, 'end_date IS NOT NULL AND end_date < datetime()');
	}
}