if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"])) { require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; try { $object->load($id); $object->title = trim($_POST["title"]); $object->resume = trim($_POST["resume"]); $object->body = trim($_POST["body"]); $object->tms = dol_now(); if (!$object->title) { $message .= ($message ? '<br>' : '') . $langs->trans("ErrorFieldRequired", $langs->trans("MailTopic")); } if (!$object->body) { $message .= ($message ? '<br>' : '') . $langs->trans("ErrorFieldRequired", $langs->trans("MailBody")); } if (!$message) { $object->record(); Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id()); exit; } } catch (Exception $e) { $message = "Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n"; dol_syslog("Ego::Update " . $message, LOG_ERR); $action = "edit"; } $message = '<div class="error">' . $message . '</div>'; $action = "edit"; } if (!empty($_POST["cancel"])) { $action = ''; } /*
$mesg = $langs->trans("MailSuccessfulySent", $from, $object->email); } */ $model = new AdherentCard($db); $model->load('licenseCard'); try { $card = new AdherentCard($db); $card->load($object->login); } catch (Exception $e) { $card->_id = $object->login; } $card->resume = $model->resume; $card->title = $model->title; $card->body = $model->body; $card->tms = dol_now(); $card->makeSubstitution($object); $card->record(); // Save the Card // Send the card $send = new Mips($db); $send->egoTitle = $card->title; $send->egoBody = $card->body; $send->egoMod = "licence"; $send->send(array("aaaa1234"), $object->login); Header("Location:" . $_SERVER["PHP_SELF"] . "?id=" . $object->id); } if ($action == 'update' && !$_POST["cancel"] && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; $datenaiss = ''; if (isset($_POST["naissday"]) && $_POST["naissday"] && isset($_POST["naissmonth"]) && $_POST["naissmonth"] && isset($_POST["naissyear"]) && $_POST["naissyear"]) { $datenaiss = dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); }