25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/website/lib/websiteaccount.lib.php';
32 $langs->loadLangs(array(
"website",
"other"));
37 $action =
GETPOST(
'action',
'aZ09');
38 $confirm =
GETPOST(
'confirm',
'alpha');
39 $cancel =
GETPOST(
'cancel',
'aZ09');
40 $backtopage =
GETPOST(
'backtopage',
'alpha');
45 $diroutputmassaction = $conf->website->dir_output.
'/temp/massgeneration/'.$user->id;
46 $hookmanager->initHooks(array(
'websiteaccountcard'));
49 $extrafields->fetch_name_optionals_label($object->table_element);
51 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
54 $search_all =
GETPOST(
"search_all",
'alpha');
56 foreach ($object->fields as $key => $val) {
57 if (
GETPOST(
'search_'.$key,
'alpha')) {
58 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
62 if (empty($action) && empty($id) && empty($ref)) {
71 $permissionnote = $user->rights->websiteaccount->write;
72 $permissiondellink = $user->rights->websiteaccount->write;
73 $permissiontoadd = $user->rights->websiteaccount->write;
76 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
84 $parameters = array();
85 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
90 if (empty($reshook)) {
93 $permissiontoadd = $user->rights->website->write;
94 $permissiontodelete = $user->rights->website->delete;
95 $backurlforlist =
dol_buildpath(
'/website/websiteaccount_list.php', 1);
98 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
101 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
104 $triggersendname =
'WEBSITEACCOUNT_SENTBYMAIL';
105 $autocopy =
'MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO';
106 $trackid =
'websiteaccount'.$object->id;
107 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
121 if ($action ==
'create') {
122 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"WebsiteAccount")));
124 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
125 print
'<input type="hidden" name="token" value="'.newToken().
'">';
126 print
'<input type="hidden" name="action" value="add">';
127 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
131 print
'<table class="border centpercent">'.
"\n";
134 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
137 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
139 print
'</table>'.
"\n";
143 print
$form->buttonsSaveCancel(
"Create");
149 if (($id || $ref) && $action ==
'edit') {
152 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
153 print
'<input type="hidden" name="action" value="update">';
154 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
155 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
159 print
'<table class="border centpercent">'.
"\n";
162 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
165 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
171 print
$form->buttonsSaveCancel();
177 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
178 if ($object->fk_soc > 0 && empty($socid)) {
179 $socid = $object->fk_soc;
182 $res = $object->fetch_optionals();
185 print
dol_get_fiche_head($head,
'card', $langs->trans(
"WebsiteAccount"), -1,
'websiteaccount@website');
190 if ($action ==
'delete') {
191 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteWebsiteAccount'), $langs->trans(
'ConfirmDeleteWebsiteAccount'),
'confirm_delete',
'', 0, 1);
195 $parameters = array(
'formConfirm' =>
$formconfirm,
'lineid' => $lineid);
196 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
197 if (empty($reshook)) {
199 } elseif ($reshook > 0) {
211 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/website.php?socid='.$socid.
'&restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToListForThirdParty").
'</a>';
214 $linkback =
'<a href="'.DOL_URL_ROOT.
'/website/website_card.php?fk_website='.$fk_website.
'&restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
217 $morehtmlref =
'<div class="refidno">';
259 $morehtmlref .=
'</div>';
262 $object->next_prev_filter =
'te.fk_soc = '.((int) $socid);
265 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
268 print
'<div class="fichecenter">';
269 print
'<div class="fichehalfleft">';
270 print
'<div class="underbanner clearboth"></div>';
271 print
'<table class="border centpercent">'.
"\n";
274 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
277 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
284 print
'<div class="clearboth"></div><br>';
290 if ($action !=
'presend' && $action !=
'editline') {
291 print
'<div class="tabsAction">'.
"\n";
292 $parameters = array();
293 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
298 if (empty($reshook)) {
300 if (empty($user->socid)) {
301 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>'.
"\n";
304 if ($user->rights->website->write) {
305 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a></div>'.
"\n";
322 if ($user->rights->website->delete) {
323 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
'Delete').
'</a></div>'.
"\n";
331 if (
GETPOST(
'modelselected')) {
335 if ($action !=
'presend') {
336 print
'<div class="fichecenter"><div class="fichehalfleft">';
337 print
'<a name="builddoc"></a>';
339 print
'</div><div class="fichehalfright">';
350 print
'</div></div>';
354 $modelmail =
'websiteaccount';
355 $defaulttopic =
'Information';
356 $diroutput = $conf->website->dir_output;
357 $trackid =
'websiteaccount'.$object->id;
359 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';