abt_id=$r->abt_id; $this->abt_name=$r->abt_name; $this->num_notice=$r->num_notice; $this->base_modele_name=$r->base_modele_name; $this->base_modele_id=$r->base_modele_id; $this->num_notice=$r->num_notice; //numéro de la notice liée $this->duree_abonnement=$r->duree_abonnement; //Durée de l'abonnement $this->date_debut=$r->date_debut; //Date de début de validité du modèle $this->date_fin=$r->date_fin; //Date de fin de validité du modèle $this->fournisseur=$r->fournisseur;// id du fournisseur $this->destinataire=$r->destinataire; $this->cote=$r->cote; $this->typdoc_id=$r->typdoc_id; $this->exemp_auto=$r->exemp_auto; $this->location_id=$r->location_id; $this->section_id=$r->section_id; $this->lender_id=$r->lender_id; $this->statut_id=$r->statut_id; $this->codestat_id=$r->codestat_id; $this->type_antivol=$r->type_antivol; $this->abt_numeric=$r->abt_numeric; } else { $this->error=true; $this->error_message="Le modèle demandé n'existe pas"; } } } function getData() { if ($this->abt_id) { $requete="select * from abts_abts where abt_id=".$this->abt_id; $resultat=mysql_query($requete); if (mysql_num_rows($resultat)) { $r=mysql_fetch_object($resultat); $this->abt_id=$r->abt_id; $this->abt_name=$r->abt_name; $this->num_notice=$r->num_notice; $this->base_modele_name=$r->base_modele_name; $this->base_modele_id=$r->base_modele_id; $this->num_notice=$r->num_notice; //numéro de la notice liée $this->duree_abonnement=$r->duree_abonnement; //Durée de l'abonnement $this->date_debut=$r->date_debut; //Date de début de validité du modèle $this->date_fin=$r->date_fin; //Date de fin de validité du modèle $this->fournisseur=$r->fournisseur;// id du fournisseur $this->destinataire=$r->destinataire; $this->cote=$r->cote; $this->typdoc_id=$r->typdoc_id; $this->exemp_auto=$r->exemp_auto; $this->location_id=$r->location_id; $this->section_id=$r->section_id; $this->lender_id=$r->lender_id; $this->statut_id=$r->statut_id; $this->codestat_id=$r->codestat_id; $this->type_antivol=$r->type_antivol; $this->abt_numeric=$r->abt_numeric; } else { $this->error=true; $this->error_message="Le modèle demandé n'existe pas"; } } } function set_perio($num_notice) { $this->num_notice=0; $requete="select niveau_biblio from notices where notice_id=".$num_notice; $resultat=mysql_query($requete); if (mysql_num_rows($resultat)) { if (mysql_result($resultat,0,0)=="s") $this->num_notice=$num_notice; } else { $this->error=true; $this->error_message="La notice liée n'existe pas ou n'est pas un périodique"; } } function show_abonnement() { global $abonnement_view,$serial_id; global $dbh,$msg; $perio=new serial_display($this->num_notice,1); $r=$abonnement_view; $r=str_replace("!!view_id_abonnement!!","catalog.php?categ=serials&sub=abon&serial_id=$serial_id&abt_id=$this->abt_id",$r); $r=str_replace("!!id_abonnement!!",$this->abt_id,$r); $r=str_replace("!!abonnement_header!!",$this->abt_name,$r); $modele=0; $modele_list=""; $requete="select modele_id from abts_abts_modeles where abt_id='$this->abt_id'"; $resultat=mysql_query($requete, $dbh); while ($r_a=mysql_fetch_object($resultat)) { $modele_id=$r_a->modele_id; $modele_name=pmb_sql_value("select modele_name from abts_modeles where modele_id='$modele_id'"); $num_periodicite=pmb_sql_value("select num_periodicite from abts_modeles where modele_id='$modele_id'"); $periodicite=pmb_sql_value("SELECT libelle from abts_periodicites where periodicite_id='".$num_periodicite."'"); if ($modele_list) $modele_list.=","; $modele_list.=" $modele_name"; if($periodicite) $modele_list.=" ($periodicite)"; } $r=str_replace("!!modele_lie!!",$modele_list,$r); $r=str_replace("!!duree_abonnement!!",$this->duree_abonnement,$r); $r=str_replace("!!date_debut!!",format_date($this->date_debut),$r); $r=str_replace("!!date_fin!!",format_date($this->date_fin),$r); $r=str_replace("!!nombre_de_series!!",pmb_sql_value("select sum(nombre) from abts_grille_abt where num_abt='$this->abt_id' and type ='1'"),$r); $r=str_replace("!!nombre_de_horsseries!!",pmb_sql_value("select sum(nombre) from abts_grille_abt where num_abt='$this->abt_id' and type ='2'"),$r); if($this->fournisseur) $fournisseur_name=$msg["abonnements_fournisseur"].": ".pmb_sql_value("SELECT raison_sociale from entites where id_entite = '".$this->fournisseur."' "); $r=str_replace("!!fournisseur!!",$fournisseur_name,$r); $r=str_replace("!!commentaire!!",$this->destinataire,$r); return $r; } function show_form() { global $creation_abonnement_form; global $serial_header; global $msg; global $charset; global $tpl_del_bouton,$tpl_copy_bouton,$serial_id,$edition_abonnement_form,$pmb_antivol; global $dbh; if (!$this->abt_id) { $r=$serial_header.$creation_abonnement_form; $r=str_replace('!!page_title!!', $msg[4000].$msg[1003].$msg["abts_abonnements_add_title"], $r); $r=str_replace('!!libelle_form!!', $msg["abts_abonnements_add_title"], $r); //Checkbox des modèles à associer à l'abonnement $resultat=mysql_query("select modele_id,modele_name from abts_modeles where num_notice='$serial_id'"); $liste_modele=""; //Confection du javascript pour tester au moins une sélection de modèle $test_liste_modele="if("; $cpt=0; while ($rp=mysql_fetch_object($resultat)) { if( $cpt++ >0) $test_liste_modele.=" || "; $liste_modele.=""; $test_liste_modele.=" (document.getElementById('modele[".$rp->modele_id."]').checked==true) "; } $test_liste_modele.=") { return true; }else { alert(\"$msg[abonnements_err_msg_select_model]\"); return false; }"; $liste_modele.="
$rp->modele_name
"; $r=str_replace("!!liste_modele!!",$liste_modele,$r); $r=str_replace("!!test_liste_modele!!",$test_liste_modele,$r); $copy_bouton=$del_bouton=""; $r=str_replace("!!abonnement_form1!!","",$r); $bouton_prolonge=''; } else { $this->getData(); $r=$serial_header.$edition_abonnement_form; $r=str_replace('!!page_title!!', $msg[4000].$msg[1003].$msg["abts_abonnements_modify_title"], $r); $r=str_replace('!!libelle_form!!', $msg["abts_abonnements_modify_title"], $r); $bouton_prolonge=""; //Durée d'abonnement if (!$this->duree_abonnement) $this->duree_abonnement=12; $r=str_replace("!!duree_abonnement!!",$this->duree_abonnement,$r); //Date de début if (!$this->date_debut || $this->date_debut == "0000-00-00") $date_debut=date("Ymd",time()); else $date_debut=$this->date_debut; $r=str_replace("!!date_debut!!",str_replace("-","",$date_debut),$r); $r=str_replace("!!date_debut_lib!!",formatdate($date_debut),$r); //Date de fin if (!$this->date_fin || $this->date_fin == "0000-00-00") $date_fin=pmb_sql_value("SELECT DATE_ADD('$date_debut', INTERVAL 1 YEAR)"); else $date_fin=$this->date_fin; $r=str_replace("!!date_fin!!",str_replace("-","",$date_fin),$r); $r=str_replace("!!date_fin_lib!!",format_date($date_fin),$r); //Fournisseur $r=str_replace('!!lib_fou!!', pmb_sql_value("SELECT raison_sociale from entites where id_entite = '".$this->fournisseur."' "), $r); $r=str_replace('!!id_fou!!', $this->fournisseur, $r); //Destinataire: $r=str_replace('!!destinataire!!', $this->destinataire, $r); //Cote: $r=str_replace('!!cote!!', htmlentities($this->cote,ENT_QUOTES,$charset), $r); // select "type document" $r = str_replace('!!type_doc!!', do_selector('docs_type', 'typdoc_id', $this->typdoc_id), $r); $r = str_replace('!!exemplarisation_automatique!!', "exemp_auto ?"checked":"yes")." name='exemp_auto' id='exemp_auto'/>", $r); $r = str_replace('!!abt_numeric_checked!!', ($this->abt_numeric ?"checked":"yes"), $r); // select "localisation" $r = str_replace('!!localisation!!', gen_liste ("select distinct idlocation, location_libelle from docs_location, docsloc_section where num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'location_id', "calcule_section(this);", $this->location_id, "", "","","",0), $r); // select "section" $r = str_replace('!!section!!', $this->do_selector(), $r); // select "owner" $r = str_replace('!!owner!!', do_selector('lenders', 'lender_id', $this->lender_id), $r); // select "statut" $r = str_replace('!!statut!!', do_selector('docs_statut', 'statut_id', $this->statut_id), $r); // select "code statistique" $r = str_replace('!!codestat!!', do_selector('docs_codestat', 'codestat_id', $this->codestat_id), $r); $selector=""; if($pmb_antivol>0) {// select "type_antivol" $selector = "'; } $r = str_replace('!!type_antivol!!', $selector, $r); //Liste des formulaire de modèles (dépliables +,-) $modele_list=""; $requete="select modele_id,num,vol,tome,delais,critique, num_statut_general from abts_abts_modeles where abt_id='$this->abt_id'"; $resultat=mysql_query($requete, $dbh); if (!$resultat) die($requete."

