26 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
35 $langs->loadLangs(array(
"admin",
"cashdesk",
"commercial"));
41 if (
GETPOST(
'action',
'alpha') ==
'set')
47 $res =
dolibarr_set_const($db,
"TAKEPOS_RECEIPT_NAME",
GETPOST(
'TAKEPOS_RECEIPT_NAME',
'alpha'),
'chaine', 0,
'', $conf->entity);
48 $res =
dolibarr_set_const($db,
"TAKEPOS_SHOW_CUSTOMER",
GETPOST(
'TAKEPOS_SHOW_CUSTOMER',
'alpha'),
'chaine', 0,
'', $conf->entity);
49 $res =
dolibarr_set_const($db,
"TAKEPOS_AUTO_PRINT_TICKETS",
GETPOST(
'TAKEPOS_AUTO_PRINT_TICKETS',
'int'),
'int', 0,
'', $conf->entity);
50 $res =
dolibarr_set_const($db,
"TAKEPOS_PRINT_SERVER",
GETPOST(
'TAKEPOS_PRINT_SERVER',
'alpha'),
'chaine', 0,
'', $conf->entity);
51 $res =
dolibarr_set_const($db,
"TAKEPOS_PRINT_PAYMENT_METHOD",
GETPOST(
'TAKEPOS_PRINT_PAYMENT_METHOD',
'alpha'),
'chaine', 0,
'', $conf->entity);
55 if (!($res > 0)) $error++;
65 } elseif (
GETPOST(
'action',
'alpha') ==
'setmethod')
69 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector" && !$conf->receiptprinter->enabled)
activateModule(
"modReceiptPrinter");
77 $form =
new Form($db);
80 llxHeader(
'', $langs->trans(
"CashDeskSetup"));
82 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
87 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?terminal='.(empty($terminal) ? 1 : $terminal).
'" method="post">';
88 print '<input type="hidden" name="token" value="'.newToken().
'">';
89 print '<input type="hidden" name="action" value="set">';
93 print '<div class="div-table-responsive-no-min">';
94 print
'<table class="noborder centpercent">';
95 print
'<tr class="liste_titre">';
96 print
'<td>'.$langs->trans(
"Name").
'</td><td>'.$langs->trans(
"Description").
'</td><td class="right">'.$langs->trans(
"Status").
'</td>';
100 print
'<tr class="oddeven"><td>';
101 print $langs->trans(
'Browser');
103 print $langs->trans(
'BrowserMethodDescription');
104 print
'</td><td class="right">';
105 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"browser")
107 print
img_picto($langs->trans(
"Activated"),
'switch_on');
109 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmethod&token='.
newToken().
'&value=browser">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
111 print
"</td></tr>\n";
114 print
'<tr class="oddeven"><td>';
115 print $langs->trans(
'DolibarrReceiptPrinter');
117 print $langs->trans(
'ReceiptPrinterMethodDescription');
119 print
'<a href="'.DOL_URL_ROOT.
'/admin/receiptprinter.php">'.$langs->trans(
"Setup").
'</a>';
120 print
'</td><td class="right">';
121 if ($conf->receiptprinter->enabled) {
122 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter") {
123 print
img_picto($langs->trans(
"Activated"),
'switch_on');
125 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmethod&token='.
newToken().
'&value=receiptprinter">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
128 print
'<span class="opacitymedium">';
129 print $langs->trans(
"ModuleReceiptPrinterMustBeEnabled");
132 print
"</td></tr>\n";
135 print
'<tr class="oddeven"><td>';
136 print
"TakePOS Connector";
138 print $langs->trans(
'TakeposConnectorMethodDescription');
139 print
'</td><td class="right">';
140 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector")
142 print
img_picto($langs->trans(
"Activated"),
'switch_on');
144 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmethod&token='.
newToken().
'&value=takeposconnector">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
146 print
"</td></tr>\n";
153 print
'<div class="div-table-responsive-no-min">';
154 print
'<table class="noborder centpercent">';
155 print
'<tr class="liste_titre">';
156 print
'<td>'.$langs->trans(
"Parameters").
'</td><td>'.$langs->trans(
"Value").
'</td>';
160 print
'<tr class="oddeven"><td>';
161 print $langs->trans(
'TicketVatGrouped');
162 print
'<td colspan="2">';
163 print
ajax_constantonoff(
"TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0);
165 print
"</td></tr>\n";
167 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") {
168 print
'<tr class="oddeven value"><td>';
169 print $langs->trans(
"URL").
" / ".$langs->trans(
"IPAddress").
' (<a href="http://en.takepos.com/connector" target="_blank">'.$langs->trans(
"TakeposConnectorNecesary").
'</a>)';
170 print
'<td colspan="2">';
171 print
'<input type="text" size="20" id="TAKEPOS_PRINT_SERVER" name="TAKEPOS_PRINT_SERVER" value="'.$conf->global->TAKEPOS_PRINT_SERVER.
'">';
175 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"browser" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") {
177 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
178 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
179 foreach ($substitutionarray as $key => $val) $htmltext .= $key.
'<br>';
182 print
'<tr class="oddeven"><td>';
183 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInvoices").
" - ".$langs->trans(
"Header"), $htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
185 $variablename =
'TAKEPOS_HEADER';
186 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
188 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.$conf->global->$variablename.
'</textarea>';
190 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
191 $doleditor =
new DolEditor($variablename, $conf->global->$variablename,
'', 80,
'dolibarr_notes');
192 print $doleditor->Create();
194 print
"</td></tr>\n";
196 print
'<tr class="oddeven"><td>';
197 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInvoices").
" - ".$langs->trans(
"Footer"), $htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
199 $variablename =
'TAKEPOS_FOOTER';
200 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
202 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.$conf->global->$variablename.
'</textarea>';
204 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
205 $doleditor =
new DolEditor($variablename, $conf->global->$variablename,
'', 80,
'dolibarr_notes');
206 print $doleditor->Create();
208 print
"</td></tr>\n";
210 print
'<tr class="oddeven"><td><label for="receipt_name">'.$langs->trans(
"ReceiptName").
'</label></td><td>';
211 print
'<input name="TAKEPOS_RECEIPT_NAME" id="TAKEPOS_RECEIPT_NAME" class="minwidth200" value="'.(!empty($conf->global->TAKEPOS_RECEIPT_NAME) ? $conf->global->TAKEPOS_RECEIPT_NAME :
'').
'">';
215 print
'<tr class="oddeven"><td>';
216 print $langs->trans(
'PrintCustomerOnReceipts');
217 print
'<td colspan="2">';
218 print $form->selectyesno(
"TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1);
219 print
"</td></tr>\n";
222 print
'<tr class="oddeven"><td>';
223 print $langs->trans(
'PrintPaymentMethodOnReceipts');
224 print
'<td colspan="2">';
225 print $form->selectyesno(
"TAKEPOS_PRINT_PAYMENT_METHOD", $conf->global->TAKEPOS_PRINT_PAYMENT_METHOD, 1);
226 print
"</td></tr>\n";
230 print
'<tr class="oddeven"><td>';
231 print $langs->trans(
"AutoPrintTickets");
232 print
'<td colspan="2">';
233 print $form->selectyesno(
"TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1);
234 print
"</td></tr>\n";
236 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
237 print
'<tr class="oddeven"><td>';
238 print $langs->trans(
'WeighingScale');
239 print
'<td colspan="2">';
240 print
ajax_constantonoff(
"TAKEPOS_WEIGHING_SCALE", array(), $conf->entity, 0, 0, 1, 0);
241 print
"</td></tr>\n";
249 print
'<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
takepos_admin_prepare_head()
Prepare array with list of tabs.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
activateModule($value, $withdeps=1)
Enable a module.
Class to manage a WYSIWYG editor.