code syntax

This commit is contained in:
Frédéric FRANCE 2021-02-22 19:05:32 +01:00
parent 5199e3da5b
commit bb276566c6
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 90 additions and 115 deletions

View File

@ -52,27 +52,21 @@ $maxperinit = 1000;
*/ */
// Define barcode template for products // Define barcode template for products
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
{
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
foreach ($dirbarcodenum as $dirroot) foreach ($dirbarcodenum as $dirroot) {
{
$dir = dol_buildpath($dirroot, 0); $dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir); $handle = @opendir($dir);
if (is_resource($handle)) if (is_resource($handle)) {
{ while (($file = readdir($handle)) !== false) {
while (($file = readdir($handle)) !== false) if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
{
if (preg_match('/^mod_barcode_product_.*php$/', $file))
{
$file = substr($file, 0, dol_strlen($file) - 4); $file = substr($file, 0, dol_strlen($file) - 4);
try { try {
dol_include_once($dirroot.$file.'.php'); dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) } catch (Exception $e) {
{
dol_syslog($e->getMessage(), LOG_ERR); dol_syslog($e->getMessage(), LOG_ERR);
} }
@ -85,28 +79,23 @@ if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
} }
} }
if ($action == 'initbarcodeproducts') if ($action == 'initbarcodeproducts') {
{ if (!is_object($modBarCodeProduct)) {
if (!is_object($modBarCodeProduct))
{
$error++; $error++;
setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors'); setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors');
} }
if (!$error) if (!$error) {
{
$productstatic = new Product($db); $productstatic = new Product($db);
$db->begin(); $db->begin();
$nbok = 0; $nbok = 0;
if (!empty($eraseallbarcode)) if (!empty($eraseallbarcode)) {
{
$sql = "UPDATE ".MAIN_DB_PREFIX."product"; $sql = "UPDATE ".MAIN_DB_PREFIX."product";
$sql .= " SET barcode = NULL"; $sql .= " SET barcode = NULL";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs'); setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs');
} else { } else {
$error++; $error++;
@ -121,16 +110,13 @@ if ($action == 'initbarcodeproducts')
dol_syslog("codeinit", LOG_DEBUG); dol_syslog("codeinit", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $nbok = $nbtry = 0; $i = 0; $nbok = $nbtry = 0;
while ($i < min($num, $maxperinit)) while ($i < min($num, $maxperinit)) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) if ($obj) {
{
$productstatic->id = $obj->rowid; $productstatic->id = $obj->rowid;
$productstatic->ref = $obj->ref; $productstatic->ref = $obj->ref;
$productstatic->type = $obj->fk_product_type; $productstatic->type = $obj->fk_product_type;
@ -140,7 +126,9 @@ if ($action == 'initbarcodeproducts')
$result = $productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY'); $result = $productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY');
$nbtry++; $nbtry++;
if ($result > 0) $nbok++; if ($result > 0) {
$nbok++;
}
} }
$i++; $i++;
@ -150,14 +138,12 @@ if ($action == 'initbarcodeproducts')
dol_print_error($db); dol_print_error($db);
} }
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} }
} }
if (!$error) if (!$error) {
{
//$db->rollback(); //$db->rollback();
$db->commit(); $db->commit();
} else { } else {
@ -174,8 +160,12 @@ if ($action == 'initbarcodeproducts')
* View * View
*/ */
if (!$user->admin) accessforbidden(); if (!$user->admin) {
if (empty($conf->barcode->enabled)) accessforbidden(); accessforbidden();
}
if (empty($conf->barcode->enabled)) {
accessforbidden();
}
$form = new Form($db); $form = new Form($db);
@ -198,8 +188,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<br>'; print '<br>';
// For thirdparty // For thirdparty
if ($conf->societe->enabled) if ($conf->societe->enabled) {
{
$nbno = $nbtotal = 0; $nbno = $nbtotal = 0;
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company'); print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
@ -207,19 +196,21 @@ if ($conf->societe->enabled)
print '<br>'."\n"; print '<br>'."\n";
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbno = $obj->nb; $nbno = $obj->nb;
} else dol_print_error($db); } else {
dol_print_error($db);
}
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbtotal = $obj->nb; $nbtotal = $obj->nb;
} else dol_print_error($db); } else {
dol_print_error($db);
}
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n"; print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
@ -231,8 +222,7 @@ if ($conf->societe->enabled)
// For products // For products
if ($conf->product->enabled || $conf->product->service) if ($conf->product->enabled || $conf->product->service) {
{
// Example 1 : Adding jquery code // Example 1 : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
function confirm_erase() { function confirm_erase() {
@ -251,32 +241,32 @@ if ($conf->product->enabled || $conf->product->service)
$sql .= " GROUP BY fk_product_type, datec"; $sql .= " GROUP BY fk_product_type, datec";
$sql .= " ORDER BY datec"; $sql .= " ORDER BY datec";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbno += $obj->nb; $nbno += $obj->nb;
$i++; $i++;
} }
} else dol_print_error($db); } else {
dol_print_error($db);
}
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbtotal = $obj->nb; $nbtotal = $obj->nb;
} else dol_print_error($db); } else {
dol_print_error($db);
}
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n"; print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
if (is_object($modBarCodeProduct)) if (is_object($modBarCodeProduct)) {
{
print $langs->trans("BarCodeNumberManager").": "; print $langs->trans("BarCodeNumberManager").": ";
$objproduct = new Product($db); $objproduct = new Product($db);
print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>'; print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
@ -286,8 +276,7 @@ if ($conf->product->enabled || $conf->product->service)
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined"); $titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
print '<font class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</font> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>'; print '<font class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</font> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
} }
if (empty($nbno)) if (empty($nbno)) {
{
$disabled1 = 1; $disabled1 = 1;
} }

