diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 431d93e2a96..6cf9c84d265 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -63,7 +63,7 @@ if ($action == 'setcoder') $resql=$db->query($sqlp); if (! $resql) dol_print_error($db); } -else if ($action == 'update') +elseif ($action == 'update') { $location = GETPOST('GENBARCODE_LOCATION','alpha'); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); @@ -71,17 +71,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 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions') setEventMessages($langs->trans("Error"), null, 'errors'); } } +elseif ($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 @@ -161,9 +188,12 @@ foreach($dirbarcode as $reldir) print '
'; print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); -//print "
"; -//print ''; -//print ""; +if (empty($conf->use_javascript_ajax)) +{ + print ''; + print ''; + print ''; +} print ''; print ''; @@ -258,10 +288,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/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 5056844bcee..1aade173dc3 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -179,7 +179,7 @@ if ($type == 'directory') $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); // Right area. If module is defined here, we are in automatic ecm. - $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport'); + $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday'); // TODO change for multicompany sharing // Auto area for suppliers invoices @@ -210,6 +210,8 @@ if ($type == 'directory') else if ($module == 'user') $upload_dir = $conf->user->dir_output; // Auto area for expense report else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; + // Auto area for holiday + else if ($module == 'holiday') $upload_dir = $conf->holiday->dir_output; // Automatic list if (in_array($module, $automodules)) diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 857f8ee5c42..5a005e7de04 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -66,7 +66,7 @@ class FormBarCode $disable = ''; - if ($conf->use_javascript_ajax) + if (!empty($conf->use_javascript_ajax)) { print "\n".'