27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/website/lib/websiteaccount.lib.php';
42$langs->loadLangs(array(
"website",
"other"));
47$action =
GETPOST(
'action',
'aZ09');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$cancel =
GETPOST(
'cancel',
'aZ09');
50$backtopage =
GETPOST(
'backtopage',
'alpha');
55$hookmanager->initHooks(array(
$object->element.
'card',
'globalcard'));
58$extrafields->fetch_name_optionals_label(
$object->table_element);
60$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
63$search_all =
GETPOST(
"search_all",
'alpha');
65foreach (
$object->fields as $key => $val) {
66 if (
GETPOST(
'search_'.$key,
'alpha')) {
67 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
71if (empty($action) && empty($id) && empty($ref)) {
76include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
82$permissiontoaccess = (isModEnabled(
'website') && $user->hasRight(
'website',
'read')) || isModEnabled(
'webportal');
83if (!$permissiontoaccess) {
88$permissiontocreate = 0;
89$permissiontodelete = 0;
92 if (
$object->site ==
'dolibarr_website') {
93 $permissiontocreate = isModEnabled(
'website') && $user->hasRight(
'website',
'write');
94 $permissiontodelete = isModEnabled(
'website') && $user->hasRight(
'website',
'delete');
95 } elseif (
$object->site ==
'dolibarr_portal') {
96 $permissiontocreate = isModEnabled(
'webportal') && $user->hasRight(
'webportal',
'write');
99 $permissiontocreate = isModEnabled(
'website') && $user->hasRight(
'website',
'write') || isModEnabled(
'webportal') && $user->hasRight(
'webportal',
'write');
101$permissionnote = $permissiontocreate;
102$permissiondellink = $permissiontocreate;
103$permissiontoadd = $permissiontocreate;
107if (!empty($action) && $action !=
'view') {
108 if (!empty(
$object->fields[
'site'][
'arrayofkeyval'])) {
109 if (isset(
$object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website'])) {
110 if ($action ==
'delete' || $action ==
'confirm_delete') {
111 if (!$user->hasRight(
'website',
'delete')) {
112 unset(
$object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website']);
115 if (!$user->hasRight(
'website',
'write')) {
116 unset(
$object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_website']);
121 if (isset(
$object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_portal'])) {
122 if (!$user->hasRight(
'webportal',
'write')) {
123 unset(
$object->fields[
'site'][
'arrayofkeyval'][
'dolibarr_portal']);
127 if (empty(
$object->fields[
'site'][
'arrayofkeyval'])) {
133 if (!array_key_exists(
$object->site,
$object->fields[
'site'][
'arrayofkeyval'])) {
146$parameters = array();
147$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
152if (empty($reshook)) {
155 if ($action ==
'add' && !
GETPOST(
'site')) {
156 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Website")),
null,
'errors');
161 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
164 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
167 $triggersendname =
'WEBSITEACCOUNT_SENTBYMAIL';
168 $autocopy =
'MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO';
169 $trackid =
'websiteaccount'.$object->id;
170 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
178$form =
new Form($db);
181$title = $langs->trans(
"WebsiteAccount");
184llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-website page-card_websiteaccount');
188if ($action ==
'create' || $action ==
'edit') {
189 if (!empty(
$object->fields[
'site'][
'visible']) && !empty(
$object->fields[
'fk_website'][
'visible'])) {
190 $site_type_js =
'function siteTypeChange(site_type) {';
191 $site_type_js .=
' if (site_type == "dolibarr_website") {';
192 $site_type_js .=
' jQuery("tr.field_fk_website").show();';
193 $site_type_js .=
' } else {';
194 $site_type_js .=
' jQuery("select#fk_website").val("-1").change();';
195 $site_type_js .=
' jQuery("tr.field_fk_website").hide();';
196 $site_type_js .=
' }';
197 $site_type_js .=
'}';
198 $site_type_js .=
'jQuery(document).ready(function(){';
199 $site_type_js .=
' siteTypeChange(jQuery("#site").val());';
200 $site_type_js .=
' jQuery("#site").change(function(){';
201 $site_type_js .=
' siteTypeChange(this.value);';
202 $site_type_js .=
' });';
203 $site_type_js .=
'});';
205 $out_js .=
'<script type"text/javascript">';
206 $out_js .= $site_type_js;
207 $out_js .=
'</script>';
212if ($action ==
'create') {
213 if (empty($permissiontoadd)) {
217 print
load_fiche_titre($langs->trans(
"NewWebsiteAccount", $langs->transnoentitiesnoconv(
"WebsiteAccount")));
219 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
220 print
'<input type="hidden" name="token" value="'.newToken().
'">';
221 print
'<input type="hidden" name="action" value="add">';
223 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
225 if (!empty($backtopageforcancel)) {
226 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
228 if (!empty($backtopagejsfields)) {
229 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
231 if (!empty($dol_openinpopup)) {
232 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
237 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
240 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
243 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
245 print
'</table>'.
"\n";
249 print $form->buttonsSaveCancel(
"Create");
257if (($id || $ref) && $action ==
'edit') {
260 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
261 print
'<input type="hidden" name="token" value="'.newToken().
'">';
262 print
'<input type="hidden" name="action" value="update">';
263 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
264 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
268 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
271 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
274 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
280 print $form->buttonsSaveCancel();
288if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
289 if (
$object->fk_soc > 0 && empty($socid)) {
302 if ($action ==
'delete') {
303 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteWebsiteAccount'), $langs->trans(
'ConfirmDeleteWebsiteAccount'),
'confirm_delete',
'', 0, 1);
307 $parameters = array(
'formConfirm' => $formconfirm);
308 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
309 if (empty($reshook)) {
310 $formconfirm .= $hookmanager->resPrint;
311 } elseif ($reshook > 0) {
312 $formconfirm = $hookmanager->resPrint;
323 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/website.php?socid='.$socid.
'&restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToListForThirdParty").
'</a>';
329 $morehtmlref =
'<div class="refidno">';
371 $morehtmlref .=
'</div>';
374 $object->next_prev_filter =
'te.fk_soc:=:'.((int) $socid);
377 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
380 print
'<div class="fichecenter">';
381 print
'<div class="fichehalfleft">';
382 print
'<div class="underbanner clearboth"></div>';
383 print
'<table class="border centpercent tableforfield">'.
"\n";
386 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
389 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
395 print
'<div class="clearboth"></div>';
401 if ($action !=
'presend' && $action !=
'editline') {
402 print
'<div class="tabsAction">'.
"\n";
403 $parameters = array();
404 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
409 if (empty($reshook)) {
411 if (empty($user->socid)) {
412 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&token='.
newToken().
'&mode=init#formmailbeforetitle');
416 if ($permissiontoadd) {
417 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.(!empty(
$object->socid) ?
'&socid='.$object->socid :
'').
'&action=clone&token='.
newToken(),
'', $permissiontoadd);
422 print
dolGetButtonAction(
'', $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete, $params);
429 if (
GETPOST(
'modelselected')) {
433 if ($action !=
'presend') {
434 print
'<div class="fichecenter"><div class="fichehalfleft">';
435 print
'<a name="builddoc"></a>';
437 print
'</div><div class="fichehalfright">';
450 print
'</div></div>';
454 $modelmail =
'websiteaccount';
455 $defaulttopic =
'Information';
456 $diroutput = isModEnabled(
'website') ?
$conf->website->dir_output :
'';
457 $trackid =
'websiteaccount'.$object->id;
459 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class for SocieteAccount.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.