function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); $search = "select bulletin_id from bulletins where bulletin_numero LIKE '" . addslashes($bull_info['num']) . "' and bulletin_notice = {$perio_id}"; $res = pmb_mysql_query($search); if (pmb_mysql_num_rows($res) == 0) { $bulletin = new bulletinage("", $perio_id); $info = array(); $info['bul_titre'] = ''; $info['bul_no'] = addslashes($bull_info['num']); $bull_id = $bulletin->update($info); } else { $bull_id = pmb_mysql_result($res, 0, 0); //on regarde si une notice n'existe pas déjà pour ce bulletin /*$req = "select num_notice from bulletins where bulletin_id = $bull_id and num_notice != 0"; $res = pmb_mysql_query($req); //si oui on retire l'enregistrement en cours, et on continue sur la notice existante... if(pmb_mysql_num_rows($res)>0) { notice::del_notice($notice_id); $notice_id = pmb_mysql_result($res,0,0); }*/ } return $bull_id; }
function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); //on s'occupe du cas ou on a pas de titre pour le bulletin $search = "select bulletin_id from bulletins where date_date = '" . $bull_info['date'] . "' and bulletin_numero LIKE '" . $bull_info['num'] . "' and bulletin_notice = {$perio_id}"; $res = pmb_mysql_query($search); if (pmb_mysql_num_rows($res) == 0) { if ($bull_info['mention'] == "") { $bull_info['mention'] = substr($bull_info['date'], 8, 2) . "/" . substr($bull_info['date'], 5, 2) . "/" . substr($bull_info['date'], 0, 4); } $insert = "insert into bulletins set date_date = '" . $bull_info['date'] . "', mention_date = '" . $bull_info['mention'] . "', bulletin_numero = '" . $bull_info['num'] . "', bulletin_notice = {$perio_id}"; if ($bl == "s" && $hl == "2") { $insert .= ", num_notice = {$notice_id}"; update_notice("b", "2"); } $result = pmb_mysql_query($insert); $bull_id = pmb_mysql_insert_id(); } else { $bull_id = pmb_mysql_result($res, 0, 0); } return $bull_id; }
function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); //on s'occupe du cas ou on a pas de titre pour le bulletin // num (mention) [date] if ($bull_info['titre'] == "") { $bull_info['titre'] = $bull_info['num'] . ($bull_info['mention'] ? " (" . $bull_info['mention'] . ") " : " ") . ($bull_info['date'] ? "[" . $bull_info['date'] . "]" : ""); } $search = "select bulletin_id from bulletins where bulletin_titre LIKE '" . addslashes($bull_info['titre']) . "' and mention_date LIKE '" . $bull_info['mention'] . "' and bulletin_numero LIKE '" . $bull_info['num'] . "' and bulletin_notice = {$perio_id}"; $res = mysql_query($search); if (mysql_num_rows($res) == 0) { $insert = "insert into bulletins set bulletin_titre = '" . $bull_info['titre'] . "', date_date = '" . $bull_info['date'] . "', mention_date = '" . $bull_info['mention'] . "', bulletin_numero = '" . $bull_info['num'] . "', bulletin_notice = {$perio_id}"; if ($bl == "s" && $hl == "2") { $insert .= ", num_notice = {$notice_id}"; update_notice("b", "2"); } $result = mysql_query($insert); $bull_id = mysql_insert_id(); } else { $bull_id = mysql_result($res, 0, 0); //on regarde si une notice n'existe pas déjà pour ce bulletin $req = "select num_notice from bulletins where bulletin_id = {$bull_id} and num_notice != 0"; $res = mysql_query($req); //si oui on retire l'enregistrement en cours, et on continue sur la notice existante... if (mysql_num_rows($res) > 0) { notice::del_notice($notice_id); $notice_id = mysql_result($res, 0, 0); } } return $bull_id; }