27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
 
   35   public $boxcode = 
"box_members_last_subscriptions";
 
   36   public $boximg = 
"object_user";
 
   37   public $boxlabel = 
"BoxLastMembersSubscriptions";
 
   38   public $depends = array(
"adherent");
 
   48   public $info_box_head = array();
 
   49   public $info_box_contents = array();
 
   65     $listofmodulesforexternal = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
 
   66     if (!in_array(
'adherent', $listofmodulesforexternal) && !empty($user->socid)) {
 
   70     $this->hidden = !(
isModEnabled(
'adherent') && $user->rights->adherent->lire);
 
   81     global $user, $langs, $conf;
 
   82     $langs->load(
"boxes");
 
   86     include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
 
   87     require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
 
   88     require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
 
   93     $this->info_box_head = array(
'text' => $langs->trans(
"LastSubscriptionsModified", $max));
 
   95     if ($user->rights->adherent->lire) {
 
   96       $sql = 
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
 
   97       $sql .= 
" a.gender, a.email, a.photo, a.morphy,";
 
   98       $sql .= 
" a.datefin as date_end_subscription,";
 
   99       $sql .= 
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
 
  100       $sql .= 
" c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
 
  101       $sql .= 
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta, ".MAIN_DB_PREFIX.
"subscription as c";
 
  102       $sql .= 
" WHERE a.entity IN (".getEntity(
'adherent').
")";
 
  103       $sql .= 
" AND a.fk_adherent_type = ta.rowid";
 
  104       $sql .= 
" AND c.fk_adherent = a.rowid";
 
  105       $sql .= $this->
db->order(
"c.tms", 
"DESC");
 
  106       $sql .= $this->
db->plimit($max, 0);
 
  108       $result = $this->
db->query($sql);
 
  110         $num = $this->
db->num_rows($result);
 
  113         while ($line < $num) {
 
  114           $obj = $this->
db->fetch_object($result);
 
  115           $staticmember->id = $obj->rowid;
 
  116           $staticmember->ref = $obj->rowid;
 
  117           $staticmember->lastname = $obj->lastname;
 
  118           $staticmember->firstname = $obj->firstname;
 
  119           $staticmember->gender = $obj->gender;
 
  120           $staticmember->email = $obj->email;
 
  121           $staticmember->photo = $obj->photo;
 
  122           $staticmember->morphy = $obj->morphy;
 
  123           $staticmember->statut = $obj->status;
 
  124           $staticmember->need_subscription = $obj->need_subscription;
 
  125           $staticmember->datefin = $this->
db->jdate($obj->date_end_subscription);
 
  126           if (!empty($obj->fk_soc)) {
 
  127             $staticmember->fk_soc = $obj->fk_soc;
 
  128             $staticmember->fetch_thirdparty();
 
  129             $staticmember->name = $staticmember->thirdparty->name;
 
  131             $staticmember->name = $obj->company;
 
  134           $subscriptionstatic->id = $obj->cid;
 
  135           $subscriptionstatic->ref = $obj->cid;
 
  137           $this->info_box_contents[$line][] = array(
 
  138             'td' => 
'class="tdoverflowmax100 maxwidth100onsmartphone"',
 
  139             'text' => $subscriptionstatic->getNomUrl(1),
 
  143           $this->info_box_contents[$line][] = array(
 
  144             'td' => 
'class="tdoverflowmax150 maxwidth150onsmartphone"',
 
  145             'text' => $staticmember->getNomUrl(-1, 32, 
'card'),
 
  149           $this->info_box_contents[$line][] = array(
 
  150             'td' => 
'class="tdoverflowmax150 maxwidth150onsmartphone"',
 
  151             'text' => 
get_date_range($this->
db->jdate($obj->date_start), $this->db->jdate($obj->date_end)),
 
  154           $this->info_box_contents[$line][] = array(
 
  155             'td' => 
'class="nowraponall right amount" width="18"',
 
  156             'text' => 
price($obj->subscription),
 
  159           $this->info_box_contents[$line][] = array(
 
  160             'td' => 
'class="right tdoverflowmax150 maxwidth150onsmartphone"',
 
  161             'text' => 
dol_print_date($this->
db->jdate($obj->datem ? $obj->datem : $obj->datec), 
'dayhour', 
'tzuserrel'),
 
  168           $this->info_box_contents[$line][0] = array(
 
  169             'td' => 
'class="center"',
 
  170             'text'=>$langs->trans(
"NoRecordedCustomers"),
 
  174         $this->
db->free($result);
 
  176         $this->info_box_contents[0][0] = array(
 
  179           'text' => ($this->
db->error().
' sql='.$sql),
 
  183       $this->info_box_contents[0][0] = array(
 
  184         'td' => 
'class="nohover opacitymedium left"',
 
  185         'text' => $langs->trans(
"ReadPermissionNotAllowed")
 
  198   public function showBox($head = 
null, $contents = 
null, $nooutput = 0)
 
  200     return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
 
Class to manage members of a foundation.
 
Class to manage members type.
 
Class to manage subscriptions of foundation members.
 
Class to manage the box to show last modofied members.
 
loadBox($max=5)
Load data into info_box_contents array to show array later.
 
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
 
__construct($db, $param='')
Constructor.
 
get_date_range($date_start, $date_end, $format='', $outputlangs='', $withparenthesis=1)
Format output for start and end date.
 
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
isModEnabled($module)
Is Dolibarr module enabled.
 
$conf db
API class for accounts.