Example #1
0
        Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
        exit;
    }
    else
    {
        $mesg='<div class="error">'.$object->error.'</div>';
    }
}

if ($action == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
{
    $object = new Fichinter($db);
    $object->fetch($id);
    $object->fetch_thirdparty();

    $result = $object->setDraft($user);
    if ($result >= 0)
    {
        // Define output language
        $outputlangs = $langs;
        $newlang='';
        if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
        if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
        if (! empty($newlang))
        {
            $outputlangs = new Translate("",$conf);
            $outputlangs->setDefaultLang($newlang);
        }
        $result=fichinter_create($db, $object, (empty($_REQUEST['model'])?$object->model:$_REQUEST['model']), $outputlangs);
        Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
        exit;