29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
34require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
35require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
38if (
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha')) {
39 $_GET[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
40 $_POST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
41 $_REQUEST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
49$langs->loadLangs(array(
"admin",
"cashdesk"));
53$sql =
"SELECT code, libelle FROM ".MAIN_DB_PREFIX.
"c_paiement";
54$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
55$sql .=
" AND active = 1";
56$sql .=
" ORDER BY libelle";
57$resql = $db->query($sql);
60 while ($obj = $db->fetch_object($resql)) {
61 array_push($paiements, $obj);
65$action =
GETPOST(
'action',
'aZ09');
74if ($action ==
'set') {
77 $res =
dolibarr_set_const($db,
"TAKEPOS_ROOT_CATEGORY_ID",
GETPOST(
'TAKEPOS_ROOT_CATEGORY_ID',
'alpha'),
'chaine', 0,
'', $conf->entity);
78 $res =
dolibarr_set_const($db,
"TAKEPOS_SUPPLEMENTS_CATEGORY",
GETPOST(
'TAKEPOS_SUPPLEMENTS_CATEGORY',
'alpha'),
'chaine', 0,
'', $conf->entity);
80 $res =
dolibarr_set_const($db,
"TAKEPOS_SORTPRODUCTFIELD",
GETPOST(
'TAKEPOS_SORTPRODUCTFIELD',
'alpha'),
'chaine', 0,
'', $conf->entity);
81 $res =
dolibarr_set_const($db,
"TAKEPOS_NUM_TERMINALS",
GETPOST(
'TAKEPOS_NUM_TERMINALS',
'alpha'),
'chaine', 0,
'', $conf->entity);
83 $res =
dolibarr_set_const($db,
"TAKEPOS_EMAIL_TEMPLATE_INVOICE",
GETPOST(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE',
'alpha'),
'chaine', 0,
'', $conf->entity);
85 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_AFFILIATE",
GETPOST(
'TAKEPOS_SUMUP_AFFILIATE',
'alpha'),
'chaine', 0,
'', $conf->entity);
86 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_APPID",
GETPOST(
'TAKEPOS_SUMUP_APPID',
'alpha'),
'chaine', 0,
'', $conf->entity);
88 if (isModEnabled(
'barcode')) {
89 $res =
dolibarr_set_const($db,
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
GETPOST(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
'alpha'),
'chaine', 0,
'', $conf->entity);
103} elseif ($action ==
'updateMask') {
104 $maskconst =
GETPOST(
'maskconst',
'aZ09');
105 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
106 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
107 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
112} elseif ($action ==
'setrefmod') {
113 $value =
GETPOST(
'value',
'alpha');
130$form =
new Form($db);
133$help_url =
'EN:Module_Point_of_sale_(TakePOS)';
135llxHeader(
'', $langs->trans(
"CashDeskSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-takepos page-admin_setup');
137$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
138print
load_fiche_titre($langs->trans(
"CashDeskSetup").
' (TakePOS)', $linkback,
'title_setup');
144$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
146print
load_fiche_titre($langs->trans(
'CashDeskRefNumberingModules'),
'',
'');
148print
'<div class="div-table-responsive-no-min">';
149print
'<table class="noborder centpercent">';
150print
'<tr class="liste_titre">';
151print
'<td>'.$langs->trans(
"Name").
"</td>\n";
152print
'<td>'.$langs->trans(
"Description").
"</td>\n";
153print
'<td class="nowrap">'.$langs->trans(
"Example").
"</td>\n";
154print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
155print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
160foreach ($dirmodels as $reldir) {
164 $handle = opendir($dir);
165 if (is_resource($handle)) {
168 while (($file = readdir($handle)) !==
false) {
169 if (substr($file, 0, 16) ==
'mod_takepos_ref_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
170 $file = substr($file, 0,
dol_strlen($file) - 4);
172 require_once $dir.$file.
'.php';
174 $module =
new $file();
175 '@phan-var-force ModeleNumRefTakepos $module';
178 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
181 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
185 if ($module->isEnabled()) {
186 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
187 print $module->info($langs);
191 print
'<td class="nowrap">';
192 $tmp = $module->getExample();
193 if (preg_match(
'/^Error/', $tmp)) {
194 $langs->load(
"errors");
195 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
196 } elseif ($tmp ==
'NotConfigured') {
197 print $langs->trans($tmp);
203 print
'<td class="center">';
205 print
img_picto($langs->trans(
"Activated"),
'switch_on');
207 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setrefmod&token='.
newToken().
'&value='.urlencode($file).
'">';
208 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
215 $invoice->date = $now;
216 $invoice->module_source =
'takepos';
217 $invoice->pos_source =
'1';
221 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
222 $nextval = $module->getNextValue($mysoc, $invoice);
223 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
224 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
226 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
227 $nextval = $langs->trans($nextval);
229 $htmltooltip .= $nextval.
'<br>';
231 $htmltooltip .= $langs->trans($module->error).
'<br>';
235 print
'<td align="center">';
236 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
257print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
258print
'<input type="hidden" name="token" value="'.newToken().
'">';
259print
'<input type="hidden" name="action" value="set">';
261print
'<div class="div-table-responsive-no-min">';
262print
'<table class="noborder centpercent">';
264print
'<tr class="liste_titre">';
265print
'<td class="notitlefield">'.$langs->trans(
"Parameters").
'</td><td></td>';
269print
'<tr class="oddeven"><td>';
270print $langs->trans(
"NumberOfTerminals");
272print
'<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" value="' . (!
getDolGlobalString(
'TAKEPOS_NUM_TERMINALS') ?
'1' : $conf->global->TAKEPOS_NUM_TERMINALS) .
'">';
276if (isModEnabled(
"service")) {
277 print
'<tr class="oddeven"><td>';
278 print $langs->trans(
"CashdeskShowServices");
280 print ajax_constantonoff(
"CASHDESK_SERVICES", array(), $conf->entity, 0, 0, 1, 0);
282 print
"</td></tr>\n";
286print
'<tr class="oddeven"><td>';
287print $form->textwithpicto($langs->trans(
"RootCategoryForProductsToSell"), $langs->trans(
"RootCategoryForProductsToSellDesc"));
289print
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');
294print
'<tr class="oddeven"><td>';
295print $langs->trans(
"SortProductField");
298$array = array(
'rowid' =>
'ID',
'ref' =>
'Ref',
'label' =>
'Label',
'datec' =>
'DateCreation',
'tms' =>
'DateModification');
299print $form->selectarray(
'TAKEPOS_SORTPRODUCTFIELD', $array,
getDolGlobalString(
'TAKEPOS_SORTPRODUCTFIELD',
'rowid'), 0, 0, 0,
'', 1);
302print
'<tr class="oddeven"><td>';
303print $langs->trans(
'TakeposGroupSameProduct');
305print ajax_constantonoff(
"TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0);
309$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
310$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
311foreach ($substitutionarray as $key => $val) {
312 $htmltext .= $key.
'<br>';
317print
'<tr class="oddeven"><td>';
318print $langs->trans(
"Paymentnumpad");
320$array = array(0 => $langs->trans(
"Numberspad"), 1 => $langs->trans(
"BillsCoinsPad"));
321print $form->selectarray(
'TAKEPOS_NUMPAD', $array, (!
getDolGlobalString(
'TAKEPOS_NUMPAD') ?
'0' : $conf->global->TAKEPOS_NUMPAD), 0);
333print
'<tr class="oddeven"><td>';
334print $langs->trans(
'DirectPaymentButton');
336print ajax_constantonoff(
"TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
349print
'<tr class="oddeven"><td>';
350print $langs->trans(
'EmailTemplate');
352include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
354$nboftemplates = $formmail->fetchAllEMailTemplate(
'facture_send', $user,
null, -1);
356$arrayofmessagename = array();
357if (is_array($formmail->lines_model)) {
358 foreach ($formmail->lines_model as $modelmail) {
361 if (!empty($arrayofmessagename[$modelmail->label])) {
362 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
364 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->topic)).$moreonlabel;
369print $form->selectarray(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename,
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE'),
'None', 1, 0,
'', 0, 0, 0,
'',
'maxwidth500 widthcentpercentminusx', 1);
373print
'<tr class="oddeven"><td>';
374print $langs->trans(
'ControlCashOpening');
376print ajax_constantonoff(
"TAKEPOS_CONTROL_CASH_OPENING", array(), $conf->entity, 0, 0, 1, 0);
380print
'<tr class="oddeven"><td>';
381print $langs->trans(
'GiftReceiptButton');
383print ajax_constantonoff(
"TAKEPOS_GIFT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0);
387print
'<tr class="oddeven"><td>';
388print $langs->trans(
'AllowDelayedPayment');
390print ajax_constantonoff(
"TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
394print
'<tr class="oddeven"><td>';
395print $langs->trans(
'ShowPriceHT');
397print ajax_constantonoff(
"TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0);
401print
'<tr class="oddeven"><td>';
402print $langs->trans(
'UsePriceHT');
404print ajax_constantonoff(
"TAKEPOS_CHANGE_PRICE_HT", array(), $conf->entity, 0, 0, 1, 0);
408if (isModEnabled(
'barcode')) {
409 print
'<tr class="oddeven"><td>';
410 print $form->textwithpicto($langs->trans(
"TakeposBarcodeRuleToInsertProduct"), $langs->trans(
"TakeposBarcodeRuleToInsertProductDesc"), 1,
'help',
'', 0, 3,
'barcoderuleonsmartphone');
412 print
'<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (
getDolGlobalString(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT')) .
'">';
413 print
"</td></tr>\n";
481 print
'<div class="div-table-responsive-no-min">';
482 print
'<table class="noborder centpercent">';
484 print
'<tr class="liste_titre">';
485 print
'<td class="titlefield">'.$langs->trans(
"Sumup").
'</td><td></td>';
488 print
'<tr class="oddeven"><td>';
489 print $langs->trans(
"SumupAffiliate");
490 print
'<td colspan="2">';
491 print
'<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_AFFILIATE').
'"></input>';
492 print
"</td></tr>\n";
493 print
'<tr class="oddeven"><td>';
494 print $langs->trans(
"SumupAppId");
495 print
'<td colspan="2">';
496 print
'<input type="text" name="TAKEPOS_SUMUP_APPID" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_APPID').
'"></input>';
497 print
"</td></tr>\n";
503print $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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
Class to manage products or services.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
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)
Show tabs of a record.
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.
dol_now($mode='auto')
Return date for now.
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.
getDolGlobalString($key, $default='')
Return a 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.