liste_sugg = $tableau_sugg; } /** * Formulaire de saisie des suggestions multiples */ function display_form(){ global $dbh, $multi_sug_form,$charset, $msg, $sug_src; //On charge la liste des sources $req = "select * from suggestions_source order by libelle_source"; $res= mysql_query($req,$dbh); $option = ""; while(($src=mysql_fetch_object($res))){ $option .= ""; } if(!$this->liste_sugg){ $nb_lignes=1; $multi_sug_form = str_replace('!!max_ligne!!',$nb_lignes,$multi_sug_form); $ligne = " "; } else { $liste = $this->liste_sugg; $this->ori_unimarc = microtime()."_unimulti"; for($i=0;$i $row["loc_libelle"], "visible" => $row["loc_visible"]); } //Traitement de la notice uni $uni = new suggestions_unimarc(); $uni->entrepot_to_unimarc($id_noti); $uni->sugg_uni_num_notice = $id_noti; $uni->sugg_uni_origine = $this->ori_unimarc; $uni->save(); $aff = new notice_affichage_unimarc($id_noti,'', 0,0, $entrepots_localisations); $aff->fetch_data(); $titre = $aff->notice->tit1; $auteur = ($aff->auteurs_principaux ? $aff->auteurs_principaux : $aff->auteurs_tous); $editeur =$aff->publishers[0]["name"]; $code = $aff->code; $prix =$aff->prix; $date=$aff->year; $url=($aff->notice->lien ? $aff->notice->lien : ($aff->notice->eformat ? $aff->notice->eformat :($aff->notice->lien_texte ? $aff->notice->lien_texte : ''))); $ext=true; } else{ $requete = "SELECT tit1 as titre, ed_name as editeur, CONCAT(author_name,' ',author_rejete) as auteur, prix, code, lien, year FROM notices LEFT JOIN responsability ON responsability_notice=notice_id LEFT JOIN authors ON responsability_author=author_id LEFT JOIN publishers ON ed1_id=ed_id WHERE notice_id=".$liste[$i]; $result = mysql_query($requete,$dbh); $sug = mysql_fetch_object($result); $titre = $sug->titre; $auteur = $sug->auteur; $editeur =$sug->editeur; $code = $sug->code; $prix =$sug->prix; $date =$sug->year; $url = $sug->lien; $notice_id = $liste[$i]; } $ligne .= " "; if($i==count($liste)-1){ $ligne .= ""; } else { $ligne .= ""; } if($ext) $ligne .= " "; if($notice_id) $ligne .= " "; $ligne .= ""; } $multi_sug_form = str_replace('!!max_ligne!!',$i,$multi_sug_form); } $multi_sug_form = str_replace('!!ligne!!',$ligne,$multi_sug_form); return $multi_sug_form; } /* * Enregistrement d'une suggestion multiple */ function save(){ global $dbh, $max_nblignes, $msg, $id_empr, $empr_location, $num_categ; for($i=0;$i<$max_nblignes;$i++){ $tit = "sugg_tit_".$i; $aut = "sugg_aut_".$i; $edi = "sugg_edi_".$i; $code = "sugg_code_".$i; $prix = "sugg_prix_".$i; $com = "sugg_com_".$i; $url = "sugg_url_".$i; $qte = "sugg_qte_".$i; $src = "sugg_src_".$i; $date = "sugg_date_".$i; $unimarc = "id_unimarc_".$i; $notice = "id_notice_".$i; global $sug_tr, $$tit, $$aut, $$edi, $$code, $$com, $$prix, $$url, $$qte, $$src, $$date, $$unimarc, $$notice; if(isset($$tit)){ if(!is_numeric($$qte)){ print "".$msg[empr_sugg_qte_error].""; return; } else if(!$$tit || (!$$edi && !$$aut && !$$code)) { print "".str_replace('\n','
',$msg['empr_sugg_ko']).""; return; } else if(!suggestions::exists($id_user,$$tit,$$aut,$$edi,$$code)) { $req="insert into suggestions set titre='".$$tit."', auteur='".$$aut."', editeur='".$$edi."', code='".$$code."', prix='".$$prix."', commentaires='".$$com."', url_suggestion='".$$url."', nb='".$$qte."', sugg_source='".$$src."', statut=1, date_publication='".$$date."', date_creation='".date("Y-m-d")."', sugg_location='".$empr_location."', num_categ='".$num_categ."' "; if($$unimarc){ $uni = new suggestions_unimarc($$unimarc); $req .= ", notice_unimarc ='".addslashes($uni->sugg_uni_notice)."'"; } if($$notice){ $req .= ", num_notice ='".$$notice."'"; } mysql_query($req,$dbh); $sug_orig = new suggestions_origine($id_empr, mysql_insert_id()); $sug_orig->type_origine = 1; $sug_orig->save(); } } } if($uni) $uni->delete(); print $msg['empr_sugg_ok']; } } ?>