diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 8bae02f88c3..96c99a03b52 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1000,18 +1000,18 @@ class Adherent extends CommonObject } /** - \brief Fonction qui insere la cotisation dans la base de donnees - et eventuellement liens dans banques, mailman, etc... - \param date Date d'effet de la cotisation - \param montant Montant cotisation (accepte 0 pour les adherents non soumis e cotisation) - \param account_id Id compte bancaire - \param operation Type operation (si Id compte bancaire fourni) - \param label Label operation (si Id compte bancaire fourni) - \param num_chq Numero cheque (si Id compte bancaire fourni) - \param emetteur_nom Nom emetteur cheque - \param emetteur_banque Nom banque emetteur cheque - \param datesubend Date fin adhesion - \return int rowid de l'entree ajoutee, <0 si erreur + * \brief Fonction qui insere la cotisation dans la base de donnees + * et eventuellement liens dans banques, mailman, etc... + * \param date Date d'effet de la cotisation + * \param montant Montant cotisation (accepte 0 pour les adherents non soumis e cotisation) + * \param account_id Id compte bancaire + * \param operation Type operation (si Id compte bancaire fourni) + * \param label Label operation (si Id compte bancaire fourni) + * \param num_chq Numero cheque (si Id compte bancaire fourni) + * \param emetteur_nom Nom emetteur cheque + * \param emetteur_banque Nom banque emetteur cheque + * \param datesubend Date fin adhesion + * \return int rowid de l'entree ajoutee, <0 si erreur */ function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) { diff --git a/htdocs/adherents/adherent_type.class.php b/htdocs/adherents/adherent_type.class.php index 76ef4d06973..8d924454930 100644 --- a/htdocs/adherents/adherent_type.class.php +++ b/htdocs/adherents/adherent_type.class.php @@ -18,71 +18,71 @@ */ /** - \file htdocs/adherents/adherent_type.class.php - \ingroup adherent - \brief Fichier de la classe gérant les types d'adhérents - \author Rodolphe Quiedeville - \version $Id$ -*/ + \file htdocs/adherents/adherent_type.class.php + \ingroup adherent + \brief Fichier de la classe gérant les types d'adhérents + \author Rodolphe Quiedeville + \version $Id$ + */ require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); /** - \class AdherentType - \brief Classe gérant les types d'adhérents -*/ + \class AdherentType + \brief Classe gérant les types d'adhérents + */ class AdherentType extends CommonObject { - var $error; - var $errors=array(); - var $db; - var $table_element = 'adherent_type'; + var $error; + var $errors=array(); + var $db; + var $table_element = 'adherent_type'; + + var $id; + var $libelle; + var $statut; + var $cotisation; /**< Soumis à la cotisation */ + var $vote; /**< droit de vote ? */ + var $note; /**< commentaire */ + var $mail_valid; /**< mail envoye lors de la validation */ - var $id; - var $libelle; - var $statut; - var $cotisation; /**< Soumis à la cotisation */ - var $vote; /**< droit de vote ? */ - var $note; /**< commentaire */ - var $mail_valid; /**< mail envoye lors de la validation */ - /** - \brief AdherentType - \param DB handler accès base de données - */ - function AdherentType($DB) - { - $this->db = $DB ; - $this->statut = 1; - } + \brief AdherentType + \param DB handler accès base de données + */ + function AdherentType($DB) + { + $this->db = $DB ; + $this->statut = 1; + } -/** + /** \brief print_error_list -*/ + */ function print_error_list() - { - $num = sizeof($this->error); - for ($i = 0 ; $i < $num ; $i++) - { - print "
  • " . $this->error[$i]; - } - } + { + $num = sizeof($this->error); + for ($i = 0 ; $i < $num ; $i++) + { + print "
  • " . $this->error[$i]; + } + } /** - \brief Fonction qui permet de créer le status de l'adhérent - \param userid userid de l'adhérent - \return > 0 si ok, < 0 si ko - */ + \brief Fonction qui permet de créer le status de l'adhérent + \param userid userid de l'adhérent + \return > 0 si ok, < 0 si ko + */ function create($userid) { $this->statut=trim($this->statut); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (libelle)"; $sql.= " VALUES ('".addslashes($this->libelle)."')"; @@ -101,71 +101,70 @@ class AdherentType extends CommonObject } -/** + /** \brief Met a jour en base données du type \return > 0 si ok, < 0 si ko -*/ - function update() - { - $this->libelle=trim($this->libelle); - - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; - $sql.= "SET "; - $sql.= "statut=".$this->statut.","; - $sql.= "libelle = '".addslashes($this->libelle) ."',"; - $sql.= "cotisation='".$this->cotisation."',"; - $sql.= "note='".addslashes($this->note)."',"; - $sql.= "vote='".$this->vote."',"; - $sql.= "mail_valid='".addslashes($this->mail_valid)."'"; - - $sql .= " WHERE rowid = $this->id"; - - $result = $this->db->query($sql); - - if ($result) + */ + function update() { + $this->libelle=trim($this->libelle); + + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; + $sql.= "SET "; + $sql.= "statut=".$this->statut.","; + $sql.= "libelle = '".addslashes($this->libelle) ."',"; + $sql.= "cotisation='".$this->cotisation."',"; + $sql.= "note='".addslashes($this->note)."',"; + $sql.= "vote='".$this->vote."',"; + $sql.= "mail_valid='".addslashes($this->mail_valid)."'"; + + $sql .= " WHERE rowid = $this->id"; + + $result = $this->db->query($sql); + + if ($result) + { return 1; - } - else - { + } + else + { $this->error=$this->db->error().' sql='.$sql; return -1; + } } - } - -/** - \brief Fonction qui permet de supprimer le status de l'adhérent - \param rowid -*/ + /** + * \brief Fonction qui permet de supprimer le status de l'adhérent + * \param rowid + */ function delete($rowid) - { + { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid"; - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) { - return 1; + return 1; } - else + else { - return 0; + return 0; } - } - else - { - print "Err : ".$this->db->error(); - return 0; - } - } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } /** \brief Fonction qui permet de récupérer le status de l'adhérent \param rowid \return int <0 si KO, >0 si OK - */ + */ function fetch($rowid) { $sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote"; @@ -179,7 +178,7 @@ class AdherentType extends CommonObject if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->libelle = $obj->libelle; @@ -198,58 +197,65 @@ class AdherentType extends CommonObject } } - + /** + * Return list of members' type + * + * @return array List of types + */ function liste_array() - { - $projets = array(); - - $sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."adherent_type"; - - if ($this->db->query($sql) ) { - $nump = $this->db->num_rows(); + $projets = array(); - if ($nump) - { - $i = 0; - while ($i < $nump) + $sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."adherent_type"; + + $resql=$this->db->query($sql); + if ($resql) { - $obj = $this->db->fetch_object(); + $nump = $this->db->num_rows($resql); - $projets[$obj->rowid] = $obj->libelle; - $i++; + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($resql); + + $projets[$obj->rowid] = $obj->libelle; + $i++; + } + } + return $projets; } - } - return $projets; - } - else - { - print $this->db->error(); + else + { + print $this->db->error(); + } + } - } - - /** + /** * \brief Renvoie nom clicable (avec eventuellement le picto) * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param maxlen Longueur max libelle + * \param option Page lien * \return string Chaine avec URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto=0,$maxlen=0) { global $langs; - + $result=''; $lien = ''; $lienfin=''; - + $picto='group'; - $label=$langs->trans("ShowType"); - + $label=$langs->trans("ShowTypeCard",$this->libelle); + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$lien.$this->libelle.$lienfin; + $result.=$lien.($maxlen?dolibarr_trunc($this->libelle,$maxlen):$this->libelle).$lienfin; return $result; } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index d74697dd304..4d0420aea84 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 @@ -16,16 +16,14 @@ * 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. - * - * $Id$ */ /** - \file htdocs/adherents/card_subscriptions.php - \ingroup adherent - \brief Onglet d'ajout, edition, suppression des adh�sions d'un adh�rent - \version $Revision$ -*/ + * \file htdocs/adherents/card_subscriptions.php + * \ingroup adherent + * \brief Onglet d'ajout, edition, suppression des adh�sions d'un adh�rent + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php"); @@ -54,7 +52,7 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; if (! $user->rights->adherent->cotisation->lire) - accessforbidden(); +accessforbidden(); /* @@ -63,50 +61,53 @@ if (! $user->rights->adherent->cotisation->lire) if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisation' && ! $_POST["cancel"]) { - $langs->load("banks"); + $langs->load("banks"); $adh->id = $rowid; - $result=$adh->fetch($rowid); + $result=$adh->fetch($rowid); $adht->fetch($adh->typeid); - $datecotisation=0; + // Subscription informations + $datecotisation=0; $datesubend=0; - if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) - { - $datecotisation=dolibarr_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - } - if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) - { - $datesubend=dolibarr_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - } - $cotisation=$_POST["cotisation"]; - - $accountid=$_POST["accountid"]; - $operation=$_POST["operation"]; + if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) + { + $datecotisation=dolibarr_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + } + if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) + { + $datesubend=dolibarr_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + } + $cotisation=$_POST["cotisation"]; // Amount of subscription $label=$_POST["label"]; - $num_chq=$_POST["num_chq"]; - $emetteur_nom=$_POST["chqemetteur"]; - $emetteur_banque=$_POST["chqbank"]; if (! $datecotisation) { $errmsg=$langs->trans("BadDateFormat"); - $action='addsubscription'; + $action='addsubscription'; } if (! $datesubend) { $datesubend=dolibarr_time_plus_duree(dolibarr_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d'); } + // Payment informations + $accountid=$_POST["accountid"]; + $operation=$_POST["operation"]; // Payment mode + $num_chq=$_POST["num_chq"]; + $emetteur_nom=$_POST["chqemetteur"]; + $emetteur_banque=$_POST["chqbank"]; + + if ($adht->cotisation) // Type adherent soumis a cotisation { - if (! is_numeric($_POST["cotisation"])) - { + if (! is_numeric($_POST["cotisation"])) + { // If field is '' or not a numeric value - $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); - $action='addsubscription'; - } + $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); + $action='addsubscription'; + } else { if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) @@ -125,37 +126,37 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio } } } - - if ($action=='cotisation') - { - $db->begin(); + + if ($action=='cotisation') + { + $db->begin(); $crowid=$adh->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); - - if ($crowid > 0) - { - $db->commit(); - // Envoi mail - if ($_POST["sendmail"]) - { - $result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,-1); + if ($crowid > 0) + { + $db->commit(); + + // Envoi mail + if ($_POST["sendmail"]) + { + $result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,-1); if ($result < 0) $errmsg=$adh->error; } - $_POST["cotisation"]=''; + $_POST["cotisation"]=''; $_POST["accountid"]=''; $_POST["operation"]=''; $_POST["label"]=''; $_POST["num_chq"]=''; - } - else - { - $db->rollback(); - $errmsg=$adh->error; + } + else + { + $db->rollback(); + $errmsg=$adh->error; $action = 'addsubscription'; - } - } + } + } } @@ -181,8 +182,8 @@ $adho->fetch_optionals(); /* -* Affichage onglets -*/ + * Affichage onglets + */ $head = member_prepare_head($adh); dolibarr_fiche_head($head, 'subscription', $langs->trans("Member")); @@ -227,15 +228,15 @@ if ($errmsg) $langs->load("errors"); $errmsg=$langs->trans($errmsg); } - print '
    '.$errmsg.'
    '; - print "\n"; + print '
    '.$errmsg.'
    '; + print "\n"; } /* -* Barre d'actions -* -*/ + * Barre d'actions + * + */ print '
    '; // Lien nouvelle cotisation si non brouillon et non r�sili� @@ -252,9 +253,9 @@ print "
    \n"; /* -* Bandeau des cotisations -* -*/ + * Bandeau des cotisations + * + */ print ''; @@ -263,9 +264,9 @@ print '\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + $cotisationstatic->ref=$objp->crowid; + $cotisationstatic->id=$objp->crowid; + print ''; + print '\n"; + print '\n"; + print ''; + if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) + { + print ''; + } + print ""; + $i++; + } + print "
    '; /* -* Liste des cotisations -* -*/ + * Liste des cotisations + * + */ $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; $sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " ".$db->pdate("c.dateadh")." as dateadh,"; @@ -281,60 +282,60 @@ $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; $result = $db->query($sql); if ($result) { -$cotisationstatic=new Cotisation($db); -$accountstatic=new Account($db); + $cotisationstatic=new Cotisation($db); + $accountstatic=new Account($db); -$num = $db->num_rows($result); -$i = 0; + $num = $db->num_rows($result); + $i = 0; -print "\n"; + print "
    \n"; -print ''; -print ''; -print ''; -print ''; -print ''; -if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) -{ - print ''; -} -print "\n"; - -$var=True; -while ($i < $num) -{ - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - $cotisationstatic->ref=$objp->crowid; - $cotisationstatic->id=$objp->crowid; - print ''; - print '\n"; - print '\n"; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) { - print ''; + print ''; } - print ""; - $i++; -} -print "
    '.$langs->trans("Ref").''.$langs->trans("DateSubscription").''.$langs->trans("DateEnd").''.$langs->trans("Amount").''.$langs->trans("Account").'
    '.$cotisationstatic->getNomUrl(1).''.dolibarr_print_date($objp->dateadh,'day')."'.dolibarr_print_date($objp->datef,'day')."'.price($objp->cotisation).'
    '.$langs->trans("Ref").''.$langs->trans("DateSubscription").''.$langs->trans("DateEnd").''.$langs->trans("Amount").''; - if ($objp->bid) - { - $accountstatic->label=$objp->label; - $accountstatic->id=$objp->baid; - print $accountstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''.$langs->trans("Account").'
    "; + print "
    '.$cotisationstatic->getNomUrl(1).''.dolibarr_print_date($objp->dateadh,'day')."'.dolibarr_print_date($objp->datef,'day')."'.price($objp->cotisation).''; + if ($objp->bid) + { + $accountstatic->label=$objp->label; + $accountstatic->id=$objp->baid; + print $accountstatic->getNomUrl(1); + } + else + { + print ' '; + } + print '
    "; } else { -dolibarr_print_error($db); + dolibarr_print_error($db); } print ''; @@ -366,10 +367,10 @@ print ''; print ''; print ''; - + /* -* Ajout d'une nouvelle cotisation -*/ + * Ajout d'une nouvelle cotisation + */ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer) { print '
    '; @@ -380,6 +381,7 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer) print ''; print "\n"; + // Title subscription print ''; $today=mktime(); @@ -422,42 +424,51 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer) if ($adht->cotisation) { + // Amount print ''; - if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) - { - print '\n"; - } - - print '\n"; - - print ''; - print ''; - - print ''; - print ''; - - print ''; - print ''; - + // Label print ''; print ''; - } + + // Bank account + if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) + { + // Title payments + print ''; + + // Bank account + print '\n"; + + // Payment mode + print '\n"; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + + } + } + print ''; print ''; // EMail - print ''; + print ''; // Date naissance print ''; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 850547f4088..b0f9948ee7b 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -88,6 +88,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update // Modifie valeures $subscription->dateh=dolibarr_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $subscription->datef=dolibarr_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); + $subscription->note=$_POST["note"]; $subscription->amount=$_POST["amount"]; //print 'datef='.$subscription->datef.' '.$_POST['datesubendday']; @@ -143,7 +144,7 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'confirm_d /* - * + * View */ llxHeader(); @@ -168,7 +169,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') ********************************************/ $subscription->fetch($rowid); - + $result=$adh->fetch($subscription->fk_adherent); + /* * Affichage onglets */ @@ -197,6 +199,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Ref print ''; + // Member + $adh->ref=$adh->fullname; + print ''; + print ''; + print ''; + // Date start subscription print ''; + // Label + print ''; + + if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) + { + print ''; + } + print ''; - - // Bank account + + // Amount + print ''; + + // Bank account if ($conf->banque->enabled) { if ($subscription->fk_bank) @@ -309,13 +333,17 @@ if ($rowid && $action != 'edit') $result=$bank->fetch($bankline->fk_account); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; } } + print "
    '.$langs->trans("NewCotisation").'
    '.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).'
    '.$langs->trans("FinancialAccount").''; - $html->select_comptes($_POST["accountid"],'accountid',0,'',1); - print "
    '.$langs->trans("PaymentMode").''; - $html->select_types_paiements($_POST["operation"],'operation'); - print "
    '.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; // \todo a traduire - print '
    '.$langs->trans('CheckTransmitter'); - print ' ('.$langs->trans("ChequeMaker").')'; // \todo a traduire - print '
    '.$langs->trans('Bank'); - print ' ('.$langs->trans("ChequeBank").')'; // \todo a traduire - print '
    '.$langs->trans("Label").'
    '.$langs->trans("Payment").'
    '.$langs->trans("FinancialAccount").''; + $html->select_comptes($_POST["accountid"],'accountid',0,'',1); + print "
    '.$langs->trans("PaymentMode").''; + $html->select_types_paiements($_POST["operation"],'operation'); + print "
    '.$langs->trans('Numero'); + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print '
    '.$langs->trans('CheckTransmitter'); + print ' ('.$langs->trans("ChequeMaker").')'; + print '
    '.$langs->trans('Bank'); + print ' ('.$langs->trans("ChequeBank").')'; + print '
    '.$langs->trans("SendAcknowledgementByMail").''; - if (! $adh->email) + if (! $adh->email) { print $langs->trans("NoEMail"); } diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index b912b98601a..c24c8502a13 100644 --- a/htdocs/adherents/cotisation.class.php +++ b/htdocs/adherents/cotisation.class.php @@ -152,12 +152,12 @@ class Cotisation extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET "; $sql .= " fk_adherent = ".$this->fk_adherent.","; - $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null').","; $sql .= " note=".($this->note ? "'".addslashes($this->note)."'" : 'null').","; $sql .= " cotisation = '".price2num($this->amount)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',"; - $sql .= " datec='".$this->db->idate($this->datec)."'"; + $sql .= " datec='".$this->db->idate($this->datec)."',"; + $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null'); $sql .= " WHERE rowid = ".$this->id; dolibarr_syslog("Cotisation::update sql=".$sql); diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index b4ca599226e..f4e7575cef1 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -935,7 +935,7 @@ if ($rowid && $action != 'edit') print '
    '.$langs->trans("PhoneMobile").''.$adh->phone_mobile.'
    '.$langs->trans("EMail").''.$adh->email.' 
    '.$langs->trans("EMail").''.dol_print_email($adh->email).' 
    '.$langs->trans("Birthday").''.dolibarr_print_date($adh->naiss,'day').' 
    '.$langs->trans("Ref").''.$subscription->ref.' 
    '.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').'
    '.$langs->trans("DateSubscription").''; $form->select_date($subscription->dateh,'datesub',1,1,0,'update',1); @@ -213,6 +221,19 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') print '
    '.$langs->trans("Amount").''; print '
    '.$langs->trans("Label").''; + print '
    '.$langs->trans("BankTransactionLine").''; + $bankline=new AccountLine($db); + $result=$bankline->fetch($subscription->fk_bank); + print $bankline->getNomUrl(1,0,'showall'); + print '
    '; print ''; print '       '; @@ -296,8 +317,11 @@ if ($rowid && $action != 'edit') // Amount print '
    '.$langs->trans("Amount").''.price($subscription->amount).'
    '.$langs->trans("Label").''.$subscription->note.'
    '.$langs->trans('BankAccount').''.$bank->getNomUrl(1).''.$langs->trans("BankLineConciliated").''.yn($bankline->rappro).''.$langs->trans('BankTransactionLine').''; + $bankline=new AccountLine($db); + $result=$bankline->fetch($subscription->fk_bank); + print $bankline->getNomUrl(1,0,'showall'); + print '
    \n"; print ''; diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index 2519911c3a5..ae47515aef8 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -19,14 +19,15 @@ */ /** - \file htdocs/adherents/liste.php - \ingroup adherent - \brief Page listant les adh�rents - \version $Id$ -*/ + * \file htdocs/adherents/liste.php + * \ingroup adherent + * \brief Page to list all members of fundation + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); $langs->load("members"); $langs->load("companies"); @@ -38,6 +39,10 @@ $langs->load("companies"); llxHeader(); +$form=new Form($db); + +$membertypestatic=new AdherentType($db); + $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; @@ -66,9 +71,9 @@ if ($sall) $sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'"; $sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')"; } -if ($_GET["type"]) +if ($_REQUEST["type"] > 0) { - $sql.=" AND t.rowid=".$_GET["type"]; + $sql.=" AND t.rowid=".$_REQUEST["type"]; } if (isset($_GET["statut"])) { @@ -111,10 +116,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= " ".$db->order($sortfield,$sortorder); $sql.= " ".$db->plimit($conf->liste_limit+1, $offset); -$result = $db->query($sql); -if ($result) +$resql = $db->query($sql); +if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); $i = 0; $titre=$langs->trans("MembersList"); @@ -131,9 +136,11 @@ if ($result) $titre=$langs->trans("MembersListQualified"); } - if ($_GET["type"]) { - $objp = $db->fetch_object($result); - $titre.=" (".$objp->type.")"; + if ($_REQUEST["type"] > 0) + { + $membertype=new AdherentType($db); + $result=$membertype->fetch($_REQUEST["type"]); + $titre.=" (".$membertype->libelle.")"; } $param=""; @@ -165,9 +172,12 @@ if ($result) print ''; print ''; - print ''; + print ''; - print ' '; + print ''; + $listetype=$membertypestatic->liste_array(); + $form->select_array("type", $listetype, $_REQUEST["type"], 1, 0, 0, 0, '', 0, 16); + print ''; print ' '; @@ -186,12 +196,7 @@ if ($result) $var=True; while ($i < $num && $i < $conf->liste_limit) { - if ($_GET["type"] && $i==0) - { - # Fetch deja fait - } else { - $objp = $db->fetch_object($result); - } + $objp = $db->fetch_object($resql); $adh=new Adherent($db); @@ -211,17 +216,21 @@ if ($result) print "".$objp->login."\n"; // Type - print ''.img_object($langs->trans("ShowType"),"group").' '.$objp->type.''; + print ''; + $membertypestatic->id=$objp->type_id; + $membertypestatic->libelle=$objp->type; + print $membertypestatic->getNomUrl(1,16); + print ''; // Moral/Physique print "".$adh->getmorphylib($objp->morphy)."\n"; // EMail - print "".$objp->email."\n"; + print "".dol_print_email($objp->email)."\n"; // Statut print ""; - print $adh->LibStatut($objp->statut,$objp->cotisation,$objp->datefin,4); + print $adh->LibStatut($objp->statut,$objp->cotisation,$objp->datefin,2); print ""; // Date fin cotisation diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index eefe51a120f..f63fe917dcf 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -756,6 +756,7 @@ class Account extends CommonObject */ class AccountLine { + var $error; var $db; var $rowid; @@ -766,8 +767,11 @@ class AccountLine var $amount; var $label; var $note; + var $fk_account; - + var $bank_account_label; + + /** * Constructeur */ @@ -788,11 +792,12 @@ class AccountLine */ function fetch($rowid) { - $sql = "SELECT datec, datev, dateo, amount, label, fk_account,"; - $sql.= " fk_user_author, fk_user_rappro,"; - $sql.= " fk_type, num_releve, num_chq, rappro, note"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE rowid = ".$rowid; + $sql = "SELECT b.datec, b.datev, b.dateo, b.amount, b.label as label, b.fk_account,"; + $sql.= " b.fk_user_author, b.fk_user_rappro,"; + $sql.= " b.fk_type, b.num_releve, b.num_chq, b.rappro, b.note,"; + $sql.= " ba.label as bank_account_label"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba"; + $sql.= " WHERE b.fk_account = ba.rowid AND b.rowid = ".$rowid; dolibarr_syslog("AccountLine::fetch sql=".$sql); $result = $this->db->query($sql); @@ -821,6 +826,8 @@ class AccountLine $this->num_chq = $obj->num_chq; $this->rappro = $obj->rappro; + + $this->bank_account_label = $obj->bank_account_label; } $this->db->free($result); return 1; @@ -955,7 +962,15 @@ class AccountLine } } - function getNomUrl($withpicto=0) + + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param maxlen Longueur max libelle + * \param option Option ('showall') + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$maxlen=0,$option='') { global $langs; @@ -966,6 +981,20 @@ class AccountLine if ($withpicto) $result.=($lien.img_object($langs->trans("ShowTransaction"),'account').$lienfin.' '); $result.=$lien.$this->rowid.$lienfin; + + if ($option == 'showall') + { + $result.=' ('; + $result.=$langs->trans("BankAccount").': '; + $accountstatic=new Account($this->db); + $accountstatic->id=$this->fk_account; + $accountstatic->label=$this->bank_account_label; + $result.=$accountstatic->getNomUrl(0).', '; + $result.=$langs->trans("BankLineConciliated").': '; + $result.=yn($this->rappro); + $result.=')'; + } + return $result; } } diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index 3ccc80c307e..52656313926 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2008 Laurent Destailleur * * 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 @@ -14,16 +14,13 @@ * 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. - * - * $Id$ - * $Source$ */ /** \file htdocs/compta/bank/info.php \ingroup banque \brief Onglet info d'une ecriture bancaire - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -57,7 +54,7 @@ $hselected = $h; $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans("LineRecord").": ".$line->ref); +dolibarr_fiche_head($head, $hselected, $langs->trans("LineRecord")); print '
    '; dolibarr_print_object_info($line); diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 346fa21d480..c032fd74282 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -20,10 +20,10 @@ */ /** - \file htdocs/compta/bank/ligne.php - \ingroup compta - \brief Page edition d'une ecriture bancaire - \version $Id$ + * \file htdocs/compta/bank/ligne.php + * \ingroup compta + * \brief Page edition d'une ecriture bancaire + * \version $Id$ */ require("./pre.inc.php"); @@ -90,7 +90,7 @@ if ($_POST["action"] == "update") { $objp = $db->fetch_object($result); if ($objp->rappro) - die ("Vous ne pouvez pas modifier une �criture d�j� rapproch�e"); + die ("Conciliation of a line already conciliated is not possible"); } $db->begin(); @@ -198,7 +198,7 @@ $head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$_GET["rowid"]; $head[$h][1] = $langs->trans("Info"); $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans('LineRecord').': '.$_GET["rowid"]); +dolibarr_fiche_head($head, $hselected, $langs->trans('LineRecord')); $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro,"; @@ -217,8 +217,8 @@ if ($result) // Confirmations if ($_GET["action"] == 'delete_categ') { - $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,$langs->trans("RemoveFromCategory"),$langs->trans("RemoveFromCategoryConfirm"),"confirm_delete_categ"); - print '
    '; + $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,$langs->trans("RemoveFromCategory"),$langs->trans("RemoveFromCategoryConfirm"),"confirm_delete_categ"); + print '
    '; } print ''; @@ -232,20 +232,23 @@ if ($result) $links=$acct->get_url($rowid); - // Tableau sur 4 colonne si deja rapproche, sinon sur 5 colonnes - + // Ref + print '"; + print ''; + print ''; + // Author print '"; if ($objp->fk_user_author) { - $author=new User($db,$objp->fk_user_author); - $author->fetch(); - print ''; + $author=new User($db,$objp->fk_user_author); + $author->fetch(); + print ''; } else { - print ''; + print ''; } print ""; @@ -267,14 +270,14 @@ if ($result) print ''; if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) { - print ''; + print ''; } else { - print ''; @@ -308,7 +311,7 @@ if ($result) print ''; - if (eregi('^\((.*)\)$',$objp->label,$reg)) - { - // Label g�n�rique car entre parenth�ses. On l'affiche en le traduisant - print $langs->trans($reg[1]); - } - else - { - print $objp->label; - } + print ''; @@ -397,14 +400,14 @@ if ($result) print ""; if (! $objp->rappro && $user->rights->banque->modifier) { - print '"; diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 38c1115a6ef..3eba329de7a 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -128,7 +128,7 @@ $head[$h][1] = $langs->trans("Info"); $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans("Payment").": ".$paiement->ref); +dolibarr_fiche_head($head, $hselected, $langs->trans("Payment")); /* * Confirmation de la suppression du paiement @@ -158,25 +158,6 @@ print '
    '.$langs->trans("Ref")."'.$objp->rowid.'
    '.$langs->trans("Author")."'; - print img_object($langs->trans("ShowUser"),'user').' '.$author->fullname.''; + print img_object($langs->trans("ShowUser"),'user').' '.$author->fullname.'  
    '.$langs->trans("DateOperation").''; - $html->select_date($objp->do,'dateo','','','','update'); - print ''; + $html->select_date($objp->do,'dateo','','','','update'); + print ''; - print dolibarr_print_date($objp->do); + print ''; + print dolibarr_print_date($objp->do); } print '
    '; + if (eregi('^\((.*)\)$',$objp->label,$reg)) + { + // Label g�n�rique car entre parenth�ses. On l'affiche en le traduisant + print $langs->trans($reg[1]); + } + else + { + print $objp->label; + } } print '
    ".$langs->trans("Amount")."'; - print ' '.$langs->trans("Currency".$conf->monnaie); - print ''; + print ''; + print ' '.$langs->trans("Currency".$conf->monnaie); + print ''; } else { - print ''; - print price($objp->amount); + print ''; + print price($objp->amount); } print "
    '; // Ref print ''; -// Bank account -if ($conf->banque->enabled) -{ - if ($paiement->bank_account) - { - $bankline=new AccountLine($db); - $bankline->fetch($paiement->bank_line); - - $bank=new Account($db); - $bank->fetch($bankline->fk_account); - - print ''; - print ''; - print ''; - print ''; - print ''; - } -} - // Date print ''; @@ -196,6 +177,23 @@ print ''; +// Bank account +if ($conf->banque->enabled) +{ + if ($paiement->bank_account) + { + $bankline=new AccountLine($db); + $bankline->fetch($paiement->bank_line); + + print ''; + print ''; + print ''; + print ''; + } +} + print '
    '.$langs->trans('Ref').''.$paiement->id.'
    '.$langs->trans('BankAccount').''.$bank->getNomUrl(1).''.$langs->trans("BankLineConciliated").''.yn($bankline->rappro).'
    '.$langs->trans('Date').''.dolibarr_print_date($paiement->date,'day').'
    '.$langs->trans('Amount').''.pr // Note print '
    '.$langs->trans('Note').''.nl2br($paiement->note).'
    '.$langs->trans('BankTransactionLine').''; + print $bankline->getNomUrl(1,0,'showall'); + print '
    '; diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index cab074b1041..b659a2aa759 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -55,7 +55,16 @@ $hselected = $h; $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans("Payment").": ".$paiement->ref); +dolibarr_fiche_head($head, $hselected, $langs->trans("Payment")); + +print ''; + +// Ref +print ''; + +print '
    '.$langs->trans('Ref').''.$paiement->id.'
    '; + +print '
    '; print '
    '; dolibarr_print_object_info($paiement); diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 96ea184fb89..10652319fc4 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2795,8 +2795,9 @@ class Form * \param optionType Type de l'option: 1 pour des fonctions javascript * \param option Valeur de l'option en fonction du type choisi * \param translate Traduire la valeur + * \param maxlen Length maximum for labels */ - function select_array($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $optionType=0, $option='', $translate=0) + function select_array($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $optionType=0, $option='', $translate=0, $maxlen=0) { global $langs; // \TODO Simplify optionType and option (only one should be necessary) @@ -2827,12 +2828,14 @@ class Form if ($key_in_label) { - $selectOptionValue = $key.' - '.($translate?$langs->trans($value):$value); + $newval=($translate?$langs->trans($value):$value); + $selectOptionValue = $key.' - '.($maxlen?dolibarr_trunc($newval,$maxlen):$newval); print $selectOptionValue; } else { - $selectOptionValue = ($translate?$langs->trans($value):$value); + $newval=($translate?$langs->trans($value):$value); + $selectOptionValue = ($maxlen?dolibarr_trunc($newval,$maxlen):$newval); if ($value == '' || $value == '-') { $selectOptionValue=' '; } print $selectOptionValue; } diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index cea31119d2e..155fbd1307f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -121,4 +121,5 @@ TransactionWithOtherAccount=Account transfert PaymentNumberUpdateSucceeded=Payment number updated succesfully PaymentNumberUpdateFailed=Payment number could not be updated PaymentDateUpdateSucceeded=Payment date update succesfully -PaymentDateUpdateFailed=Payment date could not be updated \ No newline at end of file +PaymentDateUpdateFailed=Payment date could not be updated +BankTransactionLine=Bank transaction \ No newline at end of file diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 78f2d502087..7d3c8240932 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -131,4 +131,4 @@ DescADHERENT_ETIQUETTE_TYPE=Labels format DescADHERENT_CARD_HEADER_TEXT=Text printed on top of member cards DescADHERENT_CARD_TEXT=Text printed on member cards DescADHERENT_CARD_FOOTER_TEXT=Text printed on bottom of member cards - +ShowTypeCard=Show type %s diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang index 926e19fa135..d0d01b9431e 100644 --- a/htdocs/langs/fr_FR/banks.lang +++ b/htdocs/langs/fr_FR/banks.lang @@ -121,4 +121,5 @@ TransactionWithOtherAccount=Transfert de compte PaymentNumberUpdateSucceeded=Numéro de paiement mis à jour PaymentNumberUpdateFailed=Impossible de mettre le numéro de paiement à jour PaymentDateUpdateSucceeded=Date de paiement mise à jour -PaymentDateUpdateFailed=Impossible de mettre la date de paiement à jour \ No newline at end of file +PaymentDateUpdateFailed=Impossible de mettre la date de paiement à jour +BankTransactionLine=Ecriture bancaire \ No newline at end of file diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index a2026950f26..46c6a629099 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -131,3 +131,4 @@ DescADHERENT_ETIQUETTE_TYPE=Format DescADHERENT_CARD_HEADER_TEXT=Texte imprimé sur le haut des cartes adhérents DescADHERENT_CARD_TEXT=Texte imprimé sur les cartes adhérents DescADHERENT_CARD_FOOTER_TEXT=Texte imprimé sur le bas des cartes adhérents +ShowTypeCard=Voir type %s \ No newline at end of file