28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36 $langs->loadLangs(array(
'other',
'companies',
'contact'));
40 $action =
GETPOST(
'action',
'aZ09');
41 $confirm =
GETPOST(
'confirm',
'alpha');
46 $object->getCanvas($id);
48 $canvas = (!empty($object->canvas) ? $object->canvas :
GETPOST(
"canvas"));
49 if (!empty($canvas)) {
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
51 $objcanvas =
new Canvas($db, $action);
52 $objcanvas->getCanvas(
'contact',
'contactcard', $canvas);
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60 if (empty($page) || $page == -1) {
63 $offset = $limit * $page;
64 $pageprev = $page - 1;
65 $pagenext = $page + 1;
67 if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) {
68 $sortfield = $conf->global->MAIN_DOC_SORT_FIELD;
70 if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) {
71 $sortorder = $conf->global->MAIN_DOC_SORT_ORDER;
85 $upload_dir = $conf->societe->multidir_output[$object->entity].
'/contact/'.
dol_sanitizeFileName($object->ref);
86 $modulepart =
'contact';
89 $hookmanager->initHooks(array(
'contactdocument'));
93 $socid = $user->socid;
95 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe',
'',
'',
'rowid', 0);
97 $permissiontoadd = $user->rights->societe->contact->creer;
104 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
113 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
114 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) {
115 $title = $object->lastname;
117 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
122 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
128 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
130 foreach ($filearray as $key => $file) {
131 $totalsize += $file[
'size'];
134 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
136 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.$object->id.
'" class="refid">';
137 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
138 $morehtmlref .=
'</a>';
140 $morehtmlref .=
'<div class="refidno">';
141 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
143 $objsoc->fetch($object->socid);
145 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
146 if ($objsoc->id > 0) {
147 $morehtmlref .= $objsoc->getNomUrl(1);
149 $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
152 $morehtmlref .=
'</div>';
154 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
156 print
'<div class="fichecenter">';
158 print
'<div class="underbanner clearboth"></div>';
159 print
'<table class="border tableforfield centpercent">';
182 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
183 print $object->getCivilityLabel();
186 print
'<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
187 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
194 $modulepart =
'contact';
195 $permissiontoadd = $user->rights->societe->contact->creer;
196 $permtoedit = $user->rights->societe->contact->creer;
197 $param =
'&id='.$object->id;
198 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
200 print $langs->trans(
"ErrorUnknown");
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Class to manage third parties objects (customers, suppliers, prospects...)
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(isset($_GET["hashp"]) &&!defined("NOLOGIN")) if((isset($_GET["modulepart"]) && $_GET["modulepart"]=='medias')) llxHeader()
Header empty.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.