Go to the documentation of this file.
27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbarcode.class.php';
32 $langs->load(
"admin");
38 $action =
GETPOST(
'action',
'aZ09');
39 $modulepart =
GETPOST(
'modulepart',
'aZ09');
46 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
48 if ($action ==
'setbarcodeproducton') {
49 $barcodenumberingmodule =
GETPOST(
'value',
'alpha');
50 $res =
dolibarr_set_const($db,
"BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule,
'chaine', 0,
'', $conf->entity);
51 if ($barcodenumberingmodule ==
'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) {
52 $res =
dolibarr_set_const($db,
"BARCODE_STANDARD_PRODUCT_MASK",
'020{000000000}',
'chaine', 0,
'', $conf->entity);
54 } elseif ($action ==
'setbarcodeproductoff') {
58 if ($action ==
'setcoder') {
59 $coder =
GETPOST(
'coder',
'alpha');
60 $code_id =
GETPOST(
'code_id',
'int');
61 $sqlp =
"UPDATE ".MAIN_DB_PREFIX.
"c_barcode_type";
62 $sqlp .=
" SET coder = '".$db->escape($coder).
"'";
63 $sqlp .=
" WHERE rowid = ".((int) $code_id);
64 $sqlp .=
" AND entity = ".$conf->entity;
66 $resql = $db->query($sqlp);
70 } elseif ($action ==
'update') {
71 $location =
GETPOST(
'GENBARCODE_LOCATION',
'alpha');
72 $res =
dolibarr_set_const($db,
"GENBARCODE_LOCATION", $location,
'chaine', 0,
'', $conf->entity);
73 $coder_id =
GETPOST(
'PRODUIT_DEFAULT_BARCODE_TYPE',
'alpha');
74 $res =
dolibarr_set_const($db,
"PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,
'chaine', 0,
'', $conf->entity);
75 $coder_id =
GETPOST(
'GENBARCODE_BARCODETYPE_THIRDPARTY',
'alpha');
76 $res =
dolibarr_set_const($db,
"GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,
'chaine', 0,
'', $conf->entity);
83 } elseif ($action ==
'updateengine') {
84 $sql =
"SELECT rowid, coder";
85 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_barcode_type";
86 $sql .=
" WHERE entity = ".$conf->entity;
87 $sql .=
" ORDER BY code";
91 $num = $db->num_rows(
$resql);
95 $obj = $db->fetch_object(
$resql);
97 if (
GETPOST(
'coder'.$obj->rowid,
'alpha')) {
98 $coder =
GETPOST(
'coder'.$obj->rowid,
'alpha');
99 $code_id = $obj->rowid;
101 $sqlp =
"UPDATE ".MAIN_DB_PREFIX.
"c_barcode_type";
102 $sqlp .=
" SET coder = '".$db->escape($coder).
"'";
103 $sqlp .=
" WHERE rowid = ".((int) $code_id);
104 $sqlp .=
" AND entity = ".$conf->entity;
106 $upsql = $db->query($sqlp);
125 $help_url =
'EN:Module_Barcode|FR:Module_Codes_Barre|ES:Módulo Código de barra|DE:Modul_Barcode';
128 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
129 print
load_fiche_titre($langs->trans(
"BarcodeSetup"), $linkback,
'title_setup');
132 $barcodelist = array();
138 $dirbarcode = array_merge(array(
"/core/modules/barcode/doc/"), $conf->modules_parts[
'barcode']);
140 foreach ($dirbarcode as $reldir) {
145 if (!is_dir($newdir)) {
149 $handle = @opendir($newdir);
150 if (is_resource($handle)) {
151 while (($file = readdir($handle)) !==
false) {
152 if (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS') {
153 if (is_readable($newdir.$file)) {
154 if (preg_match(
'/(.*)\.modules\.php$/i', $file, $reg)) {
158 require_once $newdir.$file;
159 $classname =
"mod".ucfirst($filebis);
160 $module =
new $classname($db);
163 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
166 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
170 if ($module->isEnabled()) {
171 $barcodelist[$filebis] = $module->info();
183 if ($conf->product->enabled) {
184 print
load_fiche_titre($langs->trans(
"BarCodeNumberManager").
" (".$langs->trans(
"Product").
")",
'',
'');
186 print
'<div class="div-table-responsive-no-min">';
187 print
'<table class="noborder centpercent">';
188 print
'<tr class="liste_titre">';
189 print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
190 print
'<td>'.$langs->trans(
"Description").
'</td>';
191 print
'<td>'.$langs->trans(
"Example").
'</td>';
192 print
'<td class="center" width="80">'.$langs->trans(
"Status").
'</td>';
193 print
'<td class="center" width="60">'.$langs->trans(
"ShortInfo").
'</td>';
196 $dirbarcodenum = array_merge(array(
'/core/modules/barcode/'), $conf->modules_parts[
'barcode']);
198 foreach ($dirbarcodenum as $dirroot) {
201 $handle = @opendir($dir);
202 if (is_resource($handle)) {
203 while (($file = readdir($handle)) !==
false) {
204 if (preg_match(
'/^mod_barcode_product_.*php$/', $file)) {
205 $file = substr($file, 0,
dol_strlen($file) - 4);
213 $modBarCode =
new $file();
215 print
'<tr class="oddeven">';
216 print
'<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom).
"</td><td>\n";
217 print $modBarCode->info($langs);
219 print
'<td class="nowrap">'.$modBarCode->getExample($langs).
"</td>\n";
221 if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM ==
"$file") {
222 print
'<td class="center"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setbarcodeproductoff&token='.
newToken().
'&value='.urlencode($file).
'">';
223 print
img_picto($langs->trans(
"Activated"),
'switch_on');
226 print
'<td class="center"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setbarcodeproducton&token='.
newToken().
'&value='.urlencode($file).
'">';
227 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
230 print
'<td class="center">';
231 $s = $modBarCode->getToolTip($langs,
null, -1);
232 print
$form->textwithpicto(
'', $s, 1);
252 if (empty($conf->use_javascript_ajax)) {
253 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" id="form_engine">';
254 print
'<input type="hidden" name="token" value="'.newToken().
'">';
255 print
'<input type="hidden" name="action" value="updateengine">';
258 print
'<div class="div-table-responsive-no-min">';
259 print
'<table class="noborder centpercent">';
260 print
'<tr class="liste_titre">';
261 print
'<td>'.$langs->trans(
"Name").
'</td>';
262 print
'<td>'.$langs->trans(
"Description").
'</td>';
263 print
'<td width="200" class="center">'.$langs->trans(
"Example").
'</td>';
264 print
'<td class="center" width="60">'.$langs->trans(
"CodeBarGenerator").
'</td>';
267 $sql =
"SELECT rowid, code as encoding, libelle as label, coder, example";
268 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_barcode_type";
269 $sql .=
" WHERE entity = ".$conf->entity;
270 $sql .=
" ORDER BY code";
273 $resql = $db->query($sql);
275 $num = $db->num_rows(
$resql);
279 $obj = $db->fetch_object(
$resql);
281 print
'<tr class="oddeven">';
282 print
'<td width="100">';
285 print $langs->trans(
'BarcodeDesc'.$obj->encoding);
292 print
'<td class="center">';
293 if ($obj->coder && $obj->coder != -1) {
296 foreach ($dirbarcode as $reldir) {
301 if (!is_dir($newdir)) {
305 $result = @include_once $newdir.$obj->coder.
'.modules.php';
311 $classname =
"mod".ucfirst($obj->coder);
312 if (class_exists($classname)) {
313 $module =
new $classname($db);
314 if ($module->encodingIsSupported($obj->encoding)) {
316 $result = $module->writeBarCode($obj->example, $obj->encoding,
'Y');
318 $url = DOL_URL_ROOT.
'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).
'&code='.urlencode($obj->example).
'&encoding='.urlencode($obj->encoding);
320 print
'<img src="'.$url.
'" title="'.$obj->example.
'" border="0">';
322 print $langs->trans(
"FormatNotSupportedByGenerator");
325 print
'ErrorClassNotFoundInModule '.$classname.
' '.$obj->coder;
329 print
'<span class="opacitymedium">'.$langs->trans(
"ChooseABarCode").
'</span>';
333 print
'<td class="center">';
334 print $formbarcode->setBarcodeEncoder($obj->coder, $barcodelist, $obj->rowid,
'form'.$i);
335 print
"</td></tr>\n";
343 if (empty($conf->use_javascript_ajax)) {
344 print
$form->buttonsSaveCancel(
"Save",
'');
355 print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
356 print
'<input type="hidden" name="token" value="'.newToken().
'">';
357 print
"<input type=\"hidden\" name=\"action\" value=\"update\">";
359 print
'<div class="div-table-responsive-no-min">';
360 print
'<table class="noborder centpercent">';
361 print
'<tr class="liste_titre">';
362 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
363 print
'<td width="60" class="center">'.$langs->trans(
"Value").
'</td>';
364 print
'<td> </td>';
368 if (!isset($_SERVER[
'WINDIR'])) {
369 print
'<tr class="oddeven">';
370 print
'<td>'.$langs->trans(
"GenbarcodeLocation").
'</td>';
371 print
'<td width="60" class="center">';
372 print
'<input type="text" size="40" name="GENBARCODE_LOCATION" value="'.getDolGlobalString(
'GENBARCODE_LOCATION').
'">';
373 if (!empty($conf->global->GENBARCODE_LOCATION) && !@file_exists($conf->global->GENBARCODE_LOCATION)) {
374 $langs->load(
"errors");
375 print
'<br><span class="error">'.$langs->trans(
"ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).
'</span>';
378 print
'<td> </td>';
383 if (!empty($conf->product->enabled)) {
384 print
'<tr class="oddeven">';
385 print
'<td>'.$langs->trans(
"SetDefaultBarcodeTypeProducts").
'</td>';
386 print
'<td width="60" class="right">';
387 print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,
"PRODUIT_DEFAULT_BARCODE_TYPE", 1);
389 print
'<td> </td>';
394 if (!empty($conf->societe->enabled)) {
395 print
'<tr class="oddeven">';
396 print
'<td>'.$langs->trans(
"SetDefaultBarcodeTypeThirdParties").
'</td>';
397 print
'<td width="60" class="right">';
398 print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,
"GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
400 print
'<td> </td>';
407 print
'<div class="tabsAction">';
408 print
'<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans(
"Modify").
'">';
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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).
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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 ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.