28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
33 $langs->loadLangs(array(
'companies',
'other'));
36 $action =
GETPOST(
'action',
'aZ09');
40 $socid = $user->socid;
42 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe');
49 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->societe->contact->creer) {
50 $ret = $object->fetch($id);
54 $object->birthday_alert =
GETPOST(
"birthday_alert");
58 } elseif (!empty($_FILES[
'photo'][
'name'])) {
62 $result = $object->update_perso($id, $user);
67 $dir = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos';
69 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
71 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
72 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
74 $fileimg = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos/'.$object->photo;
75 $dirthumbs = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos/thumbs';
85 if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
89 $object->addThumbs($newfile);
96 switch ($_FILES[
'photo'][
'error']) {
99 $errors[] =
"ErrorFileSizeTooLarge";
102 $errors[] =
"ErrorFilePartiallyUploaded";
107 $error = $object->error;
118 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
119 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) {
120 $title = $object->lastname;
122 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
127 $object->fetch($id, $user);
131 if ($action ==
'edit') {
136 print
'<form name="perso" method="POST" enctype="multipart/form-data" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
137 print
'<input type="hidden" name="token" value="'.newToken().
'">';
138 print
'<input type="hidden" name="action" value="update">';
139 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
143 print
'<table class="border centpercent">';
146 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td colspan="3">';
151 print
'<td class="center hideonsmartphone valignmiddle" rowspan="6">';
152 print
$form->showphoto(
'contact', $object).
"\n";
153 if ($object->photo) {
157 print
'<table class="nobordernopadding">';
159 if ($object->photo) {
160 print
'<tr><td class="center"><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
162 print
'<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
165 $maxmin = $maxfilesizearray[
'maxmin'];
167 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
169 print
'<input type="file" class="flat" name="photo" id="photoinput">';
176 print
'<tr><td>'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</td><td colspan="3">'.$object->lastname.
'</td></tr>';
177 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="3">'.$object->firstname.
'</td>';
180 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
181 if ($object->socid > 0) {
183 $objsoc->fetch($object->socid);
185 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="3">'.$objsoc->getNomUrl(1).
'</td>';
187 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="3">';
188 print $langs->trans(
"ContactNotLinkedToCompany");
194 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
195 print $object->getCivilityLabel();
199 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
201 print
$form->selectDate($object->birthday,
'birthday', 0, 0, 1,
"perso", 1, 0);
204 print
'<td colspan="2">'.$langs->trans(
"Alert").
': ';
205 if (!empty($object->birthday_alert)) {
206 print
'<input type="checkbox" name="birthday_alert" checked></td>';
208 print
'<input type="checkbox" name="birthday_alert"></td>';
216 print
$form->buttonsSaveCancel();
224 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
226 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.$object->id.
'" class="refid">';
227 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
228 $morehtmlref .=
'</a>';
230 $morehtmlref .=
'<div class="refidno">';
231 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
233 $objsoc->fetch($object->socid);
235 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
236 if ($objsoc->id > 0) {
237 $morehtmlref .= $objsoc->getNomUrl(1);
239 $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
242 $morehtmlref .=
'</div>';
245 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
248 print
'<div class="fichecenter">';
250 print
'<div class="underbanner clearboth"></div>';
251 print
'<table class="border centpercent tableforfield">';
274 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
275 print $object->getCivilityLabel();
280 if (!empty($object->birthday)) {
281 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
283 print
'<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3">'.
dol_print_date($object->birthday,
"day");
290 print
'('.$ageyear.
' '.$langs->trans(
"DurationYears").
')';
291 } elseif ($agemonth >= 2) {
292 print
'('.$agemonth.
' '.$langs->trans(
"DurationMonths").
')';
294 print
'('.$agemonth.
' '.$langs->trans(
"DurationMonth").
')';
298 print
' - ';
299 if ($object->birthday_alert) {
300 print $langs->trans(
"BirthdayAlertOn");
302 print $langs->trans(
"BirthdayAlertOff");
306 print
'<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3"></td>';
318 if ($action !=
'edit') {
322 if ($user->socid == 0) {
323 print
'<div class="tabsAction">';
325 if ($user->rights->societe->contact->creer) {
326 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
'Modify').
'</a>';
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.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
getMaxFileSizeArray()
Return the max allowed for file upload.
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.