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 "";
 }
         print $serialcirc_diff->show_form();
     }
     break;
 case 'del_empr':
     print $serialcirc_diff->del_empr($id_empr);
     break;
 case 'del_diff':
     if (count($diff_list)) {
         foreach ($diff_list as $id_diff) {
             $serialcirc_diff->del_diff($id_diff);
         }
     }
     print $serialcirc_diff->show_form();
     break;
 case 'delete':
     if ($msg_error = $serialcirc_diff->delete($num_abt)) {
         $retour = "./circ.php?categ=serialcirc";
         error_message('', $msg_error, 1, $retour);
         print $serialcirc_diff->show_form();
     } else {
         $query = "select num_notice from abts_abts where abt_id={$num_abt}";
         $result = pmb_mysql_query($query);
         if (pmb_mysql_num_rows($result)) {
             $r = pmb_mysql_fetch_object($result);
             print "<script type=\"text/javascript\">document.location='catalog.php?categ=serials&sub=view&view=abon&serial_id=" . $r->num_notice . "';</script>";
         }
     }
     break;
 case 'sort_diff':
     $serialcirc_diff->sort_diff();
     print $serialcirc_diff->show_form();
 function duplicate($abt_to_id)
 {
     global $dbh;
     $requete = "select id_serialcirc from serialcirc where num_serialcirc_abt=" . $abt_to_id;
     $resultat = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($resultat)) {
         $status = serialcirc_diff::delete($abt_to_id);
         if ($status) {
             return $status;
         }
         // error
     }
     $req = "INSERT INTO serialcirc SET\r\n\t\t\tnum_serialcirc_abt=" . $abt_to_id . ",\r\n\t\t\tserialcirc_type=" . $this->circ_type . ",\r\n\t\t\tserialcirc_virtual=" . $this->virtual_circ . ",\n\t\t\tserialcirc_simple=" . $this->simple_circ . ",\r\n\t\t\tserialcirc_no_ret=" . $this->no_ret_circ . ",\r\n\t\t\tserialcirc_duration=" . $this->duration . ",\r\n\t\t\tserialcirc_checked=" . $this->checked . ",\r\n\t\t\tserialcirc_retard_mode=" . $this->retard_mode . ",\r\n\t\t\tserialcirc_allow_resa=" . $this->allow_resa . ",\r\n\t\t\tserialcirc_allow_copy=" . $this->allow_copy . ",\r\n\t\t\tserialcirc_allow_send_ask=" . $this->allow_send_ask . ",\r\n\t\t\tserialcirc_allow_subscription=" . $this->allow_subscription . ",\r\n\t\t\tserialcirc_duration_before_send=" . $this->duration_before_send . ",\r\n\t\t\tserialcirc_expl_statut_circ=" . $this->expl_statut_circ . ",\n\t\t\tserialcirc_piedpage='" . $this->piedpage . "',\n\t\t\tserialcirc_tpl='" . $this->tpl . "',\r\n\t\t\tserialcirc_expl_statut_circ_after=" . $this->expl_statut_circ_after . "\r\n\t\t\t";
     pmb_mysql_query($req, $dbh);
     $new_serialcirc_id = pmb_mysql_insert_id($dbh);
     $requete = "select * from serialcirc_diff where num_serialcirc_diff_serialcirc=" . $this->id . " order by serialcirc_diff_order";
     $res_empr = pmb_mysql_query($requete);
     while ($r_empr = pmb_mysql_fetch_object($res_empr)) {
         $req = "INSERT INTO serialcirc_diff SET\n\t\t\t\tnum_serialcirc_diff_serialcirc=" . $new_serialcirc_id . ",\n\t\t\t\tserialcirc_diff_empr_type='" . $r_empr->serialcirc_diff_empr_type . "',\n\t\t\t\tserialcirc_diff_type_diff='" . $r_empr->serialcirc_diff_type_diff . "',\n\t\t\t\tnum_serialcirc_diff_empr='" . $r_empr->num_serialcirc_diff_empr . "',\n\t\t\t\tserialcirc_diff_group_name='" . $r_empr->serialcirc_diff_group_name . "',\n\t\t\t\tserialcirc_diff_duration='" . $r_empr->serialcirc_diff_duration . "',\n\t\t\t\tserialcirc_diff_order=" . $r_empr->serialcirc_diff_order . "\t\t\t\n\t\t\t";
         pmb_mysql_query($req, $dbh);
         $new_id_serialcirc_diff = pmb_mysql_insert_id($dbh);
         $requete = "select * from serialcirc_group where num_serialcirc_group_diff=" . $r_empr->id_serialcirc_diff;
         $res_group = pmb_mysql_query($requete);
         while ($r_group = pmb_mysql_fetch_object($res_group)) {
             $req = "INSERT INTO serialcirc_group SET\n\t\t\t\t\tnum_serialcirc_group_diff=" . $new_id_serialcirc_diff . ",\n\t\t\t\t\tnum_serialcirc_group_empr='" . $r_group->num_serialcirc_group_empr . "',\n\t\t\t\t\tserialcirc_group_responsable='" . $r_group->serialcirc_group_responsable . "',\n\t\t\t\t\tserialcirc_group_order='" . $r_group->serialcirc_group_order . "'\n\t\t\t\t";
             pmb_mysql_query($req, $dbh);
         }
     }
 }