".mysql_error()); while ($r_a=mysql_fetch_object($resultat)) { $modele_id=$r_a->modele_id; $num=$r_a->num; $vol=$r_a->vol; $tome=$r_a->tome; $delais=$r_a->delais; $critique=$r_a->critique; $modele_name=pmb_sql_value("select modele_name from abts_modeles where modele_id='$modele_id'"); $num_periodicite=pmb_sql_value("select num_periodicite from abts_modeles where modele_id='$modele_id'"); $periodicite=pmb_sql_value("select libelle from abts_periodicites where periodicite_id ='".$num_periodicite."'"); $num_statut=$r_a->num_statut_general; if($periodicite) $modele_name.=" ($periodicite)"; if(!$num_statut)$num_statut=$this->statut_id; $modele_list.=$this->gen_tpl_abt_modele($modele_id,$modele_name,$num,$vol,$tome,$delais,$critique,$num_statut); } $r=str_replace("!!modele_list!!",$modele_list,$r); // calendrier de réception s'il y a des enregistrement présents dans la grille if (pmb_sql_value("select sum(nombre) from abts_grille_abt where num_abt='$this->abt_id'")) { $calend=" "; $calend.= << function ad_date(obj,e) { if(!e) e=window.event; var tgt = e.target || e.srcElement; // IE doesn't use .target var strid = tgt.id; var type = tgt.tagName; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); var id_obj=document.getElementById(obj); var pos=findPos(id_obj); var url="./catalog/serials/abonnement/abonnement_parution_edition.php?abonnement_id=!!abonnement_id!!&date_parution="+obj+"&type_serie=1&numero="; var notice_view=document.createElement("iframe"); notice_view.setAttribute('id','frame_abts'); notice_view.setAttribute('name','periodique'); notice_view.src=url; var att=document.getElementById("att"); notice_view.style.visibility="hidden"; notice_view.style.display="block"; notice_view=att.appendChild(notice_view); w=notice_view.clientWidth; h=notice_view.clientHeight; notice_view.style.left=pos[0]+"px"; notice_view.style.top=pos[1]+"px"; notice_view.style.visibility="visible"; } function duplique(obj,e) { if(!e) e=window.event; var tgt = e.target || e.srcElement; // IE doesn't use .target var strid = tgt.id; var type = tgt.tagName; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); var id_obj=document.getElementById(obj); var pos=findPos(id_obj); var url="./catalog/serials/abonnement/abonnement_duplique.php?abonnement_id=!!abonnement_id!!&serial_id=!!serial_id!!"; var notice_view=document.createElement("iframe"); notice_view.setAttribute('id','frame_abts'); notice_view.setAttribute('name','periodique'); notice_view.src=url; var att=document.getElementById("att"); notice_view.style.visibility="hidden"; notice_view.style.display="block"; notice_view=att.appendChild(notice_view); w=notice_view.clientWidth; h=notice_view.clientHeight; posx=(getWindowWidth()/2-(w/2))<0?0:(getWindowWidth()/2-(w/2)) posy=(getWindowHeight()/2-(h/2))<0?0:(getWindowHeight()/2-(h/2)); notice_view.style.left=posx+"px"; notice_view.style.top=posy+"px"; notice_view.style.visibility="visible"; } function kill_frame_periodique() { var notice_view=document.getElementById("frame_abts"); notice_view.parentNode.removeChild(notice_view); } ENDOFTEXT; $calend=str_replace("!!serial_id!!",$serial_id,$calend); $calend=str_replace("!!abonnement_id!!",$this->abt_id,$calend); $base_url="./catalog.php?categ=serials&sub=abonnement&serial_id="."$serial_id&abonnement_id=$this->abonnement_id"; $base_url_mois=''; $calend.= "
" ; $date = $this->date_debut; $calend.= ""; $year=pmb_sql_value("SELECT YEAR('$date')"); $cur_year=$year; //debut expand $calend.="
 
