Пример #1
0
         $object->note_public = GETPOST('note_public', 'alpha');
         $object->statut = 0;
         if (!$object->date) {
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
             $error++;
         }
         if ($object->type == '-1') {
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
             $error++;
         }
         if (!($object->fk_user > 0)) {
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Person")), null, 'errors');
             $error++;
         }
         if (!$error) {
             $id = $object->create($user);
             if ($id > 0) {
                 header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
                 exit;
             } else {
                 setEventMessages($object->error, $object->errors, 'errors');
                 $action = 'create';
             }
         } else {
             $action = 'create';
         }
     } else {
         header("Location: index.php");
         exit;
     }
 } else {
Пример #2
0
            $error++;
        }
		if ($deplacement->type == '-1') 	// Otherwise it is TF_LUNCH,...
		{
			$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
			$error++;
		}
		if (! ($deplacement->fk_user > 0))
		{
			$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'</div>';
			$error++;
		}

		if (! $error)
		{
			$id = $deplacement->create($user);

			if ($id > 0)
			{
				Header ( "Location: fiche.php?id=".$id);
				exit;
			}
			else
			{
				$mesg=$deplacement->error;
				$_GET["action"]='create';
			}
		}
		else
		{
			$_GET["action"]='create';