Overview
Comment:Use new export menu for export from user/accounting search, also allow everyone to export
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 7d4d36dcb2925f2bbc7fa5601f400c856817898ac78c993fef1b850f7077f62d
User & Date: bohwaz on 2023-01-25 02:14:41
Other Links: branch diff | manifest | tags
Context
2023-01-28
00:24
Make sure we don't create an infinite loop through isLogged check-in: af3e7327cb user: bohwaz tags: dev
2023-01-25
02:14
Use new export menu for export from user/accounting search, also allow everyone to export check-in: 7d4d36dcb2 user: bohwaz tags: dev
01:29
Show schema as tables, not raw SQL, in SQL search, also give access to more tables for user search, like in trunk check-in: 5a288b21b9 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Template.php from [53dde0acb7] to [3b24cf5755].

209
210
211
212
213
214
215










216
217
218
219
220

221
222
223
224
225
226
227
		}

		return '<div class="block error"><ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
	}

	protected function widgetExportMenu(array $params): string
	{










		$out  = CommonFunctions::linkButton(['href' => $params['href'] . 'csv', 'label' => 'Export CSV', 'shape' => 'export']);
		$out .= ' ' . CommonFunctions::linkButton(['href' => $params['href'] . 'ods', 'label' => 'Export LibreOffice', 'shape' => 'export']);

		if (CALC_CONVERT_COMMAND) {
			$out .= ' ' . CommonFunctions::linkButton(['href' => $params['href'] . 'xlsx', 'label' => 'Export Excel', 'shape' => 'export']);

		}

		$params = array_merge($params, ['shape' => 'export', 'label' => 'Export…']);
		return $this->widgetLinkMenu($params, $out);
	}

	protected function widgetLinkMenu(array $params, ?string $content): string







>
>
>
>
>
>
>
>
>
>
|
|

|
|
>







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
		}

		return '<div class="block error"><ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
	}

	protected function widgetExportMenu(array $params): string
	{
		if (!empty($params['form'])) {
			$name = $params['name'] ?? 'export';
			$out = CommonFunctions::button(['value' => 'csv', 'shape' => 'export', 'label' => 'Export CSV', 'name' => $name, 'type' => 'submit']);
			$out .= CommonFunctions::button(['value' => 'ods', 'shape' => 'export', 'label' => 'Export LibreOffice', 'name' => $name, 'type' => 'submit']);

			if (CALC_CONVERT_COMMAND) {
				$out .= CommonFunctions::button(['value' => 'xlsx', 'shape' => 'export', 'label' => 'Export Excel', 'name' => $name, 'type' => 'submit']);
			}
		}
		else {
			$out  = CommonFunctions::linkButton(['href' => $params['href'] . 'csv', 'label' => 'Export CSV', 'shape' => 'export']);
			$out .= ' ' . CommonFunctions::linkButton(['href' => $params['href'] . 'ods', 'label' => 'Export LibreOffice', 'shape' => 'export']);

			if (CALC_CONVERT_COMMAND) {
				$out .= ' ' . CommonFunctions::linkButton(['href' => $params['href'] . 'xlsx', 'label' => 'Export Excel', 'shape' => 'export']);
			}
		}

		$params = array_merge($params, ['shape' => 'export', 'label' => 'Export…']);
		return $this->widgetLinkMenu($params, $out);
	}

	protected function widgetLinkMenu(array $params, ?string $content): string

Modified src/templates/acc/search.tpl from [5a5d4b1abe] to [afab6e2221].

10
11
12
13
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
<form method="post" action="{$self_url}" id="queryBuilderForm" data-disable-progress="1">

{include file="common/search/advanced.tpl"}

{if $list !== null}
	<p class="help">{$list->count()} écritures trouvées pour cette recherche.</p>

	{if $list->count() > 0 && $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
	<p class="actions">
		{button type="submit" name="_dl_export" value="csv" shape="export" label="Export CSV"}
		{button type="submit" name="_dl_export" value="ods" shape="export" label="Export LibreOffice"}
		{button type="submit" name="_dl_export" value="xlsx" shape="export" label="Export Excel"}
	</p>
	{/if}


	{include file="common/dynamic_list_head.tpl" check=$is_admin use_buttons=true}

	<?php
	$prev_id = null;
	?>








|
|
<
<
<
<

>







10
11
12
13
14
15
16
17
18




19
20
21
22
23
24
25
26
27
<form method="post" action="{$self_url}" id="queryBuilderForm" data-disable-progress="1">

{include file="common/search/advanced.tpl"}

{if $list !== null}
	<p class="help">{$list->count()} écritures trouvées pour cette recherche.</p>

	{if $list->count() > 0}
	<p class="actions">{exportmenu form=true name="_dl_export" class="menu-btn-right"}</p>




	{/if}


	{include file="common/dynamic_list_head.tpl" check=$is_admin use_buttons=true}

	<?php
	$prev_id = null;
	?>

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	</tbody>
	</table>

	{$list->getHTMLPagination(true)|raw}

{elseif $results}

	{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
	<p class="actions">
		{button type="submit" name="_export" value="csv" shape="export" label="Export CSV"}
		{button type="submit" name="_export" value="ods" shape="export" label="Export LibreOffice"}
		{button type="submit" name="_export" value="xlsx" shape="export" label="Export Excel"}
	</p>
	{/if}

	<table class="list">
		<thead>
			<tr>
				{foreach from=$header item="column"}
				<td>{$column}</td>
				{/foreach}







<
|
<
<
<
<
<







56
57
58
59
60
61
62

63





64
65
66
67
68
69
70
	</tbody>
	</table>

	{$list->getHTMLPagination(true)|raw}

{elseif $results}


	<p class="actions">{exportmenu form=true name="_export" class="menu-btn-right"}</p>






	<table class="list">
		<thead>
			<tr>
				{foreach from=$header item="column"}
				<td>{$column}</td>
				{/foreach}

Modified src/templates/users/search.tpl from [8a3c8b6845] to [07e833c686].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{include file="_head.tpl" title="Recherche de membre" current="users" custom_js=['lib/query_builder.min.js']}

{include file="users/_nav.tpl" current="search"}

<form method="post" action="{$self_url}" id="queryBuilderForm" data-disable-progress="1">

{include file="common/search/advanced.tpl"}

{if $list !== null}
	<p class="help">{$list->count()} membres trouvés pour cette recherche.</p>

	{if $list->count() > 0 && $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)}
	<p class="actions">
		{button type="submit" name="_dl_export" value="csv" shape="export" label="Export CSV"}
		{button type="submit" name="_dl_export" value="ods" shape="export" label="Export LibreOffice"}
		{button type="submit" name="_dl_export" value="xlsx" shape="export" label="Export Excel"}
	</p>
	{/if}

	{include file="common/dynamic_list_head.tpl" check=$is_admin use_buttons=true}

	{foreach from=$list->iterate() item="row"}
		<tr>
			{if $is_admin}











|
|
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13




14
15
16
17
18
19
20
{include file="_head.tpl" title="Recherche de membre" current="users" custom_js=['lib/query_builder.min.js']}

{include file="users/_nav.tpl" current="search"}

<form method="post" action="{$self_url}" id="queryBuilderForm" data-disable-progress="1">

{include file="common/search/advanced.tpl"}

{if $list !== null}
	<p class="help">{$list->count()} membres trouvés pour cette recherche.</p>

	{if $list->count() > 0}
	<p class="actions">{exportmenu form=true name="_dl_export" class="menu-btn-right"}</p>




	{/if}

	{include file="common/dynamic_list_head.tpl" check=$is_admin use_buttons=true}

	{foreach from=$list->iterate() item="row"}
		<tr>
			{if $is_admin}
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	{/if}
	</table>

	{$list->getHTMLPagination(true)|raw}

{elseif $results}

	{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)}
	<p class="actions">
		{button type="submit" name="_export" value="csv" shape="export" label="Export CSV"}
		{button type="submit" name="_export" value="ods" shape="export" label="Export LibreOffice"}
		{button type="submit" name="_export" value="xlsx" shape="export" label="Export Excel"}
	</p>
	{/if}

	<table class="list">
		<thead>
			<tr>
				{foreach from=$header item="column"}
				<td>{$column}</td>
				{/foreach}







<
|
<
<
<
<
<







39
40
41
42
43
44
45

46





47
48
49
50
51
52
53
	{/if}
	</table>

	{$list->getHTMLPagination(true)|raw}

{elseif $results}


	<p class="actions">{exportmenu form=true name="_export" class="menu-btn-right"}</p>






	<table class="list">
		<thead>
			<tr>
				{foreach from=$header item="column"}
				<td>{$column}</td>
				{/foreach}