25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
30 require_once DOL_DOCUMENT_ROOT.
"/core/lib/takepos.lib.php";
31 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
34 if (!empty($_REQUEST[
'CASHDESK_ID_THIRDPARTY_id']))
36 $_GET[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
37 $_POST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
38 $_REQUEST[
'CASHDESK_ID_THIRDPARTY'] =
GETPOST(
'CASHDESK_ID_THIRDPARTY_id',
'alpha');
44 $langs->loadLangs(array(
"admin",
"cashdesk"));
48 $sql =
"SELECT code, libelle FROM ".MAIN_DB_PREFIX.
"c_paiement";
49 $sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
50 $sql .=
" AND active = 1";
51 $sql .=
" ORDER BY libelle";
55 while ($obj = $db->fetch_object(
$resql)) {
56 array_push($paiements, $obj);
60 $action =
GETPOST(
'action',
'aZ09');
72 if (
GETPOST(
'socid',
'int') < 0) $_POST[
"socid"] =
'';
74 $res =
dolibarr_set_const($db,
"TAKEPOS_ROOT_CATEGORY_ID",
GETPOST(
'TAKEPOS_ROOT_CATEGORY_ID',
'alpha'),
'chaine', 0,
'', $conf->entity);
75 $res =
dolibarr_set_const($db,
"TAKEPOS_SUPPLEMENTS_CATEGORY",
GETPOST(
'TAKEPOS_SUPPLEMENTS_CATEGORY',
'alpha'),
'chaine', 0,
'', $conf->entity);
77 $res =
dolibarr_set_const($db,
"TAKEPOS_SORTPRODUCTFIELD",
GETPOST(
'TAKEPOS_SORTPRODUCTFIELD',
'alpha'),
'chaine', 0,
'', $conf->entity);
78 $res =
dolibarr_set_const($db,
"TAKEPOS_NUM_TERMINALS",
GETPOST(
'TAKEPOS_NUM_TERMINALS',
'alpha'),
'chaine', 0,
'', $conf->entity);
80 $res =
dolibarr_set_const($db,
"TAKEPOS_EMAIL_TEMPLATE_INVOICE",
GETPOST(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE',
'alpha'),
'chaine', 0,
'', $conf->entity);
81 if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) {
82 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_AFFILIATE",
GETPOST(
'TAKEPOS_SUMUP_AFFILIATE',
'alpha'),
'chaine', 0,
'', $conf->entity);
83 $res =
dolibarr_set_const($db,
"TAKEPOS_SUMUP_APPID",
GETPOST(
'TAKEPOS_SUMUP_APPID',
'alpha'),
'chaine', 0,
'', $conf->entity);
88 if (!($res > 0)) $error++;
96 } elseif ($action ==
'updateMask') {
97 $maskconst =
GETPOST(
'maskconst',
'alpha');
98 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
99 if ($maskconst) $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
103 } elseif ($action ==
'setrefmod') {
104 $value =
GETPOST(
'value',
'alpha');
121 $form =
new Form($db);
124 llxHeader(
'', $langs->trans(
"CashDeskSetup"));
126 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
133 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
137 print '<table class="noborder" width="100%">';
138 print
'<tr class="liste_titre">';
139 print
'<td>'.$langs->trans(
"Name").
"</td>\n";
140 print
'<td>'.$langs->trans(
"Description").
"</td>\n";
141 print
'<td class="nowrap">'.$langs->trans(
"Example").
"</td>\n";
142 print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
143 print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
148 foreach ($dirmodels as $reldir)
154 $handle = opendir($dir);
155 if (is_resource($handle))
159 while (($file = readdir($handle)) !==
false)
161 if (substr($file, 0, 16) ==
'mod_takepos_ref_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php')
163 $file = substr($file, 0,
dol_strlen($file) - 4);
165 require_once $dir.$file.
'.php';
170 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
171 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
173 if ($module->isEnabled())
175 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
176 print $module->info();
180 print
'<td class="nowrap">';
181 $tmp = $module->getExample();
182 if (preg_match(
'/^Error/', $tmp)) {
183 $langs->load(
"errors");
184 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
185 } elseif ($tmp ==
'NotConfigured') print $langs->trans($tmp);
189 print '<td align="center">';
190 if ($conf->global->TAKEPOS_REF_ADDON == "$file")
192 print
img_picto($langs->trans(
"Activated"),
'switch_on');
194 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setrefmod&token='.
newToken().
'&value='.urlencode($file).
'">';
195 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
202 $invoice->date = $now;
203 $invoice->module_source =
'takepos';
204 $invoice->pos_source = 1;
208 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
209 $nextval = $module->getNextValue($mysoc, $invoice);
210 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
211 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
213 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured')
214 $nextval = $langs->trans($nextval);
215 $htmltooltip .= $nextval.
'<br>';
217 $htmltooltip .= $langs->trans($module->error).
'<br>';
221 print
'<td align="center">';
222 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
233 print
"</table><br>\n";
238 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
239 print
'<input type="hidden" name="token" value="'.newToken().
'">';
240 print
'<input type="hidden" name="action" value="set">';
242 print
'<div class="div-table-responsive-no-min">';
243 print
'<table class="noborder centpercent">';
245 print
'<tr class="liste_titre">';
246 print
'<td class="notitlefield">'.$langs->trans(
"Parameters").
'</td><td>'.$langs->trans(
"Value").
'</td>';
250 print
'<tr class="oddeven"><td>';
251 print $langs->trans(
"NumberOfTerminals");
252 print
'<td colspan="2">';
253 $array = array(1=>
"1", 2=>
"2", 3=>
"3", 4=>
"4", 5=>
"5", 6=>
"6", 7=>
"7", 8=>
"8", 9=>
"9");
254 print $form->selectarray(
'TAKEPOS_NUM_TERMINALS', $array, (empty($conf->global->TAKEPOS_NUM_TERMINALS) ?
'0' : $conf->global->TAKEPOS_NUM_TERMINALS), 0);
255 print
"</td></tr>\n";
258 if (!empty($conf->service->enabled))
260 print
'<tr class="oddeven"><td>';
261 print $langs->trans(
"CashdeskShowServices");
262 print
'<td colspan="2">';
265 print
"</td></tr>\n";
269 print
'<tr class="oddeven"><td>';
270 print $form->textwithpicto($langs->trans(
"RootCategoryForProductsToSell"), $langs->trans(
"RootCategoryForProductsToSellDesc"));
271 print
'<td colspan="2">';
272 print
img_object(
'',
'category',
'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID,
'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0);
274 print
"</td></tr>\n";
277 print
'<tr class="oddeven"><td>';
278 print $langs->trans(
"SortProductField");
279 print
'<td colspan="2">';
281 $array = array(
'rowid' =>
'ID',
'ref' =>
'Ref',
'label' =>
'Label',
'datec' =>
'DateCreation',
'tms' =>
'DateModification');
282 print $form->selectarray(
'TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ?
'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0,
'', 1);
283 print
"</td></tr>\n";
285 print
'<tr class="oddeven"><td>';
286 print $langs->trans(
'TakeposGroupSameProduct');
287 print
'<td colspan="2">';
288 print
ajax_constantonoff(
"TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0);
289 print
"</td></tr>\n";
292 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
293 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
294 foreach ($substitutionarray as $key => $val) $htmltext .= $key.
'<br>';
298 print
'<tr class="oddeven"><td>';
299 print $langs->trans(
"Paymentnumpad");
300 print
'<td colspan="2">';
301 $array = array(0=>$langs->trans(
"Numberspad"), 1=>$langs->trans(
"BillsCoinsPad"));
302 print $form->selectarray(
'TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ?
'0' : $conf->global->TAKEPOS_NUMPAD), 0);
303 print
"</td></tr>\n";
314 print
'<tr class="oddeven"><td>';
315 print $langs->trans(
'DirectPaymentButton');
316 print
'<td colspan="2">';
317 print
ajax_constantonoff(
"TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
319 print
"</td></tr>\n";
330 print
'<tr class="oddeven"><td>';
331 print $langs->trans(
'EmailTemplate');
332 print
'<td colspan="2">';
333 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
335 $nboftemplates = $formmail->fetchAllEMailTemplate(
'facture_send', $user, null, -1);
337 $arrayofmessagename = array();
338 if (is_array($formmail->lines_model)) {
339 foreach ($formmail->lines_model as $modelmail) {
342 if (!empty($arrayofmessagename[$modelmail->label])) {
343 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
345 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->topic)).$moreonlabel;
350 print $form->selectarray(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE,
'None', 1, 0,
'', 0, 0, 0,
'',
'', 1);
351 print
"</td></tr>\n";
354 print
'<tr class="oddeven"><td>';
355 print $langs->trans(
'ControlCashOpening');
356 print
'<td colspan="2">';
357 print
ajax_constantonoff(
"TAKEPOS_CONTROL_CASH_OPENING", array(), $conf->entity, 0, 0, 1, 0);
358 print
"</td></tr>\n";
361 print
'<tr class="oddeven"><td>';
362 print $langs->trans(
'GiftReceiptButton');
363 print
'<td colspan="2">';
365 print
"</td></tr>\n";
368 print
'<tr class="oddeven"><td>';
369 print $langs->trans(
'AllowDelayedPayment');
370 print
'<td colspan="2">';
371 print
ajax_constantonoff(
"TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
372 print
"</td></tr>\n";
436 if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
439 print
'<div class="div-table-responsive-no-min">';
440 print
'<table class="noborder centpercent">';
442 print
'<tr class="liste_titre">';
443 print
'<td class="titlefield">'.$langs->trans(
"Sumup").
'</td><td>'.$langs->trans(
"Value").
'</td>';
446 print
'<tr class="oddeven"><td>';
447 print $langs->trans(
"SumupAffiliate");
448 print
'<td colspan="2">';
449 print
'<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="'.$conf->global->TAKEPOS_SUMUP_AFFILIATE.
'"></input>';
450 print
"</td></tr>\n";
451 print
'<tr class="oddeven"><td>';
452 print $langs->trans(
"SumupAppId");
453 print
'<td colspan="2">';
454 print
'<input type="text" name="TAKEPOS_SUMUP_APPID" value="'.$conf->global->TAKEPOS_SUMUP_APPID.
'"></input>';
455 print
"</td></tr>\n";
463 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.
Class to manage products or services.
dol_now($mode= 'auto')
Return date for now.
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).
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
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.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print $_SERVER["PHP_SELF"] n
Edit parameters.
Class to manage invoices.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.