diff --git a/ChangeLog b/ChangeLog index 323ac630b53..c4a4cc46152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ $Id$ ***** ChangeLog for 3.1 compared to 3.0 ***** For users: +- New: Add box last members for foundation module. - New: Can add a discount for third party, during invoice edition. - New: A specialized menu is now used when using smartphones. - New: Can add information on current user on odt generation diff --git a/htdocs/includes/boxes/box_members.php b/htdocs/includes/boxes/box_members.php new file mode 100755 index 00000000000..2b04d7bd336 --- /dev/null +++ b/htdocs/includes/boxes/box_members.php @@ -0,0 +1,125 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/includes/boxes/box_clients.php + * \ingroup societes + * \brief Module de generation de l'affichage de la box clients + * \version $Id$ + */ + +include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); + + +class box_members extends ModeleBoxes { + + var $boxcode="lastmembers"; + var $boximg="object_user"; + var $boxlabel; + var $depends = array("adherent"); + + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_members() + { + global $langs; + $langs->load("boxes"); + + $this->boxlabel=$langs->trans("BoxLastMembers"); + } + + /** + * Load data of box into memory for a future usage + * @param $max Maximum number of records to show + */ + function loadBox($max=5) + { + global $user, $langs, $db, $conf; + $langs->load("boxes"); + + $this->max=$max; + + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max)); + + if ($user->rights->societe->lire) + { + $sql = "SELECT s.rowid, s.nom, s.prenom, s.datec, s.tms"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent as s"; + $sql.= " WHERE s.entity = ".$conf->entity; + $sql.= " ORDER BY s.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); + + $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' => $objp->nom, + '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")); + + $i++; + } + + if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers")); + } + 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")); + } + + } + + function showBox() + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } + +} + +?> diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php index b8fbce46a89..3f9c95c7c61 100644 --- a/htdocs/includes/modules/modAdherent.class.php +++ b/htdocs/includes/modules/modAdherent.class.php @@ -105,6 +105,8 @@ class modAdherent extends DolibarrModules // Boites //------- $this->boxes = array(); + $r=0; + $this->boxes[$r][1] = "box_members.php"; // Permissions //------------ diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index d212162b723..912cfed63c3 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -15,6 +15,7 @@ BoxLastCustomerOrders=Last customer orders BoxLastBooks=Last books BoxLastActions=Last actions BoxLastContracts=Last contracts +BoxLastMembers=Last members BoxCurrentAccounts=Current accounts balance BoxSalesTurnover=Sales turnover BoxTotalUnpaidCustomerBills=Total unpaid customer's invoices @@ -35,6 +36,7 @@ BoxTitleLastSupplierBills=Last %s supplier's invoices BoxTitleLastProspects=Last %s recorded prospects BoxTitleLastModifiedProspects=Last %s modified prospects BoxTitleLastProductsInContract=Last %s products/services in a contract +BoxTitleLastModifiedMembers=Last %s modified members BoxTitleOldestUnpaidCustomerBills=Oldest %s unpaid customer's invoices BoxTitleOldestUnpaidSupplierBills=Oldest %s unpaid supplier's invoices BoxTitleCurrentAccounts=Current account's balances diff --git a/htdocs/langs/fr_FR/boxes.lang b/htdocs/langs/fr_FR/boxes.lang index 929a4826c27..efa386120c4 100644 --- a/htdocs/langs/fr_FR/boxes.lang +++ b/htdocs/langs/fr_FR/boxes.lang @@ -16,6 +16,7 @@ BoxLastBooks=Derniers livres BoxLastActions=Derniers événements BoxLastContracts=Derniers contrats BoxLastContacts=Derniers contacts/adresses +BoxLastMembers=Derniers adhérents modifiés BoxCurrentAccounts=Soldes Comptes courants BoxSalesTurnover=Chiffre d'affaire BoxTotalUnpaidCustomerBills=Total des factures clients impayées @@ -43,6 +44,7 @@ BoxTitleSalesTurnover=Le chiffre d'affaire réalisé BoxTitleTotalUnpaidCustomerBills=Impayés clients BoxTitleTotalUnpaidSuppliersBills=Impayés fournisseurs BoxTitleLastModifiedContacts=Les %s derniers contacts/adresses modifiés +BoxTitleLastModifiedMembers=Les %s derniers adhérents modifiés BoxMyLastBookmarks=Mes %s derniers marque-pages FailedToRefreshDataInfoNotUpToDate=Échec du rafraichissement du flux RSS. Date du dernier rafraichissement: %s LastRefreshDate=Date dernier rafraichissement