33require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
47$langs->loadLangs(array(
'companies',
'orders'));
52$action =
GETPOST(
'action',
'aZ09');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
54$massaction =
GETPOST(
'massaction',
'alpha');
55$optioncss =
GETPOST(
'optioncss',
'alpha');
58$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
71$offset = $limit * $page;
77if ($id > 0 || !empty($ref)) {
87 $socid = $user->socid;
91$hookmanager->initHooks(array(
'thirdpartycontact',
'thirdpartycontactcard',
'globalcard'));
100$parameters = array(
'id' => $id);
101$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
105if (empty($reshook)) {
106 if ($action ==
'addcontact' && $user->hasRight(
'societe',
'creer')) {
109 if ($result > 0 && $id > 0) {
112 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
116 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
119 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
120 $langs->load(
"errors");
121 $mesg =
'<div class="error">'.$langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType").
'</div>';
123 $mesg =
'<div class="error">'.$object->error.
'</div>';
126 } elseif ($action ==
'swapstatut' && $user->hasRight(
'societe',
'creer')) {
133 } elseif ($action ==
'deletecontact' && $user->hasRight(
'societe',
'creer')) {
139 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
158$title = $langs->trans(
"ContactAddress",
$object->name);
160 $title =
$object->name.
" - ".$title;
162$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
168if ($id > 0 || !empty($ref)) {
169 if (
$object->fetch($id, $ref) > 0) {
171 print
dol_get_fiche_head($head,
'contactext', $langs->trans(
"ThirdParty"), -1,
'company');
173 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
174 print
'<input type="hidden" name="token" value="'.newToken().
'">';
176 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
178 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
180 print
'<div class="fichecenter">';
182 print
'<div class="underbanner clearboth"></div>';
183 print
'<table class="border centpercent">';
196 print
'<tr><td class="titlefield">';
197 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
199 $tmpcheck =
$object->check_codeclient();
200 if ($tmpcheck != 0 && $tmpcheck != -5) {
201 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
207 print
'<tr><td class="titlefield">';
208 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
209 print
$object->code_fournisseur;
210 $tmpcheck =
$object->check_codefournisseur();
211 if ($tmpcheck != 0 && $tmpcheck != -5) {
212 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
225 $dirtpls = array_merge(
$conf->modules_parts[
'tpl'], array(
'/core/tpl'));
226 foreach ($dirtpls as $reldir) {
234 if (
isModEnabled(
'member') && $user->hasRight(
'adherent',
'lire')) {
235 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
236 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
241 $langs->load(
"members");
242 $sql =
"SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
243 $sql .=
" d.datefin,";
244 $sql .=
" d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
245 $sql .=
" t.libelle as type_label, t.subscription";
246 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
247 $sql .=
", ".MAIN_DB_PREFIX.
"adherent_type as t";
248 $sql .=
" WHERE d.entity IN (".getEntity(
'member').
")";
249 $sql .=
" AND d.fk_soc = ".((int) $id);
250 $sql .=
" AND d.fk_adherent_type = t.rowid";
253 $resql =
$db->query($sql);
255 $num =
$db->num_rows($resql);
260 $titre = $langs->trans(
"MembersListOfTiers");
263 print_barre_liste($titre, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, 0,
'');
265 print
"<table class=\"noborder\" width=\"100%\">";
266 print
'<tr class="liste_titre">';
268 print_liste_field_titre(
"NameSlashCompany", $_SERVER[
"PHP_SELF"],
"d.lastname",
"", $param,
"", $sortfield, $sortorder);
273 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"d.statut,d.datefin",
"", $param,
"", $sortfield, $sortorder);
274 print_liste_field_titre(
"EndSubscription", $_SERVER[
"PHP_SELF"],
"d.datefin",
"", $param,
'', $sortfield, $sortorder,
'center ');
278 while ($i < $num && $i < $conf->liste_limit) {
279 $objp =
$db->fetch_object($resql);
281 $datefin =
$db->jdate($objp->datefin);
282 $memberstatic->id = $objp->rowid;
283 $memberstatic->ref = $objp->rowid;
284 $memberstatic->lastname = $objp->lastname;
285 $memberstatic->firstname = $objp->firstname;
286 $memberstatic->statut = $objp->statut;
287 $memberstatic->status = $objp->statut;
288 $memberstatic->datefin =
$db->jdate($objp->datefin);
290 $companyname = $objp->company;
292 print
'<tr class="oddeven">';
296 print $memberstatic->getNomUrl(1);
300 print
"<td><a href=\"card.php?rowid=$objp->rowid\">";
301 print((!empty($objp->lastname) || !empty($objp->firstname)) ?
dol_trunc($memberstatic->getFullName($langs)) :
'');
302 print(((!empty($objp->lastname) || !empty($objp->firstname)) && !empty($companyname)) ?
' / ' :
'');
303 print(!empty($companyname) ?
dol_trunc($companyname, 32) :
'');
307 print
"<td>".$objp->login.
"</td>\n";
310 $membertypestatic->id = $objp->type_id;
311 $membertypestatic->libelle = $objp->type_label;
312 $membertypestatic->label = $objp->type_label;
314 print
'<td class="nowrap">';
315 print $membertypestatic->getNomUrl(1, 32);
319 print
"<td>".$memberstatic->getmorphylib($objp->morphy).
"</td>\n";
322 print
"<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
325 print
'<td class="nowrap">';
326 print $memberstatic->LibStatut($objp->statut, $objp->subscription, $datefin, 2);
331 print
'<td class="center nowrap">';
333 if ($memberstatic->hasDelay()) {
334 print
" ".img_warning($langs->trans(
"SubscriptionLate"));
338 print
'<td class="left nowrap">';
339 if (!empty($objp->subscription)) {
340 print $langs->trans(
"SubscriptionNotReceived");
341 if ($objp->statut > 0) {
342 print
" ".img_warning();
359 print
"ErrorRecordNotFound";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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 members of a foundation.
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
societe_prepare_head(Societe $object, $subtabs='')
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.