31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
38$langs->loadLangs(array(
'companies',
'orders'));
43$action =
GETPOST(
'action',
'aZ09');
44$massaction =
GETPOST(
'massaction',
'alpha');
46$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
47$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
49$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
56if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
59$offset = $limit * $page;
65 $socid = $user->socid;
74$hookmanager->initHooks(array(
'contactthirdparty',
'globalcard'));
81if ($action ==
'addcontact' && $user->hasRight(
'societe',
'creer')) {
82 $result = $object->fetch($id);
84 if ($result > 0 && $id > 0) {
87 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
91 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
94 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
95 $langs->load(
"errors");
96 $mesg =
'<div class="error">'.$langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType").
'</div>';
98 $mesg =
'<div class="error">'.$object->error.
'</div>';
101} elseif ($action ==
'swapstatut' && $user->hasRight(
'societe',
'creer')) {
103 if ($object->fetch($id)) {
104 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
108} elseif ($action ==
'deletecontact' && $user->hasRight(
'societe',
'creer')) {
111 $result = $object->delete_contact(
GETPOST(
"lineid",
'int'));
114 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
126$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
127llxHeader(
'', $langs->trans(
"ThirdParty"), $help_url);
130$form =
new Form($db);
133$contactstatic =
new Contact($db);
134$userstatic =
new User($db);
139if ($id > 0 || !empty($ref)) {
140 if ($object->fetch($id, $ref) > 0) {
142 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"ThirdParty"), -1,
'company');
144 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
145 print
'<input type="hidden" name="token" value="'.newToken().
'">';
147 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
149 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
151 print
'<div class="fichecenter">';
153 print
'<div class="underbanner clearboth"></div>';
154 print
'<table class="border centpercent">';
166 if (!empty($conf->global->SOCIETE_USEPREFIX)) {
167 print
'<tr><td>'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
170 if ($object->client) {
171 print
'<tr><td class="titlefield">';
172 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
173 print $object->code_client;
174 $tmpcheck = $object->check_codeclient();
175 if ($tmpcheck != 0 && $tmpcheck != -5) {
176 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
181 if ($object->fournisseur) {
182 print
'<tr><td class="titlefield">';
183 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
184 print $object->code_fournisseur;
185 $tmpcheck = $object->check_codefournisseur();
186 if ($tmpcheck != 0 && $tmpcheck != -5) {
187 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
199 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
200 foreach ($dirtpls as $reldir) {
208 if (isModEnabled(
'adherent') && $user->rights->adherent->lire) {
209 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
210 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
215 $langs->load(
"members");
216 $sql =
"SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
217 $sql .=
" d.datefin,";
218 $sql .=
" d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
219 $sql .=
" t.libelle as type, t.subscription";
220 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
221 $sql .=
", ".MAIN_DB_PREFIX.
"adherent_type as t";
222 $sql .=
" WHERE d.fk_soc = ".((int) $id);
223 $sql .=
" AND d.fk_adherent_type = t.rowid";
226 $resql = $db->query($sql);
228 $num = $db->num_rows($resql);
233 $titre = $langs->trans(
"MembersListOfTiers");
236 print_barre_liste($titre, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, 0,
'');
238 print
"<table class=\"noborder\" width=\"100%\">";
239 print
'<tr class="liste_titre">';
241 print_liste_field_titre(
"NameSlashCompany", $_SERVER[
"PHP_SELF"],
"d.lastname", $param,
"",
"", $sortfield, $sortorder);
246 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"d.statut,d.datefin", $param,
"",
"", $sortfield, $sortorder);
247 print_liste_field_titre(
"EndSubscription", $_SERVER[
"PHP_SELF"],
"d.datefin", $param,
"",
'', $sortfield, $sortorder,
'center ');
251 while ($i < $num && $i < $conf->liste_limit) {
252 $objp = $db->fetch_object($resql);
254 $datefin = $db->jdate($objp->datefin);
255 $memberstatic->id = $objp->rowid;
256 $memberstatic->ref = $objp->rowid;
257 $memberstatic->lastname = $objp->lastname;
258 $memberstatic->firstname = $objp->firstname;
259 $memberstatic->statut = $objp->statut;
260 $memberstatic->datefin = $db->jdate($objp->datefin);
262 $companyname = $objp->company;
264 print
'<tr class="oddeven">';
268 print $memberstatic->getNomUrl(1);
272 print
"<td><a href=\"card.php?rowid=$objp->rowid\">";
273 print ((!empty($objp->lastname) || !empty($objp->firstname)) ?
dol_trunc($memberstatic->getFullName($langs)) :
'');
274 print (((!empty($objp->lastname) || !empty($objp->firstname)) && !empty($companyname)) ?
' / ' :
'');
275 print (!empty($companyname) ?
dol_trunc($companyname, 32) :
'');
279 print
"<td>".$objp->login.
"</td>\n";
282 $membertypestatic->id = $objp->type_id;
283 $membertypestatic->libelle = $objp->type;
284 $membertypestatic->label = $objp->type;
286 print
'<td class="nowrap">';
287 print $membertypestatic->getNomUrl(1, 32);
291 print
"<td>".$memberstatic->getmorphylib($objp->morphy).
"</td>\n";
294 print
"<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
297 print
'<td class="nowrap">';
298 print $memberstatic->LibStatut($objp->statut, $objp->subscription, $datefin, 2);
303 print
'<td class="center nowrap">';
305 if ($memberstatic->hasDelay()) {
306 print
" ".img_warning($langs->trans(
"SubscriptionLate"));
310 print
'<td class="left nowrap">';
311 if (!empty($objp->subscription)) {
312 print $langs->trans(
"SubscriptionNotReceived");
313 if ($objp->statut > 0) {
314 print
" ".img_warning();
331 print
"ErrorRecordNotFound";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
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)
Return array of tabs to used on pages for third parties cards.
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_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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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, $mode=0)
Check permissions of a user to show a page and an object.