Пример #1
0
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Prospect($db);
/*
 * Actions
 */
if ($_GET["action"] == 'cstc') {
    $sql = "UPDATE " . MAIN_DB_PREFIX . "societe SET fk_stcomm = " . $_GET["stcomm"];
    $sql .= " WHERE rowid = " . $_GET["socid"];
    $db->query($sql);
    $actioncomm = new ActionComm($db);
    $actioncomm->addAutoTask('AC_PROSPECT', $_GET["stcomm"] . " Statut de prospection : " . $obj->libelle, $_GET["socid"], '', '');
    if ($objp->fk_stcomm == 0 && $_GET["stcomm"] > 0) {
        $actioncomm = new ActionComm($db);
        $actioncomm->addAutoTask('AC_SUSP', "Statut de prospection : " . $obj->libelle, $_GET["socid"], '', '');
    }
    if (!empty($_GET["backtopage"])) {
        header("Location: " . $_GET["backtopage"]);
    }
}
// set prospect level
if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer) {
    $object->fetch($_GET["socid"]);
    $object->fk_prospectlevel = $_POST['prospect_level_id'];
    $sql = "UPDATE " . MAIN_DB_PREFIX . "societe SET fk_prospectlevel='" . $_POST['prospect_level_id'];
    $sql .= "' WHERE rowid='" . $_GET["socid"] . "'";
    $result = $db->query($sql);
    if (!$result) {
        dol_print_error($result);
    }
Пример #2
0
        require_once DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php";
        $object = new Contact($db);
        $result = $object->fetch($objectid);
    }
    $cat = new Categorie($db);
    $result = $cat->fetch($catMere);
    $result = $cat->add_type($object, $elementtype);
    if ($result >= 0) {
        $mesg = '<div class="ok">' . $langs->trans("WasAddedSuccessfully", $cat->label) . '</div>';
        if ($_REQUEST["type"] == 2) {
            $actioncomm = new ActionComm($db);
            $actioncomm->addAutoTask('AC_QUALIF', "Qualification prospect/client/contact : " . $cat->label, $_GET["socid"], '', '');
        }
        if ($_REQUEST["type"] == 5) {
            $actioncomm = new ActionComm($db);
            $actioncomm->addAutoTask('AC_QUALIF', "Qualification prospect/client/contact : " . $cat->label, $object->socid, '', '', $object->id);
        }
    } else {
        if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $mesg = '<div class="error">' . $langs->trans("ObjectAlreadyLinkedToCategory") . '</div>';
        } else {
            $mesg = $langs->trans("Error") . ' ' . $cat->error;
        }
    }
}
/*
 *	View
 */
$form = new Form($db);
/*
 * Fiche categorie de client et/ou fournisseur