diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 313a852e384da..75c82157ddfb1 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -70,18 +70,8 @@
$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 @@
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 @@
print '
';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
-//print "