30require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
42require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
43require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
46if (
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha')) {
47 $_GET[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
48 $_POST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
49 $_REQUEST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
57$langs->loadLangs(array(
"admin",
"cashdesk"));
61$sql =
"SELECT code, libelle FROM ".MAIN_DB_PREFIX.
"c_paiement";
62$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
63$sql .=
" AND active = 1";
64$sql .=
" ORDER BY libelle";
65$resql = $db->query($sql);
68 while ($obj = $db->fetch_object($resql)) {
69 array_push($paiements, $obj);
73$action =
GETPOST(
'action',
'aZ09');
82if ($action ==
'set') {
85 $res =
dolibarr_set_const($db,
"TAKEPOS_ROOT_CATEGORY_ID",
GETPOST(
'TAKEPOS_ROOT_CATEGORY_ID',
'alpha'),
'chaine', 0,
'', $conf->entity);
86 $res =
dolibarr_set_const($db,
"TAKEPOS_SUPPLEMENTS_CATEGORY",
GETPOST(
'TAKEPOS_SUPPLEMENTS_CATEGORY',
'alpha'),
'chaine', 0,
'', $conf->entity);
88 $res =
dolibarr_set_const($db,
"TAKEPOS_SORTPRODUCTFIELD",
GETPOST(
'TAKEPOS_SORTPRODUCTFIELD',
'alpha'),
'chaine', 0,
'', $conf->entity);
89 $res =
dolibarr_set_const($db,
"TAKEPOS_NUM_TERMINALS",
GETPOST(
'TAKEPOS_NUM_TERMINALS',
'alpha'),
'chaine', 0,
'', $conf->entity);
91 $res =
dolibarr_set_const($db,
"TAKEPOS_EMAIL_TEMPLATE_INVOICE",
GETPOST(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE',
'alpha'),
'chaine', 0,
'', $conf->entity);
93 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_AFFILIATE",
GETPOST(
'TAKEPOS_SUMUP_AFFILIATE',
'alpha'),
'chaine', 0,
'', $conf->entity);
94 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_APPID",
GETPOST(
'TAKEPOS_SUMUP_APPID',
'alpha'),
'chaine', 0,
'', $conf->entity);
97 $res =
dolibarr_set_const($db,
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
GETPOST(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
'alpha'),
'chaine', 0,
'', $conf->entity);
111} elseif ($action ==
'updateMask') {
112 $maskconst =
GETPOST(
'maskconst',
'aZ09');
113 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
114 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
115 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
120} elseif ($action ==
'setrefmod') {
121 $value =
GETPOST(
'value',
'alpha');
138$form =
new Form($db);
140$help_url =
'EN:Module_Point_of_sale_(TakePOS)';
142llxHeader(
'', $langs->trans(
"CashDeskSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-takepos page-admin_setup');
144$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
146print
load_fiche_titre($langs->trans(
"CashDeskSetup").
' (TakePOS)', $linkback,
'title_setup');
149if (in_array(
$mysoc->country_code, array(
'FR'))) {
150 $htmltext = $langs->trans(
"CashRegisterAlertFR", $langs->transnoentitiesnoconv(
"Bank"), $langs->transnoentitiesnoconv(
"CashControl")).
' ';
151 $htmltext .= $langs->trans(
"CashRegisterAlertFR2").
'<br>';
161$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
163print
load_fiche_titre($langs->trans(
'CashDeskRefNumberingModules'),
'',
'');
165print
'<div class="div-table-responsive-no-min">';
166print
'<table class="noborder centpercent">';
167print
'<tr class="liste_titre">';
168print
'<td>'.$langs->trans(
"Name").
"</td>\n";
169print
'<td>'.$langs->trans(
"Description").
"</td>\n";
170print
'<td class="nowrap">'.$langs->trans(
"Example").
"</td>\n";
171print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
172print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
177foreach ($dirmodels as $reldir) {
181 $handle = opendir($dir);
182 if (is_resource($handle)) {
183 while (($file = readdir($handle)) !==
false) {
184 if (substr($file, 0, 16) ==
'mod_takepos_ref_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
185 $file = substr($file, 0,
dol_strlen($file) - 4);
187 require_once $dir.$file.
'.php';
189 $module =
new $file();
190 '@phan-var-force ModeleNumRefTakepos $module';
193 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
196 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
200 if ($module->isEnabled()) {
201 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
202 print $module->info($langs);
206 print
'<td class="nowrap">';
207 $tmp = $module->getExample();
208 if (preg_match(
'/^Error/', $tmp)) {
209 $langs->load(
"errors");
210 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
211 } elseif ($tmp ==
'NotConfigured') {
212 print $langs->trans($tmp);
218 print
'<td class="center">';
220 print
img_picto($langs->trans(
"Activated"),
'switch_on');
222 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setrefmod&token='.
newToken().
'&value='.urlencode($file).
'">';
223 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
230 $invoice->date = $now;
231 $invoice->module_source =
'takepos';
232 $invoice->pos_source =
'1';
236 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
237 $nextval = $module->getNextValue($mysoc, $invoice);
238 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
239 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
241 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
242 $nextval = $langs->trans($nextval);
244 $htmltooltip .= $nextval.
'<br>';
246 $htmltooltip .= $langs->trans($module->error).
'<br>';
250 print
'<td align="center">';
251 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
272print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
273print
'<input type="hidden" name="token" value="'.newToken().
'">';
274print
'<input type="hidden" name="action" value="set">';
276print
'<div class="div-table-responsive-no-min">';
277print
'<table class="noborder centpercent">';
279print
'<tr class="liste_titre">';
280print
'<td class="notitlefield">'.$langs->trans(
"Parameters").
'</td><td></td>';
284print
'<tr class="oddeven"><td>';
285print $langs->trans(
"NumberOfTerminals");
287print
'<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" class="width50" value="' .
getDolGlobalString(
'TAKEPOS_NUM_TERMINALS',
'1') .
'">';
292 print
'<tr class="oddeven"><td>';
293 print $langs->trans(
"CashdeskShowServices");
295 print ajax_constantonoff(
"CASHDESK_SERVICES", array(), $conf->entity, 0, 0, 1, 0);
297 print
"</td></tr>\n";
301print
'<tr class="oddeven"><td>';
302print $form->textwithpicto($langs->trans(
"RootCategoryForProductsToSell"), $langs->trans(
"RootCategoryForProductsToSellDesc"));
305print
img_object(
'',
'category',
'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT,
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID'),
'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0, 0,
'maxwidth500 widthcentpercentminusx');
310print
'<tr class="oddeven"><td>';
311print $langs->trans(
"SortProductField");
313$array = array(
'rowid' =>
'ID',
'ref' =>
'Ref',
'label' =>
'Label',
'datec' =>
'DateCreation',
'tms' =>
'DateModification');
314print $form->selectarray(
'TAKEPOS_SORTPRODUCTFIELD', $array,
getDolGlobalString(
'TAKEPOS_SORTPRODUCTFIELD',
'rowid'), 0, 0, 0,
'', 1);
317print
'<tr class="oddeven"><td>';
318print $langs->trans(
'TakeposGroupSameProduct');
320print ajax_constantonoff(
"TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0);
324$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
325$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
326foreach ($substitutionarray as $key => $val) {
327 $htmltext .= $key.
'<br>';
332print
'<tr class="oddeven"><td>';
333print $langs->trans(
"Paymentnumpad");
335$array = array(0 => $langs->trans(
"Numberspad"), 1 => $langs->trans(
"BillsCoinsPad"));
336print $form->selectarray(
'TAKEPOS_NUMPAD', $array, (!
getDolGlobalString(
'TAKEPOS_NUMPAD') ?
'0' : $conf->global->TAKEPOS_NUMPAD), 0);
348print
'<tr class="oddeven"><td>';
349print $langs->trans(
'DirectPaymentButton');
351print ajax_constantonoff(
"TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
364print
'<tr class="oddeven"><td>';
365print $langs->trans(
'EmailTemplate');
367include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
369$formmail->fetchAllEMailTemplate(
'facture_send', $user,
null, -1);
370$arrayofmessagename = array();
371if (is_array($formmail->lines_model)) {
372 foreach ($formmail->lines_model as $modelmail) {
375 if (!empty($arrayofmessagename[$modelmail->label])) {
376 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
378 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->topic)).$moreonlabel;
383print $form->selectarray(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename,
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE'),
'None', 1, 0,
'', 0, 0, 0,
'',
'maxwidth500 widthcentpercentminusx', 1);
387print
'<tr class="oddeven"><td>';
388print $langs->trans(
'ControlCashOpening');
390print ajax_constantonoff(
"TAKEPOS_CONTROL_CASH_OPENING", array(), $conf->entity, 0, 0, 1, 0);
394print
'<tr class="oddeven"><td>';
395print $langs->trans(
'AllowDelayedPayment');
397print ajax_constantonoff(
"TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
401print
'<tr class="oddeven"><td>';
402print $langs->trans(
'ShowPriceHT');
404print ajax_constantonoff(
"TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0);
408print
'<tr class="oddeven"><td>';
409print $langs->trans(
'UsePriceHT');
411print ajax_constantonoff(
"TAKEPOS_CHANGE_PRICE_HT", array(), $conf->entity, 0, 0, 1, 0);
416 print
'<tr class="oddeven"><td>';
417 print $form->textwithpicto($langs->trans(
"TakeposBarcodeRuleToInsertProduct"), $langs->trans(
"TakeposBarcodeRuleToInsertProductDesc"), 1,
'help',
'', 0, 3,
'barcoderuleonsmartphone');
419 print
'<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (
getDolGlobalString(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT')) .
'">';
420 print
"</td></tr>\n";
488 print
'<div class="div-table-responsive-no-min">';
489 print
'<table class="noborder centpercent">';
491 print
'<tr class="liste_titre">';
492 print
'<td class="titlefield">'.$langs->trans(
"Sumup").
'</td><td></td>';
495 print
'<tr class="oddeven"><td>';
496 print $langs->trans(
"SumupAffiliate");
497 print
'<td colspan="2">';
498 print
'<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_AFFILIATE').
'"></input>';
499 print
"</td></tr>\n";
500 print
'<tr class="oddeven"><td>';
501 print $langs->trans(
"SumupAppId");
502 print
'<td colspan="2">';
503 print
'<input type="text" name="TAKEPOS_SUMUP_APPID" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_APPID').
'"></input>';
504 print
"</td></tr>\n";
510print $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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.