30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
35require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
36require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
39if (
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha')) {
40 $_GET[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
41 $_POST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
42 $_REQUEST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
58$langs->loadLangs(array(
"admin",
"cashdesk"));
62$sql =
"SELECT code, libelle FROM ".MAIN_DB_PREFIX.
"c_paiement";
63$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
64$sql .=
" AND active = 1";
65$sql .=
" ORDER BY libelle";
66$resql = $db->query($sql);
69 while ($obj = $db->fetch_object($resql)) {
70 array_push($paiements, $obj);
74$action =
GETPOST(
'action',
'aZ09');
83if ($action ==
'set') {
92 $res =
dolibarr_set_const($db,
"TAKEPOS_EMAIL_TEMPLATE_INVOICE",
GETPOST(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE',
'alpha'),
'chaine', 0,
'',
$conf->entity);
97 if (isModEnabled(
'barcode')) {
98 $res =
dolibarr_set_const($db,
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
GETPOST(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT',
'alpha'),
'chaine', 0,
'',
$conf->entity);
112} elseif ($action ==
'updateMask') {
113 $maskconst =
GETPOST(
'maskconst',
'aZ09');
114 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
115 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
121} elseif ($action ==
'setrefmod') {
122 $value =
GETPOST(
'value',
'alpha');
139$form =
new Form($db);
142$help_url =
'EN:Module_Point_of_sale_(TakePOS)';
144llxHeader(
'', $langs->trans(
"CashDeskSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-takepos page-admin_setup');
146$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
147print
load_fiche_titre($langs->trans(
"CashDeskSetup").
' (TakePOS)', $linkback,
'title_setup');
153$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
155print
load_fiche_titre($langs->trans(
'CashDeskRefNumberingModules'),
'',
'');
157print
'<div class="div-table-responsive-no-min">';
158print
'<table class="noborder centpercent">';
159print
'<tr class="liste_titre">';
160print
'<td>'.$langs->trans(
"Name").
"</td>\n";
161print
'<td>'.$langs->trans(
"Description").
"</td>\n";
162print
'<td class="nowrap">'.$langs->trans(
"Example").
"</td>\n";
163print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
164print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
169foreach ($dirmodels as $reldir) {
173 $handle = opendir($dir);
174 if (is_resource($handle)) {
177 while (($file = readdir($handle)) !==
false) {
178 if (substr($file, 0, 16) ==
'mod_takepos_ref_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
179 $file = substr($file, 0,
dol_strlen($file) - 4);
181 require_once $dir.$file.
'.php';
183 $module =
new $file();
184 '@phan-var-force ModeleNumRefTakepos $module';
187 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
190 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
194 if ($module->isEnabled()) {
195 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
196 print $module->info($langs);
200 print
'<td class="nowrap">';
201 $tmp = $module->getExample();
202 if (preg_match(
'/^Error/', $tmp)) {
203 $langs->load(
"errors");
204 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
205 } elseif ($tmp ==
'NotConfigured') {
206 print $langs->trans($tmp);
212 print
'<td class="center">';
214 print
img_picto($langs->trans(
"Activated"),
'switch_on');
216 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setrefmod&token='.
newToken().
'&value='.urlencode($file).
'">';
217 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
224 $invoice->date = $now;
225 $invoice->module_source =
'takepos';
226 $invoice->pos_source =
'1';
230 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
231 $nextval = $module->getNextValue($mysoc, $invoice);
232 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
233 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
235 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
236 $nextval = $langs->trans($nextval);
238 $htmltooltip .= $nextval.
'<br>';
240 $htmltooltip .= $langs->trans($module->error).
'<br>';
244 print
'<td align="center">';
245 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
266print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
267print
'<input type="hidden" name="token" value="'.newToken().
'">';
268print
'<input type="hidden" name="action" value="set">';
270print
'<div class="div-table-responsive-no-min">';
271print
'<table class="noborder centpercent">';
273print
'<tr class="liste_titre">';
274print
'<td class="notitlefield">'.$langs->trans(
"Parameters").
'</td><td></td>';
278print
'<tr class="oddeven"><td>';
279print $langs->trans(
"NumberOfTerminals");
281print
'<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" class="width50" value="' .
getDolGlobalString(
'TAKEPOS_NUM_TERMINALS',
'1') .
'">';
285if (isModEnabled(
"service")) {
286 print
'<tr class="oddeven"><td>';
287 print $langs->trans(
"CashdeskShowServices");
289 print ajax_constantonoff(
"CASHDESK_SERVICES", array(),
$conf->entity, 0, 0, 1, 0);
291 print
"</td></tr>\n";
295print
'<tr class="oddeven"><td>';
296print $form->textwithpicto($langs->trans(
"RootCategoryForProductsToSell"), $langs->trans(
"RootCategoryForProductsToSellDesc"));
298print
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');
303print
'<tr class="oddeven"><td>';
304print $langs->trans(
"SortProductField");
307$array = array(
'rowid' =>
'ID',
'ref' =>
'Ref',
'label' =>
'Label',
'datec' =>
'DateCreation',
'tms' =>
'DateModification');
308print $form->selectarray(
'TAKEPOS_SORTPRODUCTFIELD', $array,
getDolGlobalString(
'TAKEPOS_SORTPRODUCTFIELD',
'rowid'), 0, 0, 0,
'', 1);
311print
'<tr class="oddeven"><td>';
312print $langs->trans(
'TakeposGroupSameProduct');
314print ajax_constantonoff(
"TAKEPOS_GROUP_SAME_PRODUCT", array(),
$conf->entity, 0, 0, 1, 0);
318$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
319$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
320foreach ($substitutionarray as $key => $val) {
321 $htmltext .= $key.
'<br>';
326print
'<tr class="oddeven"><td>';
327print $langs->trans(
"Paymentnumpad");
329$array = array(0 => $langs->trans(
"Numberspad"), 1 => $langs->trans(
"BillsCoinsPad"));
330print $form->selectarray(
'TAKEPOS_NUMPAD', $array, (!
getDolGlobalString(
'TAKEPOS_NUMPAD') ?
'0' :
$conf->global->TAKEPOS_NUMPAD), 0);
342print
'<tr class="oddeven"><td>';
343print $langs->trans(
'DirectPaymentButton');
345print ajax_constantonoff(
"TAKEPOS_DIRECT_PAYMENT", array(),
$conf->entity, 0, 0, 1, 0);
358print
'<tr class="oddeven"><td>';
359print $langs->trans(
'EmailTemplate');
361include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
363$nboftemplates = $formmail->fetchAllEMailTemplate(
'facture_send', $user,
null, -1);
365$arrayofmessagename = array();
366if (is_array($formmail->lines_model)) {
367 foreach ($formmail->lines_model as $modelmail) {
370 if (!empty($arrayofmessagename[$modelmail->label])) {
371 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
373 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->topic)).$moreonlabel;
378print $form->selectarray(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename,
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE'),
'None', 1, 0,
'', 0, 0, 0,
'',
'maxwidth500 widthcentpercentminusx', 1);
382print
'<tr class="oddeven"><td>';
383print $langs->trans(
'ControlCashOpening');
385print ajax_constantonoff(
"TAKEPOS_CONTROL_CASH_OPENING", array(),
$conf->entity, 0, 0, 1, 0);
389print
'<tr class="oddeven"><td>';
390print $langs->trans(
'GiftReceiptButton');
392print ajax_constantonoff(
"TAKEPOS_GIFT_RECEIPT", array(),
$conf->entity, 0, 0, 1, 0);
396print
'<tr class="oddeven"><td>';
397print $langs->trans(
'AllowDelayedPayment');
399print ajax_constantonoff(
"TAKEPOS_DELAYED_PAYMENT", array(),
$conf->entity, 0, 0, 1, 0);
403print
'<tr class="oddeven"><td>';
404print $langs->trans(
'ShowPriceHT');
406print ajax_constantonoff(
"TAKEPOS_SHOW_HT", array(),
$conf->entity, 0, 0, 1, 0);
410print
'<tr class="oddeven"><td>';
411print $langs->trans(
'UsePriceHT');
413print ajax_constantonoff(
"TAKEPOS_CHANGE_PRICE_HT", array(),
$conf->entity, 0, 0, 1, 0);
417if (isModEnabled(
'barcode')) {
418 print
'<tr class="oddeven"><td>';
419 print $form->textwithpicto($langs->trans(
"TakeposBarcodeRuleToInsertProduct"), $langs->trans(
"TakeposBarcodeRuleToInsertProductDesc"), 1,
'help',
'', 0, 3,
'barcoderuleonsmartphone');
421 print
'<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (
getDolGlobalString(
'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT')) .
'">';
422 print
"</td></tr>\n";
490 print
'<div class="div-table-responsive-no-min">';
491 print
'<table class="noborder centpercent">';
493 print
'<tr class="liste_titre">';
494 print
'<td class="titlefield">'.$langs->trans(
"Sumup").
'</td><td></td>';
497 print
'<tr class="oddeven"><td>';
498 print $langs->trans(
"SumupAffiliate");
499 print
'<td colspan="2">';
500 print
'<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_AFFILIATE').
'"></input>';
501 print
"</td></tr>\n";
502 print
'<tr class="oddeven"><td>';
503 print $langs->trans(
"SumupAppId");
504 print
'<td colspan="2">';
505 print
'<input type="text" name="TAKEPOS_SUMUP_APPID" value="' .
getDolGlobalString(
'TAKEPOS_SUMUP_APPID').
'"></input>';
506 print
"</td></tr>\n";
512print $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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.