示例#1
0
	$commande->setProject($_POST['projectid']);
}

if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes')
{
	$commande = new Commande($db);
	$commande->fetch($_GET["id"]);
	$result = $commande->cloture($user);
}

// Positionne ref commande client
if ($_POST['action'] == 'setrefcustomer' && $user->rights->commande->creer)
{
	$commande = new Commande($db);
	$commande->fetch($_GET['id']);
	$commande->set_ref_client($user, $_POST['ref_customer']);
}

if ($_POST['action'] == 'setdatedelivery' && $user->rights->commande->creer)
{
	//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
	$datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);

	$commande = new Commande($db);
	$commande->fetch($_GET['id']);
	$result=$commande->set_date_livraison($user,$datelivraison);
	if ($result < 0)
	{
		$mesg='<div class="error">'.$commande->error.'</div>';
	}
}
// Categorisation dans projet
if ($action == 'classin') {
    $commande = new Commande($db);
    $commande->fetch($id);
    $commande->setProject(GETPOST('projectid', 'int'));
}
if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes') {
    $commande = new Commande($db);
    $commande->fetch($id);
    $result = $commande->cloture($user);
}
// Positionne ref commande client
if ($action == 'setrefcustomer' && $user->rights->commande->creer) {
    $commande = new Commande($db);
    $commande->fetch($id);
    $commande->set_ref_client($user, GETPOST('ref_customer', 'alpha'));
}
if ($action == 'setdatedelivery' && $user->rights->commande->creer) {
    //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
    $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
    $commande = new Commande($db);
    $commande->fetch($id);
    $result = $commande->set_date_livraison($user, $datelivraison);
    if ($result < 0) {
        $mesg = '<div class="error">' . $commande->error . '</div>';
    }
}
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) {
    $commande = new Commande($db);
    $commande->fetch($id);
    $commande->setDeliveryAddress(GETPOST('delivery_address_id', 'int'));