26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 $langs->loadLangs(array(
'other',
'companies',
'contact'));
37 $action =
GETPOST(
'action',
'aZ09');
38 $confirm =
GETPOST(
'confirm',
'alpha');
43 $object->getCanvas($id);
45 $canvas = (!empty($object->canvas) ? $object->canvas :
GETPOST(
"canvas"));
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
49 $objcanvas =
new Canvas($db, $action);
50 $objcanvas->getCanvas(
'contact',
'contactcard', $canvas);
54 if ($user->socid) $socid = $user->socid;
55 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe',
'',
'',
'rowid', 0);
58 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
59 $sortfield =
GETPOST(
"sortfield",
'alpha');
60 $sortorder =
GETPOST(
"sortorder",
'alpha');
62 if (empty($page) || $page == -1) { $page = 0; }
63 $offset = $limit * $page;
64 $pageprev = $page - 1;
65 $pagenext = $page + 1;
67 if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; }
68 if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder = $conf->global->MAIN_DOC_SORT_ORDER; }
70 if (!$sortorder) $sortorder =
"ASC";
71 if (!$sortfield) $sortfield =
"name";
73 if ($id > 0) $object->fetch($id);
75 $upload_dir = $conf->societe->multidir_output[$object->entity].
'/contact/'.
dol_sanitizeFileName($object->ref);
76 $modulepart =
'contact';
83 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
90 $form =
new Form($db);
92 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
93 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) $title = $object->lastname;
94 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
100 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
106 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
108 foreach ($filearray as $key => $file)
110 $totalsize += $file[
'size'];
113 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
115 $morehtmlref =
'<div class="refidno">';
116 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
119 $objsoc->fetch($object->socid);
121 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
122 if ($objsoc->id > 0) $morehtmlref .= $objsoc->getNomUrl(1);
123 else $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
125 $morehtmlref .=
'</div>';
127 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
129 print '<div class="fichecenter">';
131 print '<div class="underbanner clearboth"></div>';
132 print '<table class="border tableforfield centpercent">';
155 print '<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
156 print $object->getCivilityLabel();
159 print '<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
160 print '<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
167 $modulepart =
'contact';
168 $permission = $user->rights->societe->contact->creer;
169 $permtoedit = $user->rights->societe->contact->creer;
170 $param =
'&id='.$object->id;
171 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
173 print $langs->trans(
"ErrorUnknown");
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.