Ejemplo n.º 1
0
function dupliqueInter($id)
{
    global $cnx, $liste;
    $cnx = ouvresylob(1);
    //recup infos à dupliquer
    $select = " select * from informix.zz_inter \r\n                where informix.zz_inter.id_inter = " . $id;
    $sql = odbc_exec($cnx, $select);
    while ($row = odbc_fetch_array($sql)) {
        $debut = $row['debut_inter'];
        $fin = $row['fin_inter'];
        $presta = $row['presta_inter'];
        $interventant = $row['intervenant_inter'];
        $etat = $row['etat_inter'];
        $type = $row['type_inter'];
        $parent = $row['parent_inter'];
        $periodicite = $row['periodicite_inter'];
        $priorite = $row['priorite_inter'];
        $domaine = $row['domaine_inter'];
        $cout = $row['cout_inter'];
        $detail = $row['detail_inter'];
        $supp = $row['supp_inter'];
    }
    $nouv_deb = new DateTime($debut);
    $nouv_fin = new DateTime($fin);
    $nouv_deb = $nouv_deb->add(new DateInterval('PT1H'))->format('Y-m-d H:i');
    $nouv_fin = $nouv_fin->add(new DateInterval('PT1H'))->format('Y-m-d H:i');
    //insert nouvelle inter
    $UID = insertInter($nouv_deb, $nouv_fin, $presta, $interventant, 1, $type, $parent, $periodicite, $priorite, $domaine, $cout, formatChaine($detail));
    //recup matos inter à dupliquer
    $select2 = "select id_materiel from informix.zz_matinter where id_inter = " . $id;
    $sql2 = odbc_exec($cnx, $select2);
    while (odbc_fetch_row($sql2)) {
        //lie materiel à nouvelle inter
        $res3 = addMatInter($UID, odbc_result($sql2, 1));
    }
    //odbc_close($cnx);
    return $UID;
}
Ejemplo n.º 2
0
         // on peut insérer
         $res = insertInter($debut, $fin, $_POST['prestataire'], $_POST['intervenant'], $_POST['etat_inter'], $_POST['type_inter'], 0, $_POST['periodicite'], $_POST['priorite'], $_POST['domaine'], $_POST['cout'], formatChaine($_POST['detail']));
         $texte = "Ajout intervention terminé.";
         //lien intervention - entite(s)
         foreach ($_POST['choisi'] as $mat) {
             $res2 = addMatInter($res, $mat);
         }
         //si fini (etat=3) => log inter + si periodicite => cree prochaine echeance
         if ($_POST['etat_inter'] == 3) {
             $log = logInter($res);
             $texte .= " - cloture loggée.";
             if ($_POST['periodicite'] > 1) {
                 //calcul dates prochaine echeance
                 $nouv_deb = echeance($debut, $_POST['periodicite'])->format('Y-m-d H:i');
                 $nouv_fin = echeance($fin, $_POST['periodicite'])->format('Y-m-d H:i');
                 $res3 = insertInter($nouv_deb, $nouv_fin, $_POST['prestataire'], $_POST['intervenant'], 1, $_POST['type_inter'], $res, $_POST['periodicite'], $_POST['priorite'], $_POST['domaine'], $_POST['cout'], '');
                 //lien intervention - entite(s)
                 foreach ($_POST['choisi'] as $mat) {
                     $res4 = addMatInter($res3, $mat);
                 }
                 $texte .= " - prochaine échéance créée.";
             }
         }
     }
 }
 //affichage apres traitement
 echo "<script language=javascript> alert ('" . $texte . "');</script>";
 //si on est dans un popup on le ferme
 if (isset($_POST['source']) and $_POST['source'] == "calendrier") {
     echo "<script type='text/javascript'>fermePopup();</script>";
 } elseif (isset($res) and $res == true) {