|
|
|
@ -116,6 +116,7 @@ function formulaires_migrer_albums_traiter_dist() {
|
|
|
|
|
* @return int nombre d'articles migrés |
|
|
|
|
*/ |
|
|
|
|
function albums_migrer_articles($where_articles, $where_mots, $refuser, $lier_rubriques) { |
|
|
|
|
$id_album = null; |
|
|
|
|
include_spip('action/editer_objet'); |
|
|
|
|
include_spip('action/editer_liens'); |
|
|
|
|
|
|
|
|
@ -127,7 +128,7 @@ function albums_migrer_articles($where_articles, $where_mots, $refuser, $lier_ru
|
|
|
|
|
// y a-t-il deja un album associe ? |
|
|
|
|
$liens = objet_trouver_liens(['album' => '*'], ['article' => $row['id_article']]); |
|
|
|
|
if ( |
|
|
|
|
!count($liens) |
|
|
|
|
!(is_countable($liens) ? count($liens) : 0) |
|
|
|
|
and $id_album = objet_inserer('album') |
|
|
|
|
) { |
|
|
|
|
// associer tout de suite à l'article |
|
|
|
@ -176,7 +177,7 @@ function albums_migrer_articles($where_articles, $where_mots, $refuser, $lier_ru
|
|
|
|
|
'id_objet=' . intval($row['id_article']) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (count($docs)) { |
|
|
|
|
if (is_countable($docs) ? count($docs) : 0) { |
|
|
|
|
$insert = []; |
|
|
|
|
foreach ($docs as $doc) { |
|
|
|
|
$insert[] = ['id_document' => $doc['id_document'], 'objet' => 'album','id_objet' => $id_album]; |
|
|
|
@ -191,7 +192,7 @@ function albums_migrer_articles($where_articles, $where_mots, $refuser, $lier_ru
|
|
|
|
|
ON (M.id_mot=L.id_mot AND L.objet="article")', |
|
|
|
|
'id_objet=' . intval($row['id_article']) . ' AND (' . $where_mots . ')' |
|
|
|
|
); |
|
|
|
|
if (count($mots)) { |
|
|
|
|
if (is_countable($mots) ? count($mots) : 0) { |
|
|
|
|
$insert = []; |
|
|
|
|
foreach ($mots as $mot) { |
|
|
|
|
$insert[] = ['id_mot' => $mot['id_mot'],'objet' => 'album','id_objet' => $id_album]; |
|
|
|
@ -207,7 +208,7 @@ function albums_migrer_articles($where_articles, $where_mots, $refuser, $lier_ru
|
|
|
|
|
|
|
|
|
|
// refuser l'article si option demandee |
|
|
|
|
// meme si c'est un article migre un coup avant |
|
|
|
|
if (count($liens) or $id_album) { |
|
|
|
|
if (is_countable($liens) ? count($liens) : 0 or $id_album) { |
|
|
|
|
if ($refuser) { |
|
|
|
|
objet_modifier('article', $row['id_article'], ['statut' => 'refuse']); |
|
|
|
|
} |
|
|
|
|