View File

@ -24,7 +24,9 @@
*/ */
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token. if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
}
} }
require '../main.inc.php'; require '../main.inc.php';
@ -59,8 +61,7 @@ $thirdpartytmp = new Societe($db);
* Actions * Actions
*/ */
if (GETPOST('submitproduct') && GETPOST('submitproduct')) if (GETPOST('submitproduct') && GETPOST('submitproduct')) {
{
$action = ''; // We reset because we don't want to build doc $action = ''; // We reset because we don't want to build doc
if (GETPOST('productid', 'int') > 0) { if (GETPOST('productid', 'int') > 0) {
$result = $producttmp->fetch(GETPOST('productid', 'int')); $result = $producttmp->fetch(GETPOST('productid', 'int'));
@ -70,62 +71,56 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
$forbarcode = $producttmp->barcode; $forbarcode = $producttmp->barcode;
$fk_barcode_type = $producttmp->barcode_type; $fk_barcode_type = $producttmp->barcode_type;
if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) {
$fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
}
if (empty($forbarcode) || empty($fk_barcode_type)) if (empty($forbarcode) || empty($fk_barcode_type)) {
{
setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete", $producttmp->getNomUrl()), null, 'warnings'); setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete", $producttmp->getNomUrl()), null, 'warnings');
} }
} }
} }
if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) {
{
$action = ''; // We reset because we don't want to build doc $action = ''; // We reset because we don't want to build doc
if (GETPOST('socid', 'int') > 0) if (GETPOST('socid', 'int') > 0) {
{
$thirdpartytmp->fetch(GETPOST('socid', 'int')); $thirdpartytmp->fetch(GETPOST('socid', 'int'));
$forbarcode = $thirdpartytmp->barcode; $forbarcode = $thirdpartytmp->barcode;
$fk_barcode_type = $thirdpartytmp->barcode_type_code; $fk_barcode_type = $thirdpartytmp->barcode_type_code;
if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) {
$fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
}
if (empty($forbarcode) || empty($fk_barcode_type)) if (empty($forbarcode) || empty($fk_barcode_type)) {
{
setEventMessages($langs->trans("DefinitionOfBarCodeForThirdpartyNotComplete", $thirdpartytmp->getNomUrl()), null, 'warnings'); setEventMessages($langs->trans("DefinitionOfBarCodeForThirdpartyNotComplete", $thirdpartytmp->getNomUrl()), null, 'warnings');
} }
} }
} }
if ($action == 'builddoc') if ($action == 'builddoc') {
{
$result = 0; $error = 0; $result = 0; $error = 0;
if (empty($forbarcode)) // barcode value if (empty($forbarcode)) { // barcode value
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
$error++; $error++;
} }
if (empty($fk_barcode_type)) // barcode type = barcode encoding if (empty($fk_barcode_type)) { // barcode type = barcode encoding
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
$error++; $error++;
} }
if (!$error) if (!$error) {
{
// Get encoder (barcode_type_coder) from barcode type id (barcode_type) // Get encoder (barcode_type_coder) from barcode type id (barcode_type)
$stdobject = new GenericObject($db); $stdobject = new GenericObject($db);
$stdobject->barcode_type = $fk_barcode_type; $stdobject->barcode_type = $fk_barcode_type;
$result = $stdobject->fetch_barcode(); $result = $stdobject->fetch_barcode();
if ($result <= 0) if ($result <= 0) {
{
$error++; $error++;
setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors'); setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors');
} }
} }
if (!$error) if (!$error) {
{
$code = $forbarcode; $code = $forbarcode;
$generator = $stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine. $generator = $stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine.
$encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ... $encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ...
@ -136,34 +131,34 @@ if ($action == 'builddoc')
// Generate barcode // Generate barcode
$dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']); $dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
foreach ($dirbarcode as $reldir) foreach ($dirbarcode as $reldir) {
{
$dir = dol_buildpath($reldir, 0); $dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir); $newdir = dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php) // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue; if (!is_dir($newdir)) {
continue;
}
$result = @include_once $newdir.$generator.'.modules.php'; $result = @include_once $newdir.$generator.'.modules.php';
if ($result) break; if ($result) {
break;
}
} }
// Load barcode class for generating barcode image // Load barcode class for generating barcode image
$classname = "mod".ucfirst($generator); $classname = "mod".ucfirst($generator);
$module = new $classname($db); $module = new $classname($db);
if ($generator != 'tcpdfbarcode') if ($generator != 'tcpdfbarcode') {
{
// May be phpbarcode // May be phpbarcode
$template = 'standardlabel'; $template = 'standardlabel';
$is2d = false; $is2d = false;
if ($module->encodingIsSupported($encoding)) if ($module->encodingIsSupported($encoding)) {
{
$barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
dol_delete_file($barcodeimage); dol_delete_file($barcodeimage);
// File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$result = $module->writeBarCode($code, $encoding, 'Y', 4, 1); $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
if ($result <= 0 || !dol_is_file($barcodeimage)) if ($result <= 0 || !dol_is_file($barcodeimage)) {
{
$error++; $error++;
setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors'); setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
@ -179,8 +174,7 @@ if ($action == 'builddoc')
} }
} }
if (!$error) if (!$error) {
{
// List of values to scan for a replacement // List of values to scan for a replacement
$substitutionarray = array( $substitutionarray = array(
'%LOGIN%' => $user->login, '%LOGIN%' => $user->login,
@ -200,8 +194,7 @@ if ($action == 'builddoc')
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
// For labels // For labels
if ($mode == 'label') if ($mode == 'label') {
{
$txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator $txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
$textleft = make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT) ? $txtforsticker : $conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray); $textleft = make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT) ? $txtforsticker : $conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
$textheader = make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT) ? '' : $conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray); $textheader = make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT) ? '' : $conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
@ -210,8 +203,7 @@ if ($action == 'builddoc')
$forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH); $forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH);
$forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT); $forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
for ($i = 0; $i < $numberofsticker; $i++) for ($i = 0; $i < $numberofsticker; $i++) {
{
$arrayofrecords[] = array( $arrayofrecords[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
@ -229,14 +221,11 @@ if ($action == 'builddoc')
$mesg = ''; $mesg = '';
// Build and output PDF // Build and output PDF
if ($mode == 'label') if ($mode == 'label') {
{ if (!count($arrayofrecords)) {
if (!count($arrayofrecords))
{
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($modellabel) || $modellabel == '-1') if (empty($modellabel) || $modellabel == '-1') {
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
} }
@ -269,7 +258,9 @@ if ($action == 'builddoc')
* View * View
*/ */
if (empty($conf->barcode->enabled)) accessforbidden(); if (empty($conf->barcode->enabled)) {
accessforbidden();
}
$form = new Form($db); $form = new Form($db);
@ -300,8 +291,7 @@ print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">'; print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
// List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php)
$arrayoflabels = array(); $arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards) {
{
$labeltoshow = $_Avery_Labels[$codecards]['name']; $labeltoshow = $_Avery_Labels[$codecards]['name'];
//$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')'; //$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
$arrayoflabels[$codecards] = $labeltoshow; $arrayoflabels[$codecards] = $labeltoshow;
@ -387,8 +377,7 @@ jQuery(document).ready(function() {
print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' &nbsp; '; print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' &nbsp; ';
print '<br>'; print '<br>';
if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)) if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)) {
{
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' &nbsp; '; print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' &nbsp; ';
print '<br>'; print '<br>';
print '<div class="showforproductselector">'; print '<div class="showforproductselector">';
@ -397,8 +386,7 @@ if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)
print '</div>'; print '</div>';
} }
if (!empty($user->rights->societe->lire)) if (!empty($user->rights->societe->lire)) {
{
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' &nbsp; '; print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' &nbsp; ';
print '<br>'; print '<br>';
print '<div class="showforthirdpartyselector">'; print '<div class="showforthirdpartyselector">';
@ -409,12 +397,10 @@ if (!empty($user->rights->societe->lire))
print '<br>'; print '<br>';
if ($producttmp->id > 0) if ($producttmp->id > 0) {
{
print $langs->trans("BarCodeDataForProduct", '').' '.$producttmp->getNomUrl(1).'<br>'; print $langs->trans("BarCodeDataForProduct", '').' '.$producttmp->getNomUrl(1).'<br>';
} }
if ($thirdpartytmp->id > 0) if ($thirdpartytmp->id > 0) {
{
print $langs->trans("BarCodeDataForThirdparty", '').' '.$thirdpartytmp->getNomUrl(1).'<br>'; print $langs->trans("BarCodeDataForThirdparty", '').' '.$thirdpartytmp->getNomUrl(1).'<br>';
} }