Example #1
0
 /**
  * testProjectValid
  *
  * @param	Project	$localobject	Project
  * @return	Project
  *
  * @depends	testProjectFetch
  * The depends says test is run only if previous is ok
  */
 public function testProjectValid($localobject)
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $result = $localobject->setValid($user);
     print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $localobject;
 }
Example #2
0
if (GETPOST('action') == 'confirm_close' && GETPOST('confirm') == 'yes')
{
    $project = new Project($db);
    $project->fetch(GETPOST("id"));
    $result = $project->setClose($user);
    if ($result <= 0)
    {
        $mesg='<div class="error">'.$project->error.'</div>';
    }
}

if (GETPOST('action') == 'confirm_reopen' && GETPOST('confirm') == 'yes')
{
    $project = new Project($db);
    $project->fetch(GETPOST("id"));
    $result = $project->setValid($user);
    if ($result <= 0)
    {
        $mesg='<div class="error">'.$project->error.'</div>';
    }
}

if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->projet->supprimer)
{
    $project = new Project($db);
    $project->fetch(GETPOST("id"));
    $result=$project->delete($user);
    if ($result > 0)
    {
        Header("Location: index.php");
        exit;