$year
"; $i=pmb_sql_value("SELECT MONTH('$date')"); if($i==2 || $i==5 || $i==8 || $i==11) { $calend.= "
 "; $calend.= "
\n"; } if($i==3 || $i==6 || $i==9 || $i==12) { $calend.= "
 "; $calend.= "
\n"; $calend.= "
 "; $calend.= "
\n"; } do{ $year=pmb_sql_value("SELECT YEAR('$date')"); if($year!=$cur_year){ $calend.= "
"; $calend.="
$year
\n"; $calend.=""; $r.=$calend; } $r=str_replace("!!test_liste_modele!!","",$r); } $r=str_replace("!!action!!","./catalog.php?categ=serials&sub=abon&serial_id="."$serial_id"."&abt_id="."$this->abt_id",$r); $r=str_replace('!!bouton_prolonge!!', $bouton_prolonge, $r); $r=str_replace("!!serial_id!!",$serial_id,$r); //Remplacement des valeurs $r=str_replace("!!abt_id!!",htmlentities($this->abt_id,ENT_QUOTES,$charset),$r); $r=str_replace("!!abt_name!!",htmlentities($this->abt_name,ENT_QUOTES,$charset),$r); //Notice mère $perio=new serial_display($this->num_notice,1); $r=str_replace("!!num_notice_libelle!!",$perio->header,$r); $r=str_replace("!!num_notice!!",$this->num_notice,$r); return $r; } // ---------------------------------------------------------------------------- // fonction do_selector qui génère des combo_box avec tout ce qu'il faut // ---------------------------------------------------------------------------- function do_selector() { global $dbh; global $charset; global $deflt_docs_section; global $deflt_docs_location; if (!$this->section_id) $this->section_id=$deflt_docs_section ; if (!$this->location_id) $this->location_id=$deflt_docs_location; $rqtloc = "SELECT idlocation FROM docs_location order by location_libelle"; $resloc = mysql_query($rqtloc, $dbh); while ($loc=mysql_fetch_object($resloc)) { $requete = "SELECT idsection, section_libelle FROM docs_section, docsloc_section where idsection=num_section and num_location='$loc->idlocation' order by section_libelle"; $result = mysql_query($requete, $dbh); $nbr_lignes = mysql_num_rows($result); if ($nbr_lignes) { if ($loc->idlocation==$this->location_id) $selector .= "
idlocation."\" style=\"display:block\">\r\n"; else $selector .= "
idlocation."\" style=\"display:none\">\r\n"; $selector .= "
'; } } return $selector; } function gen_tpl_abt_modele($id,$titre,$num,$vol,$tome,$delais,$delais_critique,$change_statut_id){ global $dbh; global $msg; $requete="select * from abts_modeles where modele_id='$id'"; $resultat=mysql_query($requete, $dbh); if ($r_a=mysql_fetch_object($resultat)) { $tom_actif=$r_a->tom_actif; $vol_actif=$r_a->vol_actif; $num_depart=$r_a->num_depart; $vol_depart=$r_a->vol_depart; $tom_depart=$r_a->tom_depart; } if(!$num) $num=$num_depart; if(!$vol) $vol=$vol_depart; if(!$tome) $tome=$tom_depart; $contenu= "
"; if($vol_actif)$contenu.= "
"; if($tom_actif)$contenu.= "
"; $contenu.= "
"; // select !!change_statut!! $statut_form=str_replace('!!statut_check!!', "", $msg['catalog_change_statut_form']); $statut_form=str_replace('!!statut_list!!', do_selector('docs_statut', "change_statut[".$id."]", $change_statut_id), $statut_form); $contenu.= "
 
$statut_form
"; return gen_plus_form($id,$titre,$contenu); } function gen_date($garder=0){ global $dbh; global $msg; global $include_path; if($this->abt_id) { $dummy = "delete FROM abts_grille_abt WHERE num_abt='$this->abt_id' and state='0'"; if(!$garder)mysql_query($dummy, $dbh); $date=$date_debut = construitdateheuremysql($this->date_debut); $date_fin = construitdateheuremysql($this->date_fin); //Pour tous les modèles utilisé dans l'abonnement, on recopie les grilles modèles dans la grille abonnement $requete="select modele_id from abts_abts_modeles where abt_id='$this->abt_id'"; $resultat_a=mysql_query($requete, $dbh); while ($r_a=mysql_fetch_object($resultat_a)) { $modele_id=$r_a->modele_id; $requete="select * from abts_grille_modele where num_modele='$modele_id'"; $resultat=mysql_query($requete); while ($r_g=mysql_fetch_object($resultat)) { //Ne garder les bulletins compris entre les dates de début et fin d'abonnement if( ( pmb_sql_value("SELECT DATEDIFF('$date_fin','$r_g->date_parution')")>= 0 ) && ( pmb_sql_value("SELECT DATEDIFF('$date_debut','$r_g->date_parution')")<= 0 ) ) { for($i=1;$i<=$r_g->nombre_recu;$i++){ $requete = "INSERT INTO abts_grille_abt SET num_abt='$this->abt_id', date_parution ='$r_g->date_parution', modele_id='$modele_id', type = '$r_g->type_serie', numero='$r_g->numero', nombre='1', ordre='$i' "; mysql_query($requete, $dbh); } } } } } } function update() { global $dbh; global $msg; global $include_path; global $act,$modele,$num,$vol,$tome,$delais,$delais_critique,$change_statut,$change_statut_check; if(!$this->abt_name) return false; // nettoyage des valeurs en entrée $this->abt_name = clean_string($this->abt_name); // construction de la requête $requete = "SET abt_name='".addslashes($this->abt_name)."', "; $requete .= "num_notice='$this->num_notice', "; $requete .= "duree_abonnement='$this->duree_abonnement', "; $requete .= "date_debut='$this->date_debut', "; $requete .= "date_fin='$this->date_fin', "; $requete .= "fournisseur='$this->fournisseur', "; $requete .= "destinataire='".addslashes($this->destinataire)."', "; $requete .= "cote='".addslashes($this->cote)."', "; $requete .= "typdoc_id='$this->typdoc_id', "; $requete .= "exemp_auto='$this->exemp_auto', "; $requete .= "location_id='$this->location_id', "; $requete .= "section_id='$this->section_id', "; $requete .= "lender_id='$this->lender_id', "; $requete .= "statut_id='$this->statut_id', "; $requete .= "codestat_id='$this->codestat_id', "; $requete .= "type_antivol='$this->type_antivol', "; $requete .= "abt_numeric='$this->abt_numeric' "; if($this->abt_id) { // Update: s'assurer que le nom d'abonnement n'existe pas déjà $dummy = "SELECT * FROM abts_abts WHERE abt_name='".addslashes($this->abt_name)."' and num_notice='$this->num_notice' and abt_id!=$this->abt_id"; $check = mysql_query($dummy, $dbh); if(mysql_num_rows($check)) { require_once("$include_path/user_error.inc.php"); warning($msg["abonnements_titre_creation_edition_abonnement"], $msg["abonnements_erreur_creation_doublon_abonnement"]." ($this->abt_name)."); return FALSE; } // update $requete = 'UPDATE abts_abts '.$requete; $requete .= ' WHERE abt_id='.$this->abt_id.' LIMIT 1;'; if(mysql_query($requete, $dbh) ) { if($act=="gen") $this->gen_date(); $requete="select modele_id from abts_modeles where num_notice='$this->num_notice'"; $resultat=mysql_query($requete, $dbh); while ($r=mysql_fetch_object($resultat)) { $modele_id=$r->modele_id; if($change_statut_check[$modele_id])$num_statut=$change_statut[$modele_id]; else $num_statut=$this->statut_id; $requete = "UPDATE abts_abts_modeles SET num='$num[$modele_id]', vol='$vol[$modele_id]', tome='$tome[$modele_id]', delais='$delais[$modele_id]', critique='$delais_critique[$modele_id]' , num_statut_general='$num_statut' WHERE modele_id='$modele_id'and abt_id='$this->abt_id'"; mysql_query($requete, $dbh); } return TRUE; } else { echo mysql_error(); require_once("$include_path/user_error.inc.php"); warning($msg["abonnements_titre_creation_edition_abonnement"], $msg["abonnements_titre_creation_edition_modele_impossible"]); return FALSE; } } else { // Création: s'assurer que le modèle n'existe pas déjà $dummy = "SELECT * FROM abts_abts WHERE abt_name='".addslashes($this->abt_name)."' and num_notice='$this->num_notice'"; $check = mysql_query($dummy, $dbh); if(mysql_num_rows($check)) { require_once("$include_path/user_error.inc.php"); warning($msg["abonnements_titre_creation_edition_abonnement"], $msg["abonnements_erreur_creation_doublon_abonnement"]." ($this->abt_name)."); return FALSE; } $requete = 'INSERT INTO abts_abts '.$requete.';'; if(mysql_query($requete, $dbh)) { $this->abt_id=mysql_insert_id(); $requete="select modele_id,num_periodicite from abts_modeles where num_notice='$this->num_notice'"; $resultat=mysql_query($requete, $dbh); while ($r=mysql_fetch_object($resultat)) { $modele_id=$r->modele_id; $num_periodicite=$r->num_periodicite; if(isset($modele[$modele_id])){ $requete="select retard_periodicite,seuil_periodicite from abts_periodicites where periodicite_id ='".$num_periodicite."'"; $r_delais=mysql_query($requete, $dbh); if ($r_d=mysql_fetch_object($r_delais)) { $periodicite=$r_d->libelle; $delais=$r_d->seuil_periodicite; $critique=$r_d->retard_periodicite; } if($change_statut_check[$modele_id])$num_statut=$change_statut[$modele_id]; else $num_statut=$this->statut_id; $requete = "INSERT INTO abts_abts_modeles SET modele_id='$modele_id', abt_id='$this->abt_id', delais='$delais', critique='$critique', num_statut_general='$num_statut' "; mysql_query($requete, $dbh); } } if($act=="gen") $this->gen_date(); return TRUE; } else { echo mysql_error(); require_once("$include_path/user_error.inc.php"); warning($msg["abonnements_titre_creation_edition_abonnement"], $msg["abonnements_titre_creation_edition_modele_impossible"]); return FALSE; } } } function delete() { global $dbh; global $msg; global $include_path; $dummy = "delete FROM abts_abts WHERE abt_id='$this->abt_id' "; $check = mysql_query($dummy, $dbh); $dummy = "delete FROM abts_grille_abt WHERE num_abt='$this->abt_id' "; $check = mysql_query($dummy, $dbh); $dummy = "delete FROM abts_abts_modeles WHERE abt_id='$this->abt_id' "; $check = mysql_query($dummy, $dbh); abts_pointage::delete_retard($this->abt_id); serialcirc_diff::delete($this->abt_id); } function proceed() { global $act; global $serial_id,$msg,$num_notice,$num_periodicite,$duree_abonnement,$date_debut,$date_fin,$days,$day_month,$week_month,$week_year,$month_year,$date_parution; global $abt_name,$duree_abonnement,$date_debut,$date_fin,$id_fou,$destinataire; global $dbh,$abt_id; global $cote,$typdoc_id,$exemp_auto,$location_id,$lender_id,$statut_id,$codestat_id,$type_antivol,$abt_numeric; global $deflt_docs_section; global $deflt_docs_location,$nb_duplication; $formlocid="f_ex_section".$location_id ; global $$formlocid; $section_id=$$formlocid ; if (!$section_id) $section_id=$deflt_docs_section ; if (!$location_id) $location_id=$deflt_docs_location; switch ($act) { case 'update': // mise à jour modèle $this->abt_name= stripslashes($abt_name); $this->num_notice= $num_notice; $this->duree_abonnement = $duree_abonnement; $this->date_debut= $date_debut; $this->date_fin= $date_fin; $this->fournisseur = $id_fou; $this->destinataire = stripslashes($destinataire); $this->cote=stripslashes($cote); $this->typdoc_id=$typdoc_id; $this->exemp_auto=$exemp_auto; $this->location_id=$location_id; $this->section_id=$section_id; $this->lender_id=$lender_id; $this->statut_id=$statut_id; $this->codestat_id=$codestat_id; $this->type_antivol=$type_antivol; $this->abt_numeric=$abt_numeric; $this->update(); print $this->show_form(); break; case 'gen': // mise à jour modèle $this->abt_name= stripslashes($abt_name); $this->num_notice= $num_notice; $this->duree_abonnement = $duree_abonnement; $this->date_debut= $date_debut; $this->date_fin= $date_fin; $this->fournisseur = $id_fou; $this->destinataire = stripslashes($destinataire); $this->cote=stripslashes($cote); $this->typdoc_id=$typdoc_id; $this->exemp_auto=$exemp_auto; $this->location_id=$location_id; $this->section_id=$section_id; $this->lender_id=$lender_id; $this->statut_id=$statut_id; $this->codestat_id=$codestat_id; $this->type_antivol=$type_antivol; $this->abt_numeric=$abt_numeric; $this->update(); print $this->show_form(); break; case 'prolonge': // mise à jour modèle $this->abt_name= stripslashes($abt_name); $this->num_notice= $num_notice; $this->duree_abonnement = $duree_abonnement; $this->date_debut= $date_fin; $this->date_fin= pmb_sql_value("SELECT DATE_ADD('$date_fin',INTERVAL $duree_abonnement month)"); $this->fournisseur = $id_fou; $this->destinataire = stripslashes($destinataire); $this->cote=stripslashes($cote); $this->typdoc_id=$typdoc_id; $this->exemp_auto=$exemp_auto; $this->location_id=$location_id; $this->section_id=$section_id; $this->lender_id=$lender_id; $this->statut_id=$statut_id; $this->codestat_id=$codestat_id; $this->type_antivol=$type_antivol; $this->abt_numeric=$abt_numeric; $this->gen_date(1); $this->date_debut= $date_debut; $this->update(); print $this->show_form(); break; case 'copy': $this->getData(); $abt_id=$this->abt_id; $this->abt_name.="_1"; $this->abt_name=addslashes($this->abt_name); $this->destinataire=addslashes($this->destinataire); for($i=0;$i<$nb_duplication;$i++){ //Création nouvel abonnement $this->abt_id=''; do { $this->abt_name++; $requete = "SELECT abt_name FROM abts_abts WHERE abt_name='$this->abt_name' and num_notice='$this->num_notice'"; $resultat=mysql_query($requete, $dbh); } while (mysql_fetch_object($resultat)); $this->update(); //recopie des modeles associés $requete = "select * from abts_abts_modeles where abt_id='$abt_id'"; $resultat=mysql_query($requete); while ($r_m=mysql_fetch_object($resultat)) { $requete = "INSERT INTO abts_abts_modeles SET modele_id='$r_m->modele_id', abt_id='$this->abt_id',num='$r_m->num' ,vol='$r_m->vol',tome='$r_m->tome',delais='$r_m->delais', critique='$r_m->critique',num_statut_general='$r_m->num_statut_general'"; mysql_query($requete, $dbh); } //recopie des infos du calendrier $requete = "select * from abts_grille_abt where num_abt='$abt_id'"; $resultat=mysql_query($requete); while ($r_g=mysql_fetch_object($resultat)) { $requete = "INSERT INTO abts_grille_abt SET num_abt='$this->abt_id', date_parution ='$r_g->date_parution', modele_id='$r_g->modele_id', type = '$r_g->type', numero='$r_g->numero', nombre='$r_g->nombre', ordre='$r_g->ordre' "; mysql_query($requete, $dbh); } } print "
".$msg[maj_encours]."
"; $id_form = md5(microtime()); $retour = "./catalog.php?categ=serials&sub=view&serial_id=$serial_id&view=abon"; print "
"; break; case 'del': $this->delete(); print "
".$msg[maj_encours]."
"; $id_form = md5(microtime()); $retour = "./catalog.php?categ=serials&sub=view&serial_id=$serial_id&view=abon"; print "
"; break; default: print $this->show_form(); break; } } } class abts_abonnements { var $abonnements = array(); //Tableau des IDs des modèles function abts_abonnements($id_perio,$localisation=0) { if($localisation > 0) $where_localisation=" and location_id = $localisation "; $requete="select abt_id from abts_abts where num_notice=$id_perio $where_localisation order by abt_name"; $resultat=mysql_query($requete); while ($r=mysql_fetch_object($resultat)) { $abonnement=new abts_abonnement($r->abt_id); if (!$abonnement->error) $this->abonnements[]=$abonnement; } } function show_list() { global $abonnement_list,$msg,$serial_id; $r=$abonnement_list; $abonnements=""; if (count($this->abonnements)) { for ($i=0; $iabonnements); $i++) { $abonnements.=$this->abonnements[$i]->show_abonnement(); } } else $abonnements=$msg["abts_abonnements_no_abonnement"]; $resultat=mysql_query("select modele_id,modele_name from abts_modeles where num_notice='$serial_id'"); $cpt=0; while ($rp=mysql_fetch_object($resultat)) { $cpt++; } if($cpt) $r=str_replace("!!abts_abonnements_add_button!!","",$r); else $r=str_replace("!!abts_abonnements_add_button!!",$msg["abts_modeles_no_modele"],$r); return str_replace("!!abonnement_list!!",$abonnements,$r); } } /* function calc_selection($val,$size) { $ret=''; for ($i=0; $i<$size; $i++) { if(!isset($val[$i+1])) $ret .='1'; else $ret .='0'; } return $ret; } function sql_value($rqt) { if($result=mysql_query($rqt)) if($row = mysql_fetch_row($result)) return $row[0]; return ''; }*/ function gen_plus_form($id,$titre,$contenu) { return "
$titre
"; } ?>