$limit = "limit " . $nb_per_page_search * $page . ",{$nb_per_page_search}"; } $requete = "select expl_id as notice_id from {$table} " . $limit; $object_type = "EXPL"; break; } } if ($environement["caddie"]) { foreach ($environement["caddie"] as $environement_caddie) { $c = new caddie($environement_caddie); $nb_items_before = $c->nb_item; $resultat = @mysql_query($requete); print mysql_error(); while ($r = mysql_fetch_object($resultat)) { if ($environement["include_child"]) { $tab_list_child = notice::get_list_child($r->notice_id); if (count($tab_list_child)) { foreach ($tab_list_child as $notice_id) { $c->add_item($notice_id, $object_type); } } } else { $c->add_item($r->notice_id, $object_type); } } $c->compte_items(); $message .= sprintf($msg["print_cart_n_added"] . "\\n", $c->nb_item - $nb_items_before, $c->name); } print "<script>alert(\"{$message}\"); self.close();</script>"; } else { print "<script>alert(\"" . $msg["print_cart_no_cart_selected"] . "\"); history.go(-1);</script>";
static function get_list_child($notice_id, $liste = array()) { $tab = array(); $liste[] = $notice_id; $requete = "select num_notice as notice_id from notices_relations where linked_notice=" . $notice_id . " order by rank"; $res_child = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($res_child)) { while ($child = pmb_mysql_fetch_object($res_child)) { if (!in_array($child->notice_id, $liste)) { $liste[] = $child->notice_id; $tab_tmp = notice::get_list_child($child->notice_id, $liste); $tab = array_merge($tab, $tab_tmp); } else { // cas de rebouclage d'une fille sur une mère: donc on sort. $tab[] = $notice_id; return $tab; } } pmb_mysql_free_result($res_child); } $tab[] = $notice_id; return $tab; }
if ($item) { print "<h1>" . $msg["400"] . "</h1>"; $notice = new mono_display($item, 1); print pmb_bidi('<strong>' . $notice->header . '</strong><br />'); } switch ($action) { case 'add_item': // cas du click sur le lien du panier if ($idcaddie) { $caddie[0] = $idcaddie; } // Pour tous les paniers cochés foreach ($caddie as $idcaddie) { $myCart = new caddie($idcaddie); if ($include_child) { $tab_list_child = notice::get_list_child($item); if (count($tab_list_child)) { foreach ($tab_list_child as $notice_id) { $myCart->add_item($notice_id, "NOTI"); } } } else { $myCart->add_item($item, "NOTI"); } $myCart->compte_items(); } print "<script type='text/javascript'>window.close();</script>"; break; case 'new_cart': $select_cart = "\n\t\t<select name='cart_type'>\n\t\t\t<option value='NOTI' selected>{$msg['caddie_de_NOTI']}</option>\n\t\t\t<option value='EXPL'>{$msg['caddie_de_EXPL']}</option>\n\t\t\t<option value='BULL'>{$msg['caddie_de_BULL']}</option>\n\t\t</select>\n\t\t<input type='hidden' name='current_print' value='{$current_print}'/>"; $c_form = str_replace('!!cart_type_select!!', $select_cart, $cart_form);
$forcage['notice_perio_abo'] = 1; } if ($supp_notice_perio_collstat) { $forcage['notice_perio_collstat'] = 1; } if ($supp_notice_perio_modele) { $forcage['notice_perio_modele'] = 1; } if ($supp_bulletin_linked_expl_num) { $forcage['bulletin_linked_expl_num'] = 1; } while (list($cle, $object) = each($liste)) { // le formulaire demande de suprimmer toutes les notices liées à celle-ci if ($supp_notice_linked_cascade) { $forcage['notice_linked'] = 1; $liste_linked = notice::get_list_child($object); foreach ($liste_linked as $object) { if ($myCart->del_item_base($object, $forcage) == CADDIE_ITEM_SUPPR_BASE_OK) { $myCart->del_item_all_caddies($object, $myCart->type); } else { $res_aff_suppr_base .= aff_cart_unique_object($object, $myCart->type, $url_base = "./catalog.php?categ=caddie&sub=gestion&quoi=panier&idcaddie={$idcaddie}"); } } } else { if ($myCart->del_item_base($object, $forcage) == CADDIE_ITEM_SUPPR_BASE_OK) { $myCart->del_item_all_caddies($object, $myCart->type); } else { $res_aff_suppr_base .= aff_cart_unique_object($object, $myCart->type, $url_base = "./catalog.php?categ=caddie&sub=gestion&quoi=panier&idcaddie={$idcaddie}"); } } }