Exemplo n.º 1
0
function insWvl($data, $datei = "")
{
    $data = array_merge($data, mknewWVL($data["kontakt"] == "F"));
    $rs = updWvl($data, $datei);
    if ($rs < 0) {
        if ($data["kontakt"] == "F") {
            $sql = 'DELETE FROM follow_ups WHERE id = ' . $data['WVLID'];
            $rc = $_SESSION['db']->query($sql);
            $sql = 'DELETE FROM notes WHERE id = ' . $data['noteid'];
            $rc = $_SESSION['db']->query($sql);
        } else {
            $sql = 'DELETE FROM wiedervorlage WHERE id = ' . $data['WVLID'];
            $rc = $_SESSION['db']->query($sql);
        }
    }
    return $rs;
}
Exemplo n.º 2
0
function _saveWvl($data)
{
    if ($data['WVLID'] < 1) {
        $data = array_merge($data, mknewWVL(false));
        if ($data['WVLID'] < 1) {
            echo "-3";
            return;
        }
    }
    if (!$data["DCaption"]) {
        $data["DCaption"] = $data["cause"];
    }
    if ($data['newfile'] == 1 and $data['filename'] != '') {
        $src = $_SESSION['crmpath'] . '/dokumente/' . $_SESSION["dbname"] . '/' . $_SESSION['login'] . '/tmp/';
        $rc = file_exists($src . $data['filename']);
        if ($rc) {
            if ($data["DateiID"]) {
                delDokument($data["DateiID"]);
            }
            // ein altes löschen
            require_once "documents.php";
            $dest = $_SESSION['crmpath'] . '/dokumente/' . $_SESSION["dbname"] . '/' . $_SESSION["login"] . '/';
            copy($src . $data['filename'], $dest . $data['filename']);
            unlink($src . $data['filename']);
            //Dokument in db speichern
            $dbfile = new document();
            $dbfile->setDocData("descript", $data["subject"]);
            $dbfile->setDocData("pfad", $_SESSION["login"]);
            $dbfile->setDocData("name", $data['filename']);
            $dbfile->setDocData("descript", $data["DCaption"]);
            $rc = $dbfile->newDocument();
            $dbfile->saveDocument();
            if (!$dbfile->id > 0) {
                echo "-4";
                return;
            }
            $data["DateiID"] = $dbfile->id;
        } else {
            echo "-5";
            return;
        }
    }
    $rc = updWvl($data);
    echo $rc;
}