Example #1
0
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
    $result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
    if ($result > 0) {
        header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        setEventMessage($object->error, 'errors');
    }
} else {
    if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) {
        if (!GETPOST('dateend')) {
            $error++;
            setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), 'errors');
        }
        if (!$error) {
            $result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment')));
            if ($result > 0) {
                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                setEventMessage($object->error, 'errors');
            }
        }
    }
}
// Si ajout champ produit predefini
if (GETPOST('mode') == 'predefined') {
    $date_start = '';
    $date_end = '';
    if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear')) {
        $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
Example #2
0
    $result = $object->active_line($user, $_GET["ligne"], $_GET["date"], $_GET["dateend"], $_GET["comment"]);

    if ($result > 0)
    {
        Header("Location: fiche.php?id=".$object->id);
        exit;
    }
    else {
        $mesg=$object->error;
    }
}

if ($action == 'confirm_closeline' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
{
    $object->fetch($_GET["id"]);
    $result = $object->close_line($user, $_GET["ligne"], $_GET["dateend"], urldecode($_GET["comment"]));

    if ($result > 0)
    {
        Header("Location: fiche.php?id=".$object->id);
        exit;
    }
    else {
        $mesg=$object->error;
    }
}

// Si ajout champ produit predefini
if ($_POST["mode"]=='predefined')
{
	$date_start='';