} } else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } } } else { if ($action == 'add' && $user->rights->facture->creer) { if ($socid > 0) { $object->socid = GETPOST('socid', 'int'); } $db->begin(); $error = 0; // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { $error++; } // Replacement invoice if ($_POST['type'] == Facture::TYPE_REPLACEMENT) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } if (!($_POST['fac_replacement'] > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors'); } if (!$error) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ActionsOwnedBy")), null, 'errors'); } if ($object->type_code == 'AC_RDV' && ($datep == '' || $datef == '' && empty($fulldayevent))) { $error++; $donotclearsession = 1; $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors'); } if (!GETPOST('apyear') && !GETPOST('adyear')) { $error++; $donotclearsession = 1; $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { $error++; } if (!$error) { $db->begin(); // On cree l'action $idaction = $object->add($user); if ($idaction > 0) { if (!$object->error) { unset($_SESSION['assignedtouser']); $moreparam = ''; if ($user->id != $object->userownerid) { $moreparam = "usertodo=-1"; } // We force to remove filter so created record is visible when going back to per user view.
$adh->email = $_POST["email"]; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { $adh->login = $_POST["login"]; $adh->pass = $_POST["pass1"]; } $adh->photo = $_POST["photo"]; $adh->note = $_POST["note"]; $adh->country_id = $_POST["country_id"]; $adh->state_id = $_POST["state_id"]; $adh->typeid = $_POST["type"]; $adh->note = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; $adh->birth = $birthday; // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($adh->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $adh); $result = $adh->create($user); if ($result > 0) { require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; // Send email to say it has been created and will be validated soon... if (!empty($conf->global->ADHERENT_AUTOREGISTER_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT)) { $result = $adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL, $conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT, array(), array(), array(), "", "", 0, -1); } // Send email to the foundation to say a new member subscribed with autosubscribe form if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) { $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); $from = $conf->global->ADHERENT_MAIL_FROM; $mailfile = new CMailFile($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT, $to, $from, $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL), array(), array(), array(), "", "", 0, -1); if (!$mailfile->sendfile()) { dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR); }
$task_parent = 0; } // If task_parent is '' $task = new Task($db); $task->fk_project = $projectid; $task->ref = GETPOST('ref', 'alpha'); $task->label = $label; $task->description = $description; $task->planned_workload = $planned_workload; $task->fk_task_parent = $task_parent; $task->date_c = dol_now(); $task->date_start = $date_start; $task->date_end = $date_end; $task->progress = $progress; // Fill array 'array_options' with data from add form $ret = $extrafields_task->setOptionalsFromPost($extralabels_task, $task); $taskid = $task->create($user); if ($taskid > 0) { $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); } else { setEventMessages($task->error, $task->errors, 'errors'); } } if (!$error) { if (!empty($backtopage)) { header("Location: " . $backtopage); exit; } else { if (empty($projectid)) { header("Location: " . DOL_URL_ROOT . '/projet/tasks/index.php' . (empty($mode) ? '' : '?mode=' . $mode)); exit;
$error++; } if (empty($account->ref)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors'); $action = 'create'; // Force chargement page en mode creation $error++; } if (empty($account->label)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors'); $action = 'create'; // Force chargement page en mode creation $error++; } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $account); if (!$error) { $id = $account->create($user); if ($id > 0) { $_GET["id"] = $id; // Force chargement page en mode visu } else { setEventMessages($account->error, $account->errors, 'errors'); $action = 'create'; // Force chargement page en mode creation } } } if ($_POST["action"] == 'update' && !$_POST["cancel"]) { $error = 0; // Update account
$categorie->visible = $visible; if ($parent != "-1") { $categorie->fk_parent = $parent; } else { $categorie->fk_parent = ""; } if (empty($categorie->label)) { $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), 'errors'); } if (empty($categorie->description)) { $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), 'errors'); } if (empty($categorie->error)) { $ret = $extrafields->setOptionalsFromPost($extralabels, $categorie); if ($ret < 0) { $error++; } if ($categorie->update($user) > 0) { header('Location: ' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $categorie->id . '&type=' . $type); exit; } else { setEventMessage($categorie->error, 'errors'); } } else { setEventMessage($categorie->error, 'errors'); } } /* * View