Example #1
0
// Set into a project
if ($action == 'classin')
{
    $object = new Fichinter($db);
    $object->fetch($id);
    $result=$object->setProject($_POST['projectid']);
    if ($result < 0) dol_print_error($db,$object->error);
}

if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
{
    if ($user->rights->ficheinter->supprimer)
    {
        $object = new Fichinter($db);
        $object->fetch($id);
        $object->delete($user);
    }
    Header('Location: index.php?leftmenu=ficheinter');
    exit;
}

if ($action == 'setdescription')
{
    $object = new Fichinter($db);
    $object->fetch($id);
    $result=$object->set_description($user,$_POST['description']);
    if ($result < 0) dol_print_error($db,$object->error);
}

// Add line
if ($action == "addline" && $user->rights->ficheinter->creer)
Example #2
0
 /**
  * testFichinterDelete
  *
  * @param	int		$id		Id of intervention
  * @return	int
  *
  * @depends	testFichinterOther
  * The depends says test is run only if previous is ok
  */
 public function testFichinterDelete($id)
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Fichinter($this->savdb);
     $result = $localobject->fetch($id);
     $result = $localobject->delete($user);
     print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $result;
 }