Example #1
0
 /**
  * testEntrepotDelete
  *
  * @param		int		$id		Id of entrepot
  * @return		void
  *
  * @depends	testEntrepotOther
  * The depends says test is run only if previous is ok
  */
 public function testEntrepotDelete($id)
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Entrepot($this->savdb);
     $result = $localobject->fetch($id);
     $result = $localobject->delete($id);
     print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $result;
 }
            header("Location: fiche.php?id=" . $id);
            exit;
        }
        $action = 'create';
        $mesg = '<div class="error">' . $object->error . '</div>';
    } else {
        $mesg = '<div class="error">' . $langs->trans("ErrorWarehouseRefRequired") . '</div>';
        $action = "create";
        // Force retour sur page creation
    }
}
// Delete warehouse
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer) {
    $object = new Entrepot($db);
    $object->fetch($_REQUEST["id"]);
    $result = $object->delete($user);
    if ($result > 0) {
        header("Location: " . DOL_URL_ROOT . '/product/stock/liste.php');
        exit;
    } else {
        $mesg = '<div class="error">' . $object->error . '</div>';
        $action = '';
    }
}
// Modification entrepot
if ($action == 'update' && $_POST["cancel"] != $langs->trans("Cancel")) {
    $object = new Entrepot($db);
    if ($object->fetch($id)) {
        $object->libelle = $_POST["libelle"];
        $object->description = $_POST["desc"];
        $object->statut = $_POST["statut"];
Example #3
0
		$_GET["action"] = 'create';
		$mesg="<div class='error'>".$entrepot->error."</div>";
	}
	else {
		$mesg="<div class='error'>".$langs->trans("ErrorWarehouseRefRequired")."</div>";
		$_GET["action"]="create";   // Force retour sur page cr�ation
	}
}

// Delete warehouse
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer)
{
	$entrepot = new Entrepot($db);
	$entrepot->fetch($_REQUEST["id"]);
	$result=$entrepot->delete($user);
	if ($result > 0)
	{
		header("Location: ".DOL_URL_ROOT.'/product/stock/liste.php');
		exit;
	}
	else
	{
		$mesg='<div class="error">'.$entrepot->error.'</div>';
		$_REQUEST['action']='';
	}
}

// Modification entrepot
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{