Example #1
0
            $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
        } else {
            $mesg = '<div class="error">' . $object->error . '</div>';
        }
    }
} else {
    if ($action == 'swapstatut' && $user->rights->propale->creer) {
        if ($object->fetch($id) > 0) {
            $result = $object->swapContactStatus(GETPOST('ligne'));
        } else {
            dol_print_error($db);
        }
    } else {
        if ($action == 'deletecontact' && $user->rights->propale->creer) {
            $object->fetch($id);
            $result = $object->delete_contact($lineid);
            if ($result >= 0) {
                Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        } else {
            if ($action == 'setaddress' && $user->rights->propale->creer) {
                $object->fetch($id);
                $result = $object->setDeliveryAddress($_POST['fk_address']);
                if ($result < 0) {
                    dol_print_error($db, $object->error);
                }
            }
        }
Example #2
0
        Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
            $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
        } else {
            $mesg = '<div class="error">' . $objectsrc->error . '</div>';
        }
    }
} else {
    if ($action == 'swapstatut' && $user->rights->expedition->creer) {
        $result = $objectsrc->swapContactStatus(GETPOST('ligne'));
    } else {
        if ($action == 'deleteline' && $user->rights->expedition->creer) {
            $result = $objectsrc->delete_contact($_GET["lineid"]);
            if ($result >= 0) {
                Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        } else {
            if ($action == 'setaddress' && $user->rights->expedition->creer) {
                $object->fetch($id);
                $result = $object->setDeliveryAddress($_POST['fk_address']);
                if ($result < 0) {
                    dol_print_error($db, $object->error);
                }
            }
        }
        header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
            $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
        } else {
            $mesg = '<div class="error">' . $objectsrc->error . '</div>';
        }
    }
} else {
    if ($action == 'swapstatut' && $user->rights->expedition->creer) {
        $result = $objectsrc->swapContactStatus(GETPOST('ligne'));
    } else {
        if ($action == 'deletecontact' && $user->rights->expedition->creer) {
            $result = $objectsrc->delete_contact(GETPOST("lineid"));
            if ($result >= 0) {
                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        } else {
            if ($action == 'setaddress' && $user->rights->expedition->creer) {
                $object->fetch($id);
                $result = $object->setDeliveryAddress($_POST['fk_address']);
                if ($result < 0) {
                    dol_print_error($db, $object->error);
                }
            }
        }
Example #4
0
		{
			dol_print_error($db, "result=$result");
			$db->rollback();
		}
	} else
	{
		dol_print_error($db);
	}
}

// Efface un contact
if ($action == 'deleteline' && $user->rights->propale->creer)
{
	$propal = new Propal($db);
	$propal->fetch($id);
	$result = $propal->delete_contact($lineid);

	if ($result >= 0)
	{
		Header("Location: contact.php?id=".$propal->id);
		exit;
	}
	else {
		dol_print_error($db);
	}
}


/*
 * View
 */