26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/website/lib/websiteaccount.lib.php';
33$langs->loadLangs(array(
"website",
"other"));
38$action =
GETPOST(
'action',
'aZ09');
39$confirm =
GETPOST(
'confirm',
'alpha');
40$cancel =
GETPOST(
'cancel',
'aZ09');
41$backtopage =
GETPOST(
'backtopage',
'alpha');
46$diroutputmassaction = $conf->website->dir_output.
'/temp/massgeneration/'.$user->id;
47$hookmanager->initHooks(array($object->element.
'card',
'globalcard'));
50$extrafields->fetch_name_optionals_label($object->table_element);
52$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
55$search_all =
GETPOST(
"search_all",
'alpha');
57foreach ($object->fields as $key => $val) {
58 if (
GETPOST(
'search_'.$key,
'alpha')) {
59 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
63if (empty($action) && empty($id) && empty($ref)) {
68include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
74$permissiontoaccess = (isModEnabled(
'website') && $user->hasRight(
'website',
'read')) || isModEnabled(
'webportal');
75if (!$permissiontoaccess) {
80$permissiontocreate = 0;
81$permissiontodelete = 0;
84 if ($object->site ==
'dolibarr_website') {
85 $permissiontocreate = isModEnabled(
'website') && $user->hasRight(
'website',
'write');
86 $permissiontodelete = isModEnabled(
'website') && $user->hasRight(
'website',
'delete');
87 } elseif ($object->site ==
'dolibarr_portal') {
88 $permissiontocreate = isModEnabled(
'webportal') && $user->hasRight(
'webportal',
'write');
91 $permissiontocreate = isModEnabled(
'website') && $user->hasRight(
'website',
'write') || isModEnabled(
'webportal') && $user->hasRight(
'webportal',
'write');
93$permissionnote = $permissiontocreate;
94$permissiondellink = $permissiontocreate;
95$permissiontoadd = $permissiontocreate;
99if (!empty($action) && $action !=
'view') {
100 if (!empty($object->fields[
'site'][
'arrayofkeyval'])) {
101 if (isset($object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website'])) {
102 if ($action ==
'delete' || $action ==
'confirm_delete') {
103 if (!$user->hasRight(
'website',
'delete')) {
104 unset($object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website']);
107 if (!$user->hasRight(
'website',
'write')) {
108 unset($object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website']);
113 if (isset($object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_portal'])) {
114 if (!$user->hasRight(
'webportal',
'write')) {
115 unset($object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_portal']);
119 if (empty($object->fields[
'site'][
'arrayofkeyval'])) {
123 if ($object->id > 0) {
125 if (!key_exists($object->site, $object->fields[
'site'][
'arrayofkeyval'])) {
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142if (empty($reshook)) {
145 $backurlforlist =
dol_buildpath(
'/societe/website.php', 1).
'?id='.$object->fk_soc;
148 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
151 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
154 $triggersendname =
'WEBSITEACCOUNT_SENTBYMAIL';
155 $autocopy =
'MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO';
156 $trackid =
'websiteaccount'.$object->id;
157 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
165$form =
new Form($db);
168$title = $langs->trans(
"WebsiteAccount");
175if ($action ==
'create' || $action ==
'edit') {
176 if (!empty($object->fields[
'site'][
'visible']) && !empty($object->fields[
'fk_website'][
'visible'])) {
177 $site_type_js =
'function siteTypeChange(site_type) {';
178 $site_type_js .=
' if (site_type == "dolibarr_website") {';
179 $site_type_js .=
' jQuery("tr.field_fk_website").show();';
180 $site_type_js .=
' } else {';
181 $site_type_js .=
' jQuery("select#fk_website").val("-1").change();';
182 $site_type_js .=
' jQuery("tr.field_fk_website").hide();';
183 $site_type_js .=
' }';
184 $site_type_js .=
'}';
185 $site_type_js .=
'jQuery(document).ready(function(){';
186 $site_type_js .=
' siteTypeChange(jQuery("#site").val());';
187 $site_type_js .=
' jQuery("#site").change(function(){';
188 $site_type_js .=
' siteTypeChange(this.value);';
189 $site_type_js .=
' });';
190 $site_type_js .=
'});';
192 $out_js .=
'<script type"text/javascript">';
193 $out_js .= $site_type_js;
194 $out_js .=
'</script>';
199if ($action ==
'create') {
200 if (empty($permissiontoadd)) {
204 print
load_fiche_titre($langs->trans(
"NewWebsiteAccount", $langs->transnoentitiesnoconv(
"WebsiteAccount")));
206 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
207 print
'<input type="hidden" name="token" value="'.newToken().
'">';
208 print
'<input type="hidden" name="action" value="add">';
210 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
212 if ($backtopageforcancel) {
213 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
215 if ($backtopagejsfields) {
216 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
218 if ($dol_openinpopup) {
219 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
224 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
227 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
230 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
232 print
'</table>'.
"\n";
236 print $form->buttonsSaveCancel(
"Create");
244if (($id || $ref) && $action ==
'edit') {
247 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
248 print
'<input type="hidden" name="token" value="'.newToken().
'">';
249 print
'<input type="hidden" name="action" value="update">';
250 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
251 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
255 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
258 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
261 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
267 print $form->buttonsSaveCancel();
275if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
276 if ($object->fk_soc > 0 && empty($socid)) {
277 $socid = $object->fk_soc;
284 print
dol_get_fiche_head($head,
'card', $langs->trans(
"WebsiteAccount"), -1,
'websiteaccount@website');
289 if ($action ==
'delete') {
290 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteWebsiteAccount'), $langs->trans(
'ConfirmDeleteWebsiteAccount'),
'confirm_delete',
'', 0, 1);
294 $parameters = array(
'formConfirm' => $formconfirm);
295 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
296 if (empty($reshook)) {
297 $formconfirm .= $hookmanager->resPrint;
298 } elseif ($reshook > 0) {
299 $formconfirm = $hookmanager->resPrint;
310 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/website.php?socid='.$socid.
'&restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToListForThirdParty").
'</a>';
316 $morehtmlref =
'<div class="refidno">';
358 $morehtmlref .=
'</div>';
361 $object->next_prev_filter =
'te.fk_soc = '.((int) $socid);
364 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
367 print
'<div class="fichecenter">';
368 print
'<div class="fichehalfleft">';
369 print
'<div class="underbanner clearboth"></div>';
370 print
'<table class="border centpercent tableforfield">'.
"\n";
373 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
376 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
382 print
'<div class="clearboth"></div>';
388 if ($action !=
'presend' && $action !=
'editline') {
389 print
'<div class="tabsAction">'.
"\n";
390 $parameters = array();
391 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
396 if (empty($reshook)) {
398 if (empty($user->socid)) {
399 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&token='.newToken().
'&mode=init#formmailbeforetitle');
403 if ($permissiontoadd) {
404 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.(!empty($object->socid) ?
'&socid='.$object->socid :
'').
'&action=clone&token='.newToken(),
'', $permissiontoadd);
423 print
dolGetButtonAction(
'', $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete, $params);
430 if (
GETPOST(
'modelselected')) {
434 if ($action !=
'presend') {
435 print
'<div class="fichecenter"><div class="fichehalfleft">';
436 print
'<a name="builddoc"></a>';
438 print
'</div><div class="fichehalfright">';
451 print
'</div></div>';
455 $modelmail =
'websiteaccount';
456 $defaulttopic =
'Information';
457 $diroutput = $conf->website->dir_output;
458 $trackid =
'websiteaccount'.$object->id;
460 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class for SocieteAccount.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
websiteaccountPrepareHead($object)
Prepare array of tabs for SocieteAccount.