From 8053321f7bb0769c2463307f00381ca33f229653 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Feb 2007 20:54:00 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20fleches=20navigation=20suivant/p?= =?UTF-8?q?r=E9c=E9dent=20dans=20fiches=20adh=E9rents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/adherents/adherent.class.php | 35 +++++++++++++++++++++++++ htdocs/adherents/card_subscriptions.php | 19 +++++++++++--- htdocs/adherents/fiche.php | 13 +++++++-- htdocs/adherents/ldap.php | 11 +++++++- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 35c468eb7c2..68158abadd9 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1707,6 +1707,41 @@ class Adherent } } + /** + * \brief Charge les propriétés id_previous et id_next + * \param filter filtre + * \return int <0 si ko, >0 si ok + */ + function load_previous_next_id($filter='') + { + $sql = "SELECT MAX(rowid)"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent"; + $sql.= " WHERE rowid < '".addslashes($this->id)."'"; + if (isset($filter)) $sql.=" AND ".$filter; + $result = $this->db->query($sql) ; + if (! $result) + { + $this->error=$this->db->error(); + return -1; + } + $row = $this->db->fetch_row($result); + $this->id_previous = $row[0]; + + $sql = "SELECT MIN(rowid)"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent"; + $sql.= " WHERE rowid > '".addslashes($this->id)."'"; + if (isset($filter)) $sql.=" AND ".$filter; + $result = $this->db->query($sql) ; + if (! $result) + { + $this->error=$this->db->error(); + return -2; + } + $row = $this->db->fetch_row($result); + $this->id_next = $row[0]; + } + + /** * \brief Initialise le membre avec valeurs fictives aléatoire */ diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 1821f84d411..f6a4403d2fd 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -183,11 +183,21 @@ $head = member_prepare_head($adh); dolibarr_fiche_head($head, 'subscription', $langs->trans("Member")); +$result=$adh->load_previous_next_id($adh->next_prev_filter); +if ($result < 0) dolibarr_print_error($db,$adh->error); +$previous_id = $adh->id_previous?''.img_previous().'':''; +$next_id = $adh->id_next?''.img_next().'':''; + print '
'; print ''; // Ref -print ''; +print ''; +print ''; // Nom print ''; @@ -219,8 +229,8 @@ print "\n"; */ print '
'; -// Lien nouvelle cotisation -if ($action != 'addsubscription') +// Lien nouvelle cotisation si non brouillon et non résilié +if ($action != 'addsubscription' && $adh->statut > 0) { print "".$langs->trans("NewSubscription").""; } @@ -331,7 +341,8 @@ if ($adh->datefin) } else { - print $langs->trans("SubscriptionNotReceived")." ".img_warning($langs->trans("Late")); + print $langs->trans("SubscriptionNotReceived"); + if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non résilié } print ''; print '
'; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index e8a58d19d2c..f7e50ac9367 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -734,7 +734,6 @@ if ($action == 'create') } - if ($rowid && $action != 'edit') { /* ************************************************************************** */ @@ -762,6 +761,11 @@ if ($rowid && $action != 'edit') dolibarr_fiche_head($head, 'general', $langs->trans("Member")); + $result=$adh->load_previous_next_id($adh->next_prev_filter); + if ($result < 0) dolibarr_print_error($db,$adh->error); + $previous_id = $adh->id_previous?''.img_previous().'':''; + $next_id = $adh->id_next?''.img_next().'':''; + // Confirmation de la suppression de l'adhérent if ($action == 'delete') { @@ -832,7 +836,12 @@ if ($rowid && $action != 'edit') print '
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Ref").''; +if ($previous_id || $next_id) print '
'; +print $adh->id; +if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.'
'; +print '
'.$langs->trans("Lastname").''.$adh->nom.' 
'; // Ref - print ''; + print ''; + print ''; // Nom print ''; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 946b28cb058..7144e1c9d1e 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -85,6 +85,10 @@ $head = member_prepare_head($adh); dolibarr_fiche_head($head, 'ldap', $langs->trans("Member")); +$result=$adh->load_previous_next_id($adh->next_prev_filter); +if ($result < 0) dolibarr_print_error($db,$adh->error); +$previous_id = $adh->id_previous?''.img_previous().'':''; +$next_id = $adh->id_next?''.img_next().'':''; /* @@ -93,7 +97,12 @@ dolibarr_fiche_head($head, 'ldap', $langs->trans("Member")); print '
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Ref").''; + if ($previous_id || $next_id) print '
'; + print $adh->id; + if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.'
'; + print '
'.$langs->trans("Lastname").''.$adh->nom.' 
'; // Ref -print ''; +print ''; +print ''; // Nom print '';
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Ref").''; +if ($previous_id || $next_id) print '
'; +print $adh->id; +if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.'
'; +print '
'.$langs->trans("Lastname").''.$adh->nom.'