63 public function setBarcodeEncoder($selected, $barcodelist, $code_id, $idForm =
'formbarcode')
69 if (!empty($conf->use_javascript_ajax))
71 print "\n".
'<script type="text/javascript" language="javascript">';
72 print 'jQuery(document).ready(function () {
73 jQuery("#select'.$idForm.
'").change(function() {
74 var formName = document.getElementById("form'.$idForm.
'");
75 formName.action.value="setcoder";
79 print '</script>'.
"\n";
84 if (((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) ||
85 (!empty($conf->societe->enabled) && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id))
87 $disable =
'disabled';
90 if (!empty($conf->use_javascript_ajax))
92 $select_encoder =
'<form action="'.DOL_URL_ROOT.
'/admin/barcode.php" method="POST" id="form'.$idForm.
'">';
93 $select_encoder .=
'<input type="hidden" name="token" value="'.newToken().
'">';
94 $select_encoder .=
'<input type="hidden" name="action" value="update">';
95 $select_encoder .=
'<input type="hidden" name="code_id" value="'.$code_id.
'">';
98 $selectname = (!empty($conf->use_javascript_ajax) ?
'coder' :
'coder'.$code_id);
99 $select_encoder .=
'<select id="select'.$idForm.
'" class="flat" name="'.$selectname.
'">';
100 $select_encoder .=
'<option value="0"'.($selected == 0 ?
' selected' :
'').
' '.$disable.
'>'.$langs->trans(
'Disable').
'</option>';
101 $select_encoder .=
'<option value="-1" disabled>--------------------</option>';
102 foreach ($barcodelist as $key => $value)
104 $select_encoder .=
'<option value="'.$key.
'"'.($selected == $key ?
' selected' :
'').
'>'.$value.
'</option>';
106 $select_encoder .=
'</select>';
108 if (!empty($conf->use_javascript_ajax))
110 $select_encoder .=
'</form>';
113 return $select_encoder;
142 global $langs, $conf;
146 $sql =
"SELECT rowid, code, libelle";
147 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_barcode_type";
148 $sql .=
" WHERE coder <> '0'";
149 $sql .=
" AND entity = ".$conf->entity;
150 $sql .=
" ORDER BY code";
152 $result = $this->
db->query($sql);
154 $num = $this->
db->num_rows($result);
157 if ($useempty && $num > 0) {
158 $out .=
'<select class="flat minwidth75imp" name="'.$htmlname.
'" id="select_'.$htmlname.
'">';
159 $out .=
'<option value="0"> </option>';
161 $langs->load(
"errors");
162 $out .=
'<select disabled class="flat minwidth75imp" name="'.$htmlname.
'" id="select_'.$htmlname.
'">';
163 $out .=
'<option value="0" selected>'.$langs->trans(
'ErrorNoActivatedBarcode').
'</option>';
167 $obj = $this->
db->fetch_object($result);
168 if ($selected == $obj->rowid) {
169 $out .=
'<option value="'.$obj->rowid.
'" selected>';
171 $out .=
'<option value="'.$obj->rowid.
'">';
173 $out .= $obj->libelle;
211 global $langs, $conf;
213 if ($htmlname !=
"none") {
214 $out .=
'<form method="post" action="'.$page.
'">';
215 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
216 $out .=
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
217 $out .=
'<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
221 $out .=
'<td class="left"><input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
222 $out .=
'</td></tr></table></form>';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
$conf db
API class for accounts.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...