28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
33require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
34require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
37if (!empty($_REQUEST[
'CASHDESK_ID_THIRDPARTY_id'])) {
38 $_GET[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
39 $_POST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
40 $_REQUEST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
48$langs->loadLangs(array(
"admin",
"cashdesk"));
52$sql =
"SELECT code, libelle FROM ".MAIN_DB_PREFIX.
"c_paiement";
53$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
54$sql .=
" AND active = 1";
55$sql .=
" ORDER BY libelle";
56$resql = $db->query($sql);
59 while ($obj = $db->fetch_object($resql)) {
60 array_push($paiements, $obj);
64$action =
GETPOST(
'action',
'aZ09');
73if ($action ==
'set') {
76 $res =
dolibarr_set_const($db,
"TAKEPOS_ROOT_CATEGORY_ID",
GETPOST(
'TAKEPOS_ROOT_CATEGORY_ID',
'alpha'),
'chaine', 0,
'', $conf->entity);
77 $res =
dolibarr_set_const($db,
"TAKEPOS_SUPPLEMENTS_CATEGORY",
GETPOST(
'TAKEPOS_SUPPLEMENTS_CATEGORY',
'alpha'),
'chaine', 0,
'', $conf->entity);
79 $res =
dolibarr_set_const($db,
"TAKEPOS_SORTPRODUCTFIELD",
GETPOST(
'TAKEPOS_SORTPRODUCTFIELD',
'alpha'),
'chaine', 0,
'', $conf->entity);
80 $res =
dolibarr_set_const($db,
"TAKEPOS_NUM_TERMINALS",
GETPOST(
'TAKEPOS_NUM_TERMINALS',
'alpha'),
'chaine', 0,
'', $conf->entity);
82 $res =
dolibarr_set_const($db,
"TAKEPOS_EMAIL_TEMPLATE_INVOICE",
GETPOST(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE',
'alpha'),
'chaine', 0,
'', $conf->entity);
84 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_AFFILIATE",
GETPOST(
'TAKEPOS_SUMUP_AFFILIATE',
'alpha'),
'chaine', 0,
'', $conf->entity);
85 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_APPID",
GETPOST(
'TAKEPOS_SUMUP_APPID',
'alpha'),
'chaine', 0,
'', $conf->entity);
87 if (isModEnabled(
'barcode')) {
88 $res =
dolibarr_set_const($db,
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
GETPOST(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
'alpha'),
'chaine', 0,
'', $conf->entity);
102} elseif ($action ==
'updateMask') {
103 $maskconst =
GETPOST(
'maskconst',
'aZ09');
104 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
105 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
106 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
111} elseif ($action ==
'setrefmod') {
112 $value =
GETPOST(
'value',
'alpha');
129$form =
new Form($db);
132$help_url =
'EN:Module_Point_of_sale_(TakePOS)';
134llxHeader(
'', $langs->trans(
"CashDeskSetup"), $help_url);
136$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
137print
load_fiche_titre($langs->trans(
"CashDeskSetup").
' (TakePOS)', $linkback,
'title_setup');
143$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
145print
load_fiche_titre($langs->trans(
'CashDeskRefNumberingModules'),
'',
'');
147print
'<table class="noborder centpercent">';
148print
'<tr class="liste_titre">';
149print
'<td>'.$langs->trans(
"Name").
"</td>\n";
150print
'<td>'.$langs->trans(
"Description").
"</td>\n";
151print
'<td class="nowrap">'.$langs->trans(
"Example").
"</td>\n";
152print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
153print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
158foreach ($dirmodels as $reldir) {
162 $handle = opendir($dir);
163 if (is_resource($handle)) {
166 while (($file = readdir($handle)) !==
false) {
167 if (substr($file, 0, 16) ==
'mod_takepos_ref_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
168 $file = substr($file, 0,
dol_strlen($file) - 4);
170 require_once $dir.$file.
'.php';
175 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
178 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
182 if ($module->isEnabled()) {
183 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
184 print $module->info();
188 print
'<td class="nowrap">';
189 $tmp = $module->getExample();
190 if (preg_match(
'/^Error/', $tmp)) {
191 $langs->load(
"errors");
192 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
193 } elseif ($tmp ==
'NotConfigured') {
194 print $langs->trans($tmp);
200 print
'<td class="center">';
202 print
img_picto($langs->trans(
"Activated"),
'switch_on');
204 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setrefmod&token='.newToken().
'&value='.urlencode($file).
'">';
205 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
212 $invoice->date = $now;
213 $invoice->module_source =
'takepos';
214 $invoice->pos_source = 1;
218 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
219 $nextval = $module->getNextValue($mysoc, $invoice);
220 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
221 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
223 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
224 $nextval = $langs->trans($nextval);
226 $htmltooltip .= $nextval.
'<br>';
228 $htmltooltip .= $langs->trans($module->error).
'<br>';
232 print
'<td align="center">';
233 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
244print
"</table><br>\n";
249print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
250print
'<input type="hidden" name="token" value="'.newToken().
'">';
251print
'<input type="hidden" name="action" value="set">';
253print
'<div class="div-table-responsive-no-min">';
254print
'<table class="noborder centpercent">';
256print
'<tr class="liste_titre">';
257print
'<td class="notitlefield">'.$langs->trans(
"Parameters").
'</td><td>'.$langs->trans(
"Value").
'</td>';
261print
'<tr class="oddeven"><td>';
262print $langs->trans(
"NumberOfTerminals");
263print
'<td colspan="2">';
264print
'<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" value="' . (empty($conf->global->TAKEPOS_NUM_TERMINALS) ?
'1' : $conf->global->TAKEPOS_NUM_TERMINALS) .
'">';
268if (isModEnabled(
"service")) {
269 print
'<tr class="oddeven"><td>';
270 print $langs->trans(
"CashdeskShowServices");
271 print
'<td colspan="2">';
272 print ajax_constantonoff(
"CASHDESK_SERVICES", array(), $conf->entity, 0, 0, 1, 0);
274 print
"</td></tr>\n";
278print
'<tr class="oddeven"><td>';
279print $form->textwithpicto($langs->trans(
"RootCategoryForProductsToSell"), $langs->trans(
"RootCategoryForProductsToSellDesc"));
280print
'<td colspan="2">';
281print
img_object(
'',
'category',
'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT,
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID'),
'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0);
286print
'<tr class="oddeven"><td>';
287print $langs->trans(
"SortProductField");
288print
'<td colspan="2">';
290$array = array(
'rowid' =>
'ID',
'ref' =>
'Ref',
'label' =>
'Label',
'datec' =>
'DateCreation',
'tms' =>
'DateModification');
291print $form->selectarray(
'TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ?
'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0,
'', 1);
294print
'<tr class="oddeven"><td>';
295print $langs->trans(
'TakeposGroupSameProduct');
296print
'<td colspan="2">';
297print ajax_constantonoff(
"TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0);
301$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
302$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
303foreach ($substitutionarray as $key => $val) {
304 $htmltext .= $key.
'<br>';
309print
'<tr class="oddeven"><td>';
310print $langs->trans(
"Paymentnumpad");
311print
'<td colspan="2">';
312$array = array(0=>$langs->trans(
"Numberspad"), 1=>$langs->trans(
"BillsCoinsPad"));
313print $form->selectarray(
'TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ?
'0' : $conf->global->TAKEPOS_NUMPAD), 0);
325print
'<tr class="oddeven"><td>';
326print $langs->trans(
'DirectPaymentButton');
327print
'<td colspan="2">';
328print ajax_constantonoff(
"TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
341print
'<tr class="oddeven"><td>';
342print $langs->trans(
'EmailTemplate');
343print
'<td colspan="2">';
344include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
346$nboftemplates = $formmail->fetchAllEMailTemplate(
'facture_send', $user,
null, -1);
348$arrayofmessagename = array();
349if (is_array($formmail->lines_model)) {
350 foreach ($formmail->lines_model as $modelmail) {
353 if (!empty($arrayofmessagename[$modelmail->label])) {
354 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
356 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->topic)).$moreonlabel;
361print $form->selectarray(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE,
'None', 1, 0,
'', 0, 0, 0,
'',
'', 1);
365print
'<tr class="oddeven"><td>';
366print $langs->trans(
'ControlCashOpening');
367print
'<td colspan="2">';
368print ajax_constantonoff(
"TAKEPOS_CONTROL_CASH_OPENING", array(), $conf->entity, 0, 0, 1, 0);
372print
'<tr class="oddeven"><td>';
373print $langs->trans(
'GiftReceiptButton');
374print
'<td colspan="2">';
375print ajax_constantonoff(
"TAKEPOS_GIFT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0);
379print
'<tr class="oddeven"><td>';
380print $langs->trans(
'AllowDelayedPayment');
381print
'<td colspan="2">';
382print ajax_constantonoff(
"TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
386print
'<tr class="oddeven"><td>';
387print $langs->trans(
'ShowPriceHT');
388print
'<td colspan="2">';
389print ajax_constantonoff(
"TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0);
393if (isModEnabled(
'barcode')) {
394 print
'<tr class="oddeven"><td>';
395 print $form->textwithpicto($langs->trans(
"TakeposBarcodeRuleToInsertProduct"), $langs->trans(
"TakeposBarcodeRuleToInsertProductDesc"));
396 print
'<td colspan="2">';
397 print
'<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (
getDolGlobalString(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT')) .
'">';
398 print
"</td></tr>\n";
466 print
'<div class="div-table-responsive-no-min">';
467 print
'<table class="noborder centpercent">';
469 print
'<tr class="liste_titre">';
470 print
'<td class="titlefield">'.$langs->trans(
"Sumup").
'</td><td>'.$langs->trans(
"Value").
'</td>';
473 print
'<tr class="oddeven"><td>';
474 print $langs->trans(
"SumupAffiliate");
475 print
'<td colspan="2">';
476 print
'<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="'.$conf->global->TAKEPOS_SUMUP_AFFILIATE.
'"></input>';
477 print
"</td></tr>\n";
478 print
'<tr class="oddeven"><td>';
479 print $langs->trans(
"SumupAppId");
480 print
'<td colspan="2">';
481 print
'<input type="text" name="TAKEPOS_SUMUP_APPID" value="'.$conf->global->TAKEPOS_SUMUP_APPID.
'"></input>';
482 print
"</td></tr>\n";
490print $form->buttonsSaveCancel(
"Save",
'');
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).
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage invoices.
Class to manage products or services.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
takepos_admin_prepare_head()
Prepare array with list of tabs.