* \brief Page of members events */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php'; $langs->load("companies"); $langs->load("members"); $id = GETPOST('id', 'int'); // Security check $result = restrictedArea($user, 'adherent', $id); $object = new Adherent($db); $result = $object->fetch($id); if ($result > 0) { $object->fetch_thirdparty(); $adht = new AdherentType($db); $result = $adht->fetch($object->typeid); } /* * Actions */ // None /* * View */ $contactstatic = new Contact($db); $form = new Form($db); /* * Fiche categorie de client et/ou fournisseur */
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); $this->max = $max; include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $memberstatic = new Adherent($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max)); if ($user->rights->adherent->lire) { $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; $sql .= " t.cotisation"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a, " . MAIN_DB_PREFIX . "adherent_type as t"; $sql .= " WHERE a.entity = " . $conf->entity; $sql .= " AND a.fk_adherent_type = t.rowid"; $sql .= " ORDER BY a.tms DESC"; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $memberstatic->lastname = $objp->lastname; $memberstatic->firstname = $objp->firstname; if (!empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; $memberstatic->fetch_thirdparty(); $memberstatic->name = $memberstatic->thirdparty->name; } else { $memberstatic->name = $objp->company; } $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $memberstatic->LibStatut($objp->status, $objp->cotisation, $db->jdate($objp->date_end_subscription), 3)); $i++; } if ($num == 0) { $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedCustomers")); } $db->free($result); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
print ' '; print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; print '</td>'; print "</tr>\n"; print '</form>'; $var = True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($resql); $datefin = $db->jdate($objp->datefin); $memberstatic->id = $objp->rowid; $memberstatic->ref = $objp->rowid; $memberstatic->lastname = $objp->lastname; $memberstatic->firstname = $objp->firstname; if (!empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; $memberstatic->fetch_thirdparty(); $companyname = $memberstatic->thirdparty->name; } else { $companyname = $objp->company; } $var = !$var; print "<tr " . $bc[$var] . ">"; // Ref print "<td>"; print $memberstatic->getNomUrl(1); print "</td>\n"; // Lastname print "<td><a href=\"card.php?rowid={$objp->rowid}\">"; print !empty($objp->lastname) || !empty($objp->firstname) ? dol_trunc($memberstatic->getFullName($langs)) : ''; print (!empty($objp->lastname) || !empty($objp->firstname)) && !empty($companyname) ? ' / ' : ''; print !empty($companyname) ? dol_trunc($companyname, 32) : '';
print '<tr class="liste_titre">'; print '<td colspan="4">' . $langs->trans("LastMembersModified", $max) . '</td></tr>'; $num = $db->num_rows($resql); if ($num) { $i = 0; $var = True; while ($i < $num) { $var = !$var; $obj = $db->fetch_object($resql); print "<tr " . $bc[$var] . ">"; $staticmember->id = $obj->rowid; $staticmember->lastname = $obj->lastname; $staticmember->firstname = $obj->firstname; if (!empty($obj->fk_soc)) { $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); $staticmember->name = $staticmember->thirdparty->name; } else { $staticmember->name = $obj->company; } $staticmember->ref = $staticmember->getFullName($langs); $statictype->id = $obj->typeid; $statictype->libelle = $obj->libelle; print '<td>' . $staticmember->getNomUrl(1, 32) . '</td>'; print '<td>' . $statictype->getNomUrl(1, 32) . '</td>'; print '<td>' . dol_print_date($db->jdate($obj->datem), 'dayhour') . '</td>'; print '<td align="right">' . $staticmember->LibStatut($obj->statut, $obj->cotisation == 'yes' ? 1 : 0, $db->jdate($obj->date_end_subscription), 5) . '</td>'; print '</tr>'; $i++; } }