diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php
index ba483b29fb2..67cdeb67575 100644
--- a/htdocs/adherents/adherent.class.php
+++ b/htdocs/adherents/adherent.class.php
@@ -790,12 +790,11 @@ class Adherent
$acct=new Account($this->db,$accountid);
$dateop=strftime("%Y%m%d",time());
- $amount=$cotisation;
- $insertid=$acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user);
+ $insertid=$acct->addline($dateop, $operation, $label, $montant, $num_chq, '', $user);
if ($insertid > 0)
{
- $inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adh->getFullname(), 'member');
+ $inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $this->getFullname(), 'member');
if ($inserturlid > 0)
{
// Met a jour la table cotisation
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 27adbb7f12d..930d5ae119f 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -73,7 +73,7 @@ if ($_POST["action"] == 'cotisation')
$reday=$_POST["reday"];
$remonth=$_POST["remonth"];
$reyear=$_POST["reyear"];
- $datecotisation=@mktime(12, 0 , 0, $remonth, $reday, $reyear);
+ $datecotisation=@mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$cotisation=$_POST["cotisation"];
$accountid=$_POST["accountid"];
@@ -88,12 +88,19 @@ if ($_POST["action"] == 'cotisation')
$action='';
}
- if (! $cotisation > 0)
+ if (! $_POST["cotisation"] > 0)
{
$errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
$action='';
}
-
+ if ($conf->global->ADHERENT_BANK_USE)
+ {
+ if (! $_POST["accountid"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("FinancialAccount"));
+ if (! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("PaymentMode"));
+ if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("Label"));
+ if ($errmsg) $action='';
+ }
+
if ($action)
{
$db->begin();
@@ -109,6 +116,12 @@ if ($_POST["action"] == 'cotisation')
{
$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
}
+
+ $_POST["cotisation"]='';
+ $_POST["accountid"]='';
+ $_POST["operation"]='';
+ $_POST["label"]='';
+ $_POST["num_chq"]='';
}
else
{
@@ -616,7 +629,8 @@ if ($action == 'create')
// Type
print '
| '.$langs->trans("MemberType").'* | ';
$listetype=$adht->liste_array();
- if (sizeof($listetype)) {
+ if (sizeof($listetype))
+ {
$htmls->select_array("type", $listetype, $typeid);
} else {
print ''.$langs->trans("NoTypeDefinedGoToSetup").'';
@@ -664,7 +678,8 @@ if ($action == 'create')
// Url photo
print ' |
| Url photo | |
';
- foreach($adho->attribute_label as $key=>$value){
+ foreach($adho->attribute_label as $key=>$value)
+ {
print "| $value | |
\n";
}
@@ -961,7 +976,7 @@ if ($rowid && $action != 'edit')
print '';
print '';
- print '| ';
+ print ' | ';
/*
@@ -969,14 +984,20 @@ if ($rowid && $action != 'edit')
*
*/
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
- $sql.= " c.rowid as crowid, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
+ $sql.= " c.rowid as crowid, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank,";
+ $sql.= " ba.rowid as baid, ba.label, ba.bank";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $cotisationstatic=new Cotisation($db);
+ $accountstatic=new Account($db);
+
+ $num = $db->num_rows($result);
$i = 0;
print "\n";
@@ -984,7 +1005,11 @@ if ($rowid && $action != 'edit')
print '';
print '| '.$langs->trans("Ref").' | ';
print ''.$langs->trans("DateSubscription").' | ';
- print "".$langs->trans("Amount")." | \n";
+ print ''.$langs->trans("Amount").' | ';
+ if ($conf->global->ADHERENT_BANK_USE)
+ {
+ print ''.$langs->trans("Account").' | ';
+ }
print " \n";
$var=True;
@@ -993,12 +1018,26 @@ if ($rowid && $action != 'edit')
$objp = $db->fetch_object($result);
$var=!$var;
print "";
- $cotisation=new Cotisation($db);
- $cotisation->ref=$objp->crowid;
- $cotisation->id=$objp->crowid;
- print '| '.$cotisation->getNomUrl(1).' | ';
+ $cotisationstatic->ref=$objp->crowid;
+ $cotisationstatic->id=$objp->crowid;
+ print ''.$cotisationstatic->getNomUrl(1).' | ';
print "".dolibarr_print_date($objp->dateadh)." | \n";
print ''.price($objp->cotisation).' | ';
+ if ($conf->global->ADHERENT_BANK_USE)
+ {
+ print '';
+ if ($objp->fk_bank)
+ {
+ $accountstatic->label=$objp->label;
+ $accountstatic->id=$objp->baid;
+ print $accountstatic->getNomUrl(1);
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' | ';
+ }
print " ";
$i++;
}
@@ -1009,7 +1048,7 @@ if ($rowid && $action != 'edit')
dolibarr_print_error($db);
}
- print '';
+ print ' | ';
/*
@@ -1018,14 +1057,15 @@ if ($rowid && $action != 'edit')
if ($user->rights->adherent->cotisation->creer)
{
print "\n\n\n";
+
print '';
+
print "\n\n\n";
}
| |