Exemplo n.º 1
0
 function delete()
 {
     global $dbh;
     global $msg;
     global $include_path;
     // l'abonnement a encore au moins un expl en circulation
     if (serialcirc_diff::expl_in_circ($this->abt_id)) {
         return $msg['serialcirc_error_delete_abt'];
     }
     $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);
     return "";
 }
 function delete($num_abt = 0)
 {
     global $msg;
     if (!$num_abt) {
         return;
     }
     if (serialcirc_diff::expl_in_circ($num_abt)) {
         return $msg['serialcirc_error_delete_abt'];
     }
     $requete = "select id_serialcirc from serialcirc where num_serialcirc_abt=" . $num_abt;
     $resultat = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($resultat)) {
         $r = pmb_mysql_fetch_object($resultat);
         $id_serialcirc = $r->id_serialcirc;
         $requete = "select id_serialcirc_diff from serialcirc_diff where num_serialcirc_diff_serialcirc=" . $id_serialcirc;
         $res_diff = pmb_mysql_query($requete);
         while ($r = pmb_mysql_fetch_object($res_diff)) {
             $id_diff = $r->id_serialcirc_diff;
             $requete = "delete from serialcirc_group where num_serialcirc_group_diff=" . $id_diff;
             pmb_mysql_query($requete);
             $requete = "delete from serialcirc_expl where num_serialcirc_expl_serialcirc_diff=" . $id_diff;
             pmb_mysql_query($requete);
         }
         $requete = "delete from serialcirc_circ where num_serialcirc_circ_serialcirc=" . $id_serialcirc;
         pmb_mysql_query($requete);
         $requete = "delete from serialcirc_diff where num_serialcirc_diff_serialcirc=" . $id_serialcirc;
         pmb_mysql_query($requete);
         $requete = "delete from serialcirc_ask where num_serialcirc_ask_serialcirc=" . $id_serialcirc;
         pmb_mysql_query($requete);
         $requete = "delete from serialcirc where id_serialcirc=" . $id_serialcirc;
         pmb_mysql_query($requete);
     }
 }