30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
44$langs->loadLangs(array(
'companies',
'other'));
47$action =
GETPOST(
'action',
'aZ09');
51 $socid = $user->socid;
53$result =
restrictedArea($user,
'contact', $id,
'socpeople&societe');
63if ($action ==
'update' && !
GETPOST(
"cancel") && $user->hasRight(
'societe',
'contact',
'creer')) {
72 } elseif (!empty($_FILES[
'photo'][
'name']) && empty($_FILES[
'photo'][
'error'])) {
76 $result =
$object->update_perso($id, $user);
81 $dir =
$conf->societe->dir_output.
'/contact/'.
get_exdir(
$object->id, 0, 0, 1, $object,
'contact').
'/photos';
83 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
85 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
86 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
89 $dirthumbs =
$conf->societe->dir_output.
'/contact/'.
get_exdir(
$object->id, 0, 0, 1, $object,
'contact').
'/photos/thumbs';
99 $resultupload =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
101 if (!is_numeric($resultupload) || $resultupload <= 0) {
109 $langs->load(
"errors");
113 switch ($_FILES[
'photo'][
'error']) {
116 $langs->load(
"errors");
136$title = $langs->trans(
"ContactPersonalData");
140$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
142llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-societe page-contact-card_perso');
144$form =
new Form($db);
151if ($action ==
'edit') {
156 print
'<form name="perso" method="POST" enctype="multipart/form-data" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
157 print
'<input type="hidden" name="token" value="'.newToken().
'">';
158 print
'<input type="hidden" name="action" value="update">';
159 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
163 print
'<table class="border centpercent">';
166 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td>';
171 print
'<tr><td>'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</td><td>'.
$object->lastname.
'</td></tr>';
172 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td>'.
$object->firstname.
'</td>';
178 $objsoc->fetch(
$object->socid);
180 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td>'.$objsoc->getNomUrl(1).
'</td>';
182 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td>';
183 print $langs->trans(
"ContactNotLinkedToCompany");
189 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
190 print
$object->getCivilityLabel();
195 print
'<tr class="hideonsmartphone">';
196 print
'<td>'.$form->editfieldkey(
'PhotoFile',
'photoinput',
'', $object, 0).
'</td>';
199 print $form->showphoto(
'contact', $object);
206 print
'<table class="nobordernopadding">';
208 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br><br></td></tr>';
213 $maxmin = $maxfilesizearray[
'maxmin'];
215 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
217 print
'<input type="file" class="flat" name="photo" id="photoinput">';
225 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
226 $form =
new Form($db);
227 print $form->selectDate(
$object->birthday,
'birthday', 0, 0, 1,
"perso", 1, 0);
228 print
' ';
229 print
'<label for="birthday_alert">'.$langs->trans(
"BirthdayAlert").
':</label> ';
230 if (!empty(
$object->birthday_alert)) {
231 print
'<input type="checkbox" id="birthday_alert" name="birthday_alert" value="1" checked>';
233 print
'<input type="checkbox" id="birthday_alert" name="birthday_alert" value="1">';
242 print $form->buttonsSaveCancel();
250 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
252 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.
$object->id.
'" class="refid">';
253 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
254 $morehtmlref .=
'</a>';
256 $morehtmlref .=
'<div class="refidno">';
259 $objsoc->fetch(
$object->socid);
261 if ($objsoc->id > 0) {
262 $morehtmlref .= $objsoc->getNomUrl(1);
264 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
267 $morehtmlref .=
'</div>';
270 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
273 print
'<div class="fichecenter">';
275 print
'<div class="underbanner clearboth"></div>';
276 print
'<table class="border centpercent tableforfield">';
299 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td colspan="3">';
300 print
$object->getCivilityLabel();
305 if (!empty(
$object->birthday)) {
306 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
308 print
'<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3">'.
dol_print_date(
$object->birthday,
"day");
315 print
'('.$ageyear.
' '.$langs->trans(
"DurationYears").
')';
316 } elseif ($agemonth >= 2) {
317 print
'('.$agemonth.
' '.$langs->trans(
"DurationMonths").
')';
319 print
'('.$agemonth.
' '.$langs->trans(
"DurationMonth").
')';
323 print
' - ';
325 print $langs->trans(
"BirthdayAlertOn");
327 print $langs->trans(
"BirthdayAlertOff");
331 print
'<td>'.$langs->trans(
"DateOfBirth").
'</td><td colspan="3"></td>';
343if ($action !=
'edit') {
347 if ($user->socid == 0) {
348 print
'<div class="tabsAction">';
350 if ($user->hasRight(
'societe',
'contact',
'creer')) {
351 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
'Modify').
'</a>';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 to manage third parties objects (customers, suppliers, prospects...)
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_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_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.