29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35 $langs->loadLangs(array(
"orders",
"companies"));
39 $action =
GETPOST(
'action',
'aZ09');
40 $massaction =
GETPOST(
'massaction',
'alpha');
42 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
43 $sortfield =
GETPOST(
"sortfield",
'alpha');
44 $sortorder =
GETPOST(
"sortorder",
'alpha');
46 if (!$sortorder) $sortorder =
"ASC";
47 if (!$sortfield) $sortfield =
"s.nom";
48 if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) { $page = 0; }
49 $offset = $limit * $page;
50 $pageprev = $page - 1;
51 $pagenext = $page + 1;
54 if ($user->socid) $socid = $user->socid;
60 $hookmanager->initHooks(array(
'contactthirdparty',
'globalcard'));
67 if ($action ==
'addcontact' && $user->rights->societe->creer)
69 $result = $object->fetch($id);
71 if ($result > 0 && $id > 0)
75 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
80 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
83 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
85 $langs->load(
"errors");
86 $mesg =
'<div class="error">'.$langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType").
'</div>';
88 $mesg =
'<div class="error">'.$object->error.
'</div>';
94 elseif ($action ==
'swapstatut' && $user->rights->societe->creer)
96 if ($object->fetch($id))
98 $result = $object->swapContactStatus(
GETPOST(
'ligne'));
105 elseif ($action ==
'deletecontact' && $user->rights->societe->creer)
108 $result = $object->delete_contact($_GET[
"lineid"]);
112 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
131 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
132 llxHeader(
'', $langs->trans(
"ThirdParty"), $help_url);
135 $form =
new Form($db);
138 $contactstatic =
new Contact($db);
139 $userstatic =
new User($db);
148 if ($id > 0 || !empty($ref))
150 if ($object->fetch($id, $ref) > 0)
153 $soc->fetch($object->socid);
158 print '<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
159 print '<input type="hidden" name="token" value="'.newToken().
'">';
161 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
163 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
165 print '<div class="fichecenter">';
167 print '<div class="underbanner clearboth"></div>';
168 print '<table class="border centpercent">';
180 if (!empty($conf->global->SOCIETE_USEPREFIX))
182 print '<tr><td>'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
187 print '<tr><td class="titlefield">';
188 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
189 print $object->code_client;
190 $tmpcheck = $object->check_codeclient();
191 if ($tmpcheck != 0 && $tmpcheck != -5) {
192 print ' <font class="error">('.$langs->trans(
"WrongCustomerCode").
')</font>';
197 if ($object->fournisseur)
199 print '<tr><td class="titlefield">';
200 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
201 print $object->code_fournisseur;
202 $tmpcheck = $object->check_codefournisseur();
203 if ($tmpcheck != 0 && $tmpcheck != -5) {
204 print ' <font class="error">('.$langs->trans(
"WrongSupplierCode").
')</font>';
216 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
217 foreach ($dirtpls as $reldir)
224 if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire)
226 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
227 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
232 $langs->load(
"members");
233 $sql =
"SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
234 $sql .=
" d.datefin,";
235 $sql .=
" d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
236 $sql .=
" t.libelle as type, t.subscription";
237 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
238 $sql .=
", ".MAIN_DB_PREFIX.
"adherent_type as t";
239 $sql .=
" WHERE d.fk_soc = ".$id;
240 $sql .=
" AND d.fk_adherent_type = t.rowid";
243 $resql = $db->query($sql);
246 $num = $db->num_rows(
$resql);
252 $titre = $langs->trans(
"MembersListOfTiers");
257 print "<table class=\"noborder\" width=\"100%\">";
258 print '<tr class="liste_titre">';
270 while ($i < $num && $i < $conf->liste_limit)
272 $objp = $db->fetch_object(
$resql);
274 $datefin = $db->jdate($objp->datefin);
275 $memberstatic->id = $objp->rowid;
276 $memberstatic->ref = $objp->rowid;
277 $memberstatic->lastname = $objp->lastname;
278 $memberstatic->firstname = $objp->firstname;
279 $memberstatic->statut = $objp->statut;
280 $memberstatic->datefin = $db->jdate($objp->datefin);
282 $companyname = $objp->company;
284 print '<tr class="oddeven">';
288 print $memberstatic->getNomUrl(1);
292 print "<td><a href=\"card.php?rowid=$objp->rowid\">";
293 print ((!empty($objp->lastname) || !empty($objp->firstname)) ?
dol_trunc($memberstatic->getFullName($langs)) :
'');
294 print (((!empty($objp->lastname) || !empty($objp->firstname)) && !empty($companyname)) ?
' / ' :
'');
299 print "<td>".$objp->login.
"</td>\n";
302 $membertypestatic->id = $objp->type_id;
303 $membertypestatic->libelle = $objp->type;
304 $membertypestatic->label = $objp->type;
306 print '<td class="nowrap">';
307 print $membertypestatic->getNomUrl(1, 32);
311 print "<td>".$memberstatic->getmorphylib($objp->morphy).
"</td>\n";
314 print "<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
317 print '<td class="nowrap">';
318 print $memberstatic->LibStatut($objp->statut, $objp->subscription, $datefin, 2);
324 print '<td class="center nowrap">';
326 if ($memberstatic->hasDelay()) {
327 print " ".img_warning($langs->trans(
"SubscriptionLate"));
331 print '<td class="left nowrap">';
332 if ($objp->subscription ==
'yes')
334 print $langs->trans(
"SubscriptionNotReceived");
335 if ($objp->statut > 0)
print " ".img_warning();
351 print "ErrorRecordNotFound";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage members of a foundation.
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.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Class to manage members type.
print $_SERVER["PHP_SELF"]
Edit parameters.
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).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $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.
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.