27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
32 $langs->loadLangs(array(
'companies',
'other'));
35 $action =
GETPOST(
'action',
'aZ09');
38 if ($user->socid) $socid = $user->socid;
39 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe');
46 if ($action ==
'update' && !$_POST[
"cancel"] && $user->rights->societe->contact->creer)
48 $ret = $object->fetch($id);
51 $object->birthday =
dol_mktime(0, 0, 0, $_POST[
"birthdaymonth"], $_POST[
"birthdayday"], $_POST[
"birthdayyear"]);
52 $object->birthday_alert = $_POST[
"birthday_alert"];
54 if (
GETPOST(
'deletephoto')) $object->photo =
'';
57 $result = $object->update_perso($id, $user);
60 $object->old_name =
'';
61 $object->old_firstname =
'';
63 $dir = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos';
65 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
68 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
69 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
72 $fileimg = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos/'.$object->photo;
73 $dirthumbs = $conf->societe->dir_output.
'/contact/'.
get_exdir($object->id, 0, 0, 1, $object,
'contact').
'/photos/thumbs';
90 $object->addThumbs($newfile);
97 switch ($_FILES[
'photo'][
'error'])
101 $errors[] =
"ErrorFileSizeTooLarge";
104 $errors[] =
"ErrorFilePartiallyUploaded";
109 $error = $object->error;
120 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
121 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) $title = $object->lastname;
122 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
125 $form =
new Form($db);
127 $object->fetch($id, $user);
131 if ($action ==
'edit')
137 print '<form name="perso" method="POST" enctype="multipart/form-data" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
138 print '<input type="hidden" name="token" value="'.newToken().
'">';
139 print '<input type="hidden" name="action" value="update">';
140 print '<input type="hidden" name="id" value="'.$object->id.
'">';
144 print '<table class="border centpercent">';
147 print '<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td colspan="3">';
152 print '<td class="center hideonsmartphone valignmiddle" rowspan="6">';
153 print $form->showphoto(
'contact', $object).
"\n";
154 if ($object->photo)
print "<br>\n";
156 print '<table class="nobordernopadding">';
158 if ($object->photo)
print '<tr><td class="center"><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
159 print '<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
160 print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
166 print '<tr><td>'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</td><td colspan="3">'.$object->lastname.
'</td></tr>';
167 print '<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="3">'.$object->firstname.
'</td>';
170 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
172 if ($object->socid > 0)
175 $objsoc->fetch($object->socid);
177 print '<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="3">'.$objsoc->getNomUrl(1).
'</td>';
179 print '<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="3">';
180 print $langs->trans(
"ContactNotLinkedToCompany");
186 print '<tr><td>'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
187 print $object->getCivilityLabel();
191 print '<tr><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
192 $form =
new Form($db);
193 print $form->selectDate($object->birthday,
'birthday', 0, 0, 1,
"perso", 1, 0);
196 print '<td colspan="2">'.$langs->trans(
"Alert").
': ';
197 if (!empty($object->birthday_alert))
199 print '<input type="checkbox" name="birthday_alert" checked></td>';
201 print '<input type="checkbox" name="birthday_alert"></td>';
209 print '<div class="center">';
210 print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'">';
211 print ' ';
212 print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
221 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
223 $morehtmlref =
'<div class="refidno">';
224 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
227 $objsoc->fetch($object->socid);
229 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
230 if ($objsoc->id > 0) $morehtmlref .= $objsoc->getNomUrl(1);
231 else $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
233 $morehtmlref .=
'</div>';
236 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
239 print '<div class="fichecenter">';
241 print '<div class="underbanner clearboth"></div>';
242 print '<table class="border centpercent tableforfield">';
265 print '<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
266 print $object->getCivilityLabel();
271 if (!empty($object->birthday))
273 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
275 print '<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3">'.
dol_print_date($object->birthday,
"day");
281 if ($ageyear >= 2)
print '('.$ageyear.
' '.$langs->trans(
"DurationYears").
')';
282 elseif ($agemonth >= 2)
print '('.$agemonth.' '.$langs->trans("DurationMonths").')';
283 else print '('.$agemonth.' '.$langs->trans("DurationMonth").')';
286 print ' - ';
287 if ($object->birthday_alert)
print $langs->trans("BirthdayAlertOn");
288 else print $langs->trans("BirthdayAlertOff");
291 print '<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3"></td>';
303 if ($action !=
'edit')
306 if ($user->socid == 0)
308 print '<div class="tabsAction">';
310 if ($user->rights->societe->contact->creer)
312 print '<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit">'.$langs->trans(
'Modify').
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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_now($mode= 'auto')
Return date for now.
$conf db name
Only used if Module[ID]Name translation string is not found.
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage third parties objects (customers, suppliers, prospects...)
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories) ...
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
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_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_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_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.