diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 313a852e384..75c82157ddf 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -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 '
'; print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); -//print "
"; -//print ''; -//print ""; +if (empty($conf->use_javascript_ajax)) +{ + print ''; + print ''; + print ''; +} print ''; print ''; @@ -260,10 +289,9 @@ print "
\n"; if (empty($conf->use_javascript_ajax)) { - // TODO Implement code behind action updateengine - //print '
'; + print '
'; + print '
'; } -//print ''; print "
"; diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index e1ee7ae04ff..d155c8a1a0c 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -59,7 +59,7 @@ class FormBarCode $disable = ''; - if ($conf->use_javascript_ajax) + if (!empty($conf->use_javascript_ajax)) { print "\n".'