mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX #3234
This commit is contained in:
parent
3ea69cb1f1
commit
8ec2bac36a
|
|
@ -70,18 +70,8 @@ else if ($action == 'update')
|
|||
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
|
||||
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($action == 'updateengine')
|
||||
{
|
||||
// TODO Update engines.
|
||||
|
||||
}
|
||||
|
||||
if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
||||
{
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
|
|
@ -90,6 +80,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
|||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
else if ($action == 'updateengine')
|
||||
{
|
||||
$sql = "SELECT rowid, coder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY code";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if (GETPOST('coder'.$obj->rowid, 'alpha'))
|
||||
{
|
||||
$coder = GETPOST('coder'.$obj->rowid,'alpha');
|
||||
$code_id = $obj->rowid;
|
||||
|
||||
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sqlp.= " SET coder = '" . $coder."'";
|
||||
$sqlp.= " WHERE rowid = ". $code_id;
|
||||
$sqlp.= " AND entity = ".$conf->entity;
|
||||
|
||||
$upsql=$db->query($sqlp);
|
||||
if (! $upsql) dol_print_error($db);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -162,9 +188,12 @@ $var=true;
|
|||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
|
||||
|
||||
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateengine">';
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
@ -260,10 +289,9 @@ print "</table>\n";
|
|||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
// TODO Implement code behind action updateengine
|
||||
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
|
||||
print '</form>';
|
||||
}
|
||||
//print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class FormBarCode
|
|||
|
||||
$disable = '';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
|
|
@ -79,19 +79,29 @@ class FormBarCode
|
|||
{
|
||||
$disable = 'disabled';
|
||||
}
|
||||
|
||||
$select_encoder = '<form action="'.DOL_URL_ROOT.'/admin/barcode.php" method="post" id="form'.$idForm.'">';
|
||||
$select_encoder.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$select_encoder.= '<input type="hidden" name="action" value="update">';
|
||||
$select_encoder.= '<input type="hidden" name="code_id" value="'.$code_id.'">';
|
||||
$select_encoder.= '<select id="select'.$idForm.'" class="flat" name="coder">';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$select_encoder = '<form action="'.DOL_URL_ROOT.'/admin/barcode.php" method="POST" id="form'.$idForm.'">';
|
||||
$select_encoder.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$select_encoder.= '<input type="hidden" name="action" value="update">';
|
||||
$select_encoder.= '<input type="hidden" name="code_id" value="'.$code_id.'">';
|
||||
}
|
||||
|
||||
$selectname=(!empty($conf->use_javascript_ajax)?'coder':'coder'.$code_id);
|
||||
$select_encoder.= '<select id="select'.$idForm.'" class="flat" name="'.$selectname.'">';
|
||||
$select_encoder.= '<option value="0"'.($selected==0?' selected':'').' '.$disable.'>'.$langs->trans('Disable').'</option>';
|
||||
$select_encoder.= '<option value="-1" disabled>--------------------</option>';
|
||||
foreach($barcodelist as $key => $value)
|
||||
{
|
||||
$select_encoder.= '<option value="'.$key.'"'.($selected==$key?' selected':'').'>'.$value.'</option>';
|
||||
}
|
||||
$select_encoder.= '</select></form>';
|
||||
$select_encoder.= '</select>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$select_encoder.= '</form>';
|
||||
}
|
||||
|
||||
return $select_encoder;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user