36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
47if (isModEnabled(
'member')) {
48 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
52$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
54if (isModEnabled(
'category')) {
55 $langs->load(
"categories");
57if (isModEnabled(
'incoterm')) {
58 $langs->load(
"incoterm");
60if (isModEnabled(
'notification')) {
61 $langs->load(
"mails");
69$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
70$cancel =
GETPOST(
'cancel',
'alpha');
71$backtopage =
GETPOST(
'backtopage',
'alpha');
74$selectedfields =
GETPOST(
'selectedfields',
'alpha');
77 $socid = $user->socid;
80if (empty($socid) && $action ==
'view') {
89$extrafields->fetch_name_optionals_label(
$object->table_element);
92$hookmanager->initHooks(array(
'thirdpartycontact',
'globalcard'));
94if (
$object->fetch($socid) <= 0 && $action ==
'view') {
95 $langs->load(
"errors");
96 print($langs->trans(
'ErrorRecordNotFound'));
103if (!empty($canvas)) {
104 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
105 $objcanvas =
new Canvas($db, $action);
106 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
110$result =
restrictedArea($user,
'societe', $socid,
'&societe',
'',
'fk_soc',
'rowid', 0);
111if (!$user->hasRight(
'societe',
'contact',
'lire')) {
120$parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
121$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
126if (empty($reshook)) {
129 if (!empty($backtopage)) {
130 header(
"Location: ".$backtopage);
136 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
139if ($action ==
'confirm_delete' && $user->hasRight(
'societe',
'contact',
'delete')) {
141 if (!empty($id) && $socid > 0) {
143 $ret = $contact->fetch($id);
145 if ($contact->priv == 0 || ($contact->user_modification_id == ((
int) $user->id) && $contact->priv == 1)) {
146 $contact->oldcopy = clone $contact;
147 $result = $contact->delete($user);
150 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$socid);
166$form =
new Form($db);
171if ($socid > 0 && empty(
$object->id)) {
172 $result =
$object->fetch($socid);
178$title = $langs->trans(
"ThirdParty");
180 $title =
$object->name.
" - ".$langs->trans(
'ContactsAddresses');
182$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
185$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
189 $res =
$object->fetch_optionals();
198$linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
200dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom',
'',
'', 0,
'',
'', 1);
206if ($action !=
'presend') {
209 $showuserlogin = in_array(
'u.user', explode(
',', $selectedfields)) ? 1 : 0;
210 $result =
show_contacts($conf, $langs, $db, $object, $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id, $showuserlogin);
213if ($action ==
'delete') {
214 $formconfirm = $form->formconfirm(
216 $langs->trans(
'Delete'),
217 $langs->trans(
'ConfirmDeleteContact',
GETPOST(
'id',
'alpha')),
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.