diff --git a/action/editer_tradlang.php b/action/editer_tradlang.php index 3b34cb5e368dec15d8206e3914e4ad52df1526c6..7fb620ac2b3d265c2d75a059007d8e4c67845b0e 100644 --- a/action/editer_tradlang.php +++ b/action/editer_tradlang.php @@ -82,7 +82,7 @@ function tradlang_set($id_tradlang, $set = null) { if (($statut = (in_array(_request('statut'), array('NEW', 'MODIF', 'OK', 'RELIRE'))) ? _request('statut') : $c['statut']) and ($statut != $infos_tradlang['statut'])) { sql_updateq('spip_tradlangs', array('statut' => $statut), 'id_tradlang = ' . intval($id_tradlang)); $infos_maj = array(); - $bilan = sql_fetsel('chaines_ok,chaines_relire,chaines_modif,chaines_new', 'spip_tradlangs_bilans', 'module = ' . sql_quote($infos_tradlang['module']) . ' AND lang = ' . sql_quote($infos_tradlang['lang'])); + $bilan = sql_fetsel('chaines_ok,chaines_relire,chaines_modif,chaines_new', 'spip_tradlangs_bilans', 'id_tradlang_module=' . intval($infos_tradlang['id_tradlang_module']) . ' AND lang=' . sql_quote($infos_tradlang['lang'])); if ($statut == 'OK') { $infos_maj['chaines_ok'] = ($bilan['chaines_ok']+1); } elseif ($statut == 'RELIRE') { @@ -103,7 +103,7 @@ function tradlang_set($id_tradlang, $set = null) { $infos_maj['chaines_new'] = ($bilan['chaines_new']-1); } - sql_updateq('spip_tradlangs_bilans', $infos_maj, 'module = ' . sql_quote($infos_tradlang['module']) . ' AND lang = ' . sql_quote($infos_tradlang['lang'])); + sql_updateq('spip_tradlangs_bilans', $infos_maj, 'id_tradlang_module=' . intval($infos_tradlang['id_tradlang_module']) . ' AND lang=' . sql_quote($infos_tradlang['lang'])); } //$c = collecter_requests(array('statut'),array(),$set); @@ -131,7 +131,7 @@ function instituer_tradlang($id_tradlang, $c) { // cf autorisations dans inc/instituer_article if ($s != $statut) { - if (autoriser('modifier', 'tradlang', $tradlang)) { + if (autoriser('modifier', 'tradlang', $id_tradlang)) { $statut = $champs['statut'] = $s; } else { spip_log("editer_tradlang $id_tradlang refus " . join(' ', $c)); diff --git a/inc/tradlang_ajouter_code_langue.php b/inc/tradlang_ajouter_code_langue.php index 07c25e7f95c89c6ffab3c2a12ca1de5923f1ac87..6442cf8c224b74b9518a68bfbd8fe1fa6f0581f3 100644 --- a/inc/tradlang_ajouter_code_langue.php +++ b/inc/tradlang_ajouter_code_langue.php @@ -68,8 +68,8 @@ function inc_tradlang_ajouter_code_langue($module, $lang) { /** * On ajoute un job tout de suite pour générer les premières révisions */ - $job_description = _T('tradlang:job_creation_revisions_modules', array('module' => $module['module'])); - job_queue_add('tradlang_creer_premieres_revisions', $job_description, array('module' => $module['module'], 'lang'=>$lang), 'inc/', false, 0, 10); + $job_description = _T('tradlang:job_creation_revisions_modules', array('module' => "#". $module['id_tradlang_module'] . ' ' . $module['module'])); + job_queue_add('tradlang_creer_premieres_revisions', $job_description, array($module['id_tradlang_module'], $lang), 'inc/', false, 0, 10); /** * On ajoute la ligne du bilan diff --git a/inc/tradlang_creer_premieres_revisions.php b/inc/tradlang_creer_premieres_revisions.php index 99fc69eac91a5f9ccfd100bb9b772743a88fee8a..ac86687909615a9d47c58cb3fe470624ce1d79e1 100644 --- a/inc/tradlang_creer_premieres_revisions.php +++ b/inc/tradlang_creer_premieres_revisions.php @@ -7,17 +7,16 @@ if (!defined('_ECRIRE_INC_VERSION')) { /** * Fonction de création des premières révisions * - * @param array $module - * Les informations du module en base (on a besoin des champs "module","lang_mere") + * @param int $id_tradlang_module * @param string $lang * La langue dans laquelle on souhaite créer la nouvelle version */ -function inc_tradlang_creer_premieres_revisions_dist($module = false, $lang = false, $nb = false) { +function inc_tradlang_creer_premieres_revisions_dist($id_tradlang_module=0, $lang = false, $nb = false) { include_spip('inc/revisions'); $count = 0; if ($versionnes = liste_champs_versionnes('spip_tradlangs')) { $where = 'b.id_objet IS NULL'; - $where .= (isset($module) and $module) ? ' AND a.module = '.sql_quote($module) : ''; + $where .= (isset($id_tradlang_module) and $id_tradlang_module) ? ' AND a.id_tradlang_module = '.intval($id_tradlang_module) : ''; $where .= (isset($lang) and $lang) ? ' AND a.lang = '.sql_quote($lang) : ''; if (isset($nb) && is_numeric($nb) && $nb > 1) { $nb = $nb;