-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
barcodeTerminal.php
216 lines (189 loc) · 9.74 KB
/
barcodeTerminal.php
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
<?php
/*
Copyright 2006-2018 Felix Rudolphi and Lukas Goossen
open enventory is distributed under the terms of the GNU Affero General Public License, see COPYING for details. You can also find the license under http://www.gnu.org/licenses/agpl.txt
open enventory is a registered trademark of Felix Rudolphi and Lukas Goossen. Usage of the name "open enventory" or the logo requires prior written permission of the trademark holders.
This file is part of open enventory.
open enventory is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
open enventory is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with open enventory. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "lib_global_funcs.php";
require_once "lib_global_settings.php";
require_once "lib_form_elements.php";
require_once "lib_constants_barcode.php";
$barcodeTerminal=true;
setGlobalVars();
pageHeader();
function getAsyncField($id) {
return "<input type=\"hidden\" name=".fixStr($id)." id=".fixStr("async_".$id).">";
}
echo "<title>".s("list_of_chemicals_title")." ".$g_settings["organisation_name"]."</title>".
stylesheet.
loadJs(array("wyzz.js")). // "dynamic.js.php",
loadJS(array("edit.js","chem.js","safety.js","safety_".$lang.".js","controls.js","jsDatePick.min.1.3.js","forms.js","folder_browser.js","literature.js","sds.js","molecule_edit.js","searchpk.js","subitemlist_helper.js","subitemlist_get.js","subitemlist.js","client_cache.js","barcode_terminal.js"),"lib/").
script."
var table=\"chemical_storage\",inventarisation_mode=false,delTimeout,normalInterval=".ifempty($barcode_terminal_options["normalDelay"], 60).",inventarisationInterval=".ifempty($barcode_terminal_options["inventarisationInterval"], 600).";
function closeTerminal() {
self.location.href=\"index.php?".getSelfRef(array("~script~"))."&desired_action=logout\";
}
function loginActivePerson() {
var password=prompt(s(\"enter_password1\")+username+s(\"enter_password2\"));
if (password==null) {
return;
}
$(\"db_name\").value=".fixStr($db_name).";
setInputValue(\"user\",username);
setInputValue(\"password\",password);
$(\"loginForm\").submit();
setInputValue(\"password\",\"\");
}
// make msecs
refreshInterval*=1000;
// personInterval*=1000;
doRefresh();
</script>
<!-- jquery-modal to display simple Modal, ref: https://jquerymodal.com/ -->
<!-- include jQuery -->
<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\" integrity=\"sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==\" crossorigin=\"anonymous\"></script>
<!-- jQuery Modal -->
<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.js\" integrity=\"sha512-ztxZscxb55lKL+xmWGZEbBHekIzy+1qYKHGZTWZYH1GUwxy0hiA18lW6ORIMj4DHRgvmP/qGcvqwEyFFV7OYVQ==\" crossorigin=\"anonymous\"></script>
<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.css\" integrity=\"sha512-T3VL1q6jMUIzGLRB9z86oJg9PgF7A55eC2XkB93zyWSqQw3Ju+6IEJZYBfT7E9wOHM7HCMCOZSpcssxnUn6AeQ==\" crossorigin=\"anonymous\" />
<!-- Khoi: set jQuery no conflict mode required below script for OE javascript to work -->
<script>jQuery.noConflict();</script>
<style>
#externalBorrower {
padding: 15px 30px !important;
}
#externalBorrower p {
padding-top: 10px;
}
</style>
</head>
<body onKeypress=\"resetPersonInterval(); \">
<form id=\"externalBorrower\" style=\"display: none; \"
action=\"\" method=\"POST\" onSubmit=\"extractExternalBorrower(); return false;\">
<h1>Please fill the following info:</h1>
<p style='margin-top: 0px'>(all fields are required)</p>
<p>
<label for=\"borrower_name\">Borrower full name: </label><br>
<input type=\"text\" id=\"borrower_name\" name=\"borrower_name\" autocomplete=\"off\" required size='55' style='padding: 8px;'><br>
</p>
<p>
<label for=\"borrower_group\">Borrower Lab/Group name: </label><br>
<input type=\"text\" id=\"borrower_group\" name=\"borrower_group\" autocomplete=\"off\" required size='55' style='padding: 8px;'><br>
</p>
<p>
<label for=\"borrower_contact\">Borrower contact Info: </label><br>
<input type=\"text\" id=\"borrower_contact\" name=\"borrower_contact\" autocomplete=\"off\" required size='55' style='padding: 8px;'><br>
</p>
<p>
<label for=\"lender_name\">Group member assisting your checkout: </label><br>
<input type=\"text\" id=\"lender_name\" name=\"lender_name\" autocomplete=\"off\" required size='55' style='padding: 8px;'>
</p>
<p style='padding-top:20px'>
<button type=\"button\" style='padding: 10px; border-radius: 5px;'>
<a href=\"#\" rel=\"modal:close\"
style='text-decoration: none; color: black; text-transform: uppercase; font-size: 18px;'>
Cancel</a></button>
<input type=\"submit\" name=\"addExternalBorrower\" value=\"Submit\"
style='text-transform: uppercase; color: white; padding: 10px; border-radius: 5px; background: deepskyblue; float: right; font-size: 18px;'>
</p>
</form>
<span id=\"temp\" style=\"display:none\"></span>";
showCommFrame(array("debug" => $debug));
showCommFrame(array("name" => "edit", "debug" => $debug, ));
echo getHelperTop()."
<form id=\"barcodeAsyncForm\" action=\"barcodeTerminalAsync.php\" target=\"edit\" method=\"post\">";
$async_fields=array("person_db_id","person_id","username","pk","desired_action","chemical_storage_conc","chemical_storage_conc_unit","actual_amount","amount","amount_unit","tmd","tmd_unit","storage_id","compartment","storage_permanent","chemical_storage_barcode","chemical_storage_bilancing","barcode","history_entry");
foreach ($async_fields as $async_field) {
echo getAsyncField($async_field);
}
echo simpleHidden("sess_proof").<<<END
</form>
<form onSubmit="barcodeRead(getInputValue("barcode"));return false">
<input id="barcode"> <span id="status"></span>
<input type="button" id="btn_logout" onClick="setActivePerson()" onMouseup="focusInput("barcode")" value=
END
.fixStr(s("logout")).<<<END
> <span id="countdown"></span> <input type="button" id="btn_login" onClick="loginActivePerson()" value=
END
.fixStr(s("login")).<<<END
> <input type="button" id="btn_close" onClick="closeTerminal()" value=
END
.fixStr(s("close_terminal")).<<<END
>
</form>
<div id="message"></div>
<form id="loginForm" name="loginForm" method="post" action="main.php" target=_blank>
<input type="hidden" id="desired_action" name="desired_action" value="sub_login">
<input type="hidden" id="db_name" name="db_name" value="">
<input type="hidden" id="user" name="user" value="">
<input type="hidden" id="password" name="password" value="">
END
.simpleHidden("sess_proof").<<<END
</form>
<form name="main" id="main" action="barcodeTerminalAsync.php" method="post" target="edit" onSubmit="doInventar();return false">
END;
require_once "lib_edit_molecule.php";
require_once "lib_edit_chemical_storage.php";
echo showCheck(array(
"int_name" => "inventarisation_mode",
"onChange" => "inventarisationMode(); ",
"noChangeEffect" => true,
)). // onClick: Timeout auf 600 sec, nicht ausleihen/zurückgeben
showCheck(array(
"int_name" => "storage_permanent",
"onChange" => "storagePermanentMode(); ", // Khoi: to fix changing location for multiple storage
"noChangeEffect" => true,
)). // onClick: Timeout auf 600 sec, nicht ausleihen/zurückgeben
showChemicalStorageEditForm(array("text" => s("inventarisation"), "barcodeTerminal" => true, READONLY => false)).
showMoleculeEditForm(array("text" => s("information_molecule"), DEFAULTREADONLY => "always", "no_db_id_pk" => true)).
"</form>".
getHelperBottom().
"<div id=\"message_log\">
</div>
<div style=\"height:1px;overflow:hidden\">";
if ($g_settings["barcode_sound"]) {
$sounds=array("login","ausleihen","zurueckgeben","error",);
foreach ($sounds as $sound) {
echo "<embed id=\"snd_".$sound."\" src=\"lib/".$sound.".wav\" width=\"140\" height=\"60\" autoplay=\"0\" enablejavascript=\"true\" onFocus=\"focusInput("barcode");\">";
}
}
echo "</div>".
// echo "</div>";
script."
function barcodeRead(barcode) {
".getJSbarcodeHandling(true)."
// Khoi: in case person_id exists (somebody logged in) and that account is a guest account (permission include _BORROW_EXTERNAL)
wait = false;
if (!inventarisation_mode && !storage_permanent_mode && person_id &&
permissions &&
(permissions & "._BORROW_EXTERNAL.")
) {
// console.log('quick lookup!');
wait = true;
barcodeReadToServer(barcode, quick=true);
}
if (wait) {
waitForInfo(barcode);
} else {
barcodeReadToServer(barcode);
}
}
inventarisationMode();
storagePermanentMode();
setActivePerson(new Array(),true);
window.setTimeout(function () { focusInput(\"barcode\"); },800); // take away focus from embedded media player
"._script."
</body>
</html>";
completeDoc();
?>