-
Notifications
You must be signed in to change notification settings - Fork 0
/
help_report.html
296 lines (293 loc) · 8.25 KB
/
help_report.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Help - report.php</title>
<style type="text/css">
body {
font-size: small;
font-family: Arial, Verdana, sans-serif;
}
h1 {
font-size: medium;
margin-top: 2em;
}
body > table > tbody > tr:last-child > td {
padding-bottom: 1em;
}
td {
padding: 0 1em 0 0;
vertical-align: top;
}
table table {
margin-left: 2em;
}
</style>
</head>
<body>
<h1>NAME</h1>
<p>
report.php - produce MRBS reports
</p>
<h1>SYNOPSIS</h1>
<p>
<code>report.php [args]</code>
</p>
<p>
where args is a space separated list of arguments of the form <code>param1=value1&param2=value2</code>. Spaces
in the value string and ampersands can normally be escaped with the backslash character ('\'), depending
on the shell. Array parameters can be sent by using the '[]' notation, eg <code>param1[]=valueA&param1[]=valueB</code>.
Array parameters must all appear in the same argument.
</p>
<h1>DESCRIPTION</h1>
<p>
This page describes how to use MRBS reporting from the command line (CLI). Report.php can
either be called directly or as a cron job. The script report.php should be called
as a parameter to the PHP interpreter. The output of report.php is sent to STDOUT.
</p>
<p>
The language and locale used for the reports is specified by the config variable
$cli_language. The script can only be run from the command line if the MRBS config
variable $allow_cli is set to TRUE.
</p>
<h1>OPTIONS</h1>
<table>
<tbody>
<tr>
<td><code>output</code></td>
<td>
The type of output to produce. Permitted values are:
<table>
<tr><td><code>0</code></td><td>A report<em> (default)</em></td></tr>
<tr><td><code>1</code></td><td>A summary</td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>output_format</code></td>
<td>
The format that the output should be produced in. Permitted values are:
<table>
<tr><td><code>0</code></td><td>HTML<em> (default except when running from the CLI)</em></td></tr>
<tr><td><code>1</code></td><td>CSV<em> (default when running from the CLI)</em></td></tr>
<tr><td><code>2</code></td><td>iCalendar (.ics file) report - excluding periods<em> (cannot be used for summaries)</em></td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>
<code>day</code>
</td>
<td>
The day (1..31) to use as the base date for the reporting
period. If any of day, week and month are not specified
then today's date will be used as the base date.
</td>
</tr>
<tr>
<td>
<code>month</code>
</td>
<td>
The month (1..12) to use as the base date for the reporting
period. If any of day, week and month are not specified
then today's date will be used as the base date.
</td>
</tr>
<tr>
<td>
<code>year</code>
</td>
<td>
The year (4 digits) to use as the base date for the reporting
period. If any of day, week and month are not specified
then today's date will be used as the base date.
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>from_date</code></td>
<td>
The start date of the reporting period in YYYY-MM-DD format. If
from_date is not specified then the base date will be used.
</td>
</tr>
<tr>
<td><code>to_date</code></td>
<td>
The end date of the reporting period in YYYY-MM-DD format. If
to_date is not specified then the base date +
$default_report_days (specified in systemdefaults.inc.php and
optionally over-ridden in config.in.php) will be used. Note that
the reporting period ends at 0000 on the to_day, so if for example
you want a report for all bookings in 2019 the to_date should be
2020-01-01.
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>creatormatch</code></td>
<td>
Limit the report to entries where the creator's user name contains the string.
</td>
</tr>
<tr>
<td><code>areamatch</code></td>
<td>
Limit the report to entries where the area name contains the string.
</td>
</tr>
<tr>
<td><code>roommatch</code></td>
<td>
Limit the report to entries where the room name contains the string.
</td>
</tr>
<tr>
<td><code>namematch</code></td>
<td>
Limit the report to entries where the entry name contains the string.
</td>
</tr>
<tr>
<td><code>descrmatch</code></td>
<td>
Limit the report to entries where the description contains the string.
</td>
</tr>
<tr>
<td><code>typematch[]</code></td>
<td>
Limit the report to entries of types X,Y,Z (eg typematch[]=X&typematch[]=Y&typematch[]=Z). Default: all types.
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>match_approved</code></td>
<td>
Limit the report to entries that are/are not approved. Permitted values are:
<table>
<tr><td><code>0</code></td><td>Awaiting approval</td></tr>
<tr><td><code>1</code></td><td>Approved</td></tr>
<tr><td><code>2</code></td><td>All entries<em> (default)</em></td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>match_confirmed</code></td>
<td>
Limit the report to entries that are tentative or confirmed. Permitted values are:
<table>
<tr><td><code>0</code></td><td>Tentative</td></tr>
<tr><td><code>1</code></td><td>Confirmed</td></tr>
<tr><td><code>2</code></td><td>All entries<em> (default)</em></td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>match_private</code></td>
<td>
Limit the report to entries that are private or public. Permitted values are:
<table>
<tr><td><code>0</code></td><td>Private</td></tr>
<tr><td><code>1</code></td><td>Public</td></tr>
<tr><td><code>2</code></td><td>All entries<em> (default)</em></td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>sortby</code></td>
<td>
Permitted values are:
<table>
<tr><td><code>r</code></td><td>sort by room name<em> (default)</em></td></tr>
<tr><td><code>s</code></td><td>sort by start time</td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>sumby</code></td>
<td>
The field to use for the first column of the summary table.
Permitted values are:
<table>
<tr><td><code>d</code></td><td>brief description<em> (default)</em></td></tr>
<tr><td><code>c</code></td><td>creator's user name</td></tr>
<tr><td><code>t</code></td><td>type</td></tr>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>phase</code></td>
<td>
The phase of report production. Phase 1 is the gathering of user input from
the web page form; Phase 2 is the production of the report or summary. When running
from the command line it is not necessary to set this option as it is automatically
set to 2 by MRBS. However when running report.php from the web browser or by using wget,
setting phase=2 will force report.php to go straight to the production of a report.
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>custom</td>
<td>
Custom fields can be searched for using the same syntax as above.
</td>
</tr>
</tbody>
</table>
<h1>RETURN VALUES</h1>
<p>
Returns 0 on success.
</p>
<h1>EXAMPLES</h1>
<p>
To produce a summary in CSV format of all bookings for 2019, arranged by the creator's
name, and send the summary to the file summary.csv:
</p>
<p>
<code>
/usr/local/bin/php /home/mrbs/report.php output=1 from_date=2019-01-01 to_date=2020-01-01 sumby=c > summary.csv
</code>
</p>
<p>
The CLI output can be simulated in a browser by putting the parameters in a query string. But note
that the parameter <code>phase=2</code> must be added to tell MRBS that it is on the second
phase of report production (the first phase is gathering the user input from the form; if report.php
is called from the command line the phase is automatically set to 2). For example,
to simulate the CLI command above enter into the browser (note the addition of the <code>
output_format</code> parameter as CSV is not the default format when running from the browser):
</p>
<p>
<code>
report.php?phase=2&output=1&output_format=2&from_date=2019-01-01&to_date=2020-01-01&sumby=c
</code>
</p>
<p>
When using wget, don't forget to escape ampersands with a backslash. For example:
</p>
<p>
<code>
wget -O myreport.csv http://localhost/mrbs/report.php?phase=2\&output=1\&output_format=2\&sumby=c
</code>
</p>
</body>
</html>