diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 2ffc1e2c9fd..0104f8f36e8 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -366,7 +366,7 @@ class AdherentType extends CommonObject
$sql .= "libelle = '".$this->db->escape($this->label)."',";
$sql .= "morphy = '".$this->db->escape($this->morphy)."',";
$sql .= "subscription = '".$this->db->escape($this->subscription)."',";
- $sql .= "amount = '".$this->db->escape($this->amount)."',";
+ $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 11c0025dcc5..e820d0a0d23 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -198,8 +198,8 @@ foreach ($data as $val) {
//print '';
print '';
print '
'.$val['nb'].' | ';
- print ''.price(price2num($val['total'], 'MT'), 1).' | ';
- print ''.price(price2num($val['avg'], 'MT'), 1).' | ';
+ print ''.price(price2num($val['total'], 'MT'), 1).' | ';
+ print ''.price(price2num($val['avg'], 'MT'), 1).' | ';
print '';
$oldyear = $year;
}
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 6c4f63725e1..033592a9afc 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -71,7 +71,7 @@ $label = GETPOST("label", "alpha");
$morphy = GETPOST("morphy", "alpha");
$status = GETPOST("status", "int");
$subscription = GETPOST("subscription", "int");
-$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
+$amount = GETPOST('amount', 'alpha');
$duration_value = GETPOST('duration_value', 'int');
$duration_unit = GETPOST('duration_unit', 'alpha');
$vote = GETPOST("vote", "int");
@@ -119,7 +119,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$object->morphy = trim($morphy);
$object->status = (int) $status;
$object->subscription = (int) $subscription;
- $object->amount = $amount;
+ $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
@@ -166,12 +166,11 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->fetch($rowid);
$object->oldcopy = clone $object;
-
$object->label= trim($label);
$object->morphy = trim($morphy);
$object->status = (int) $status;
$object->subscription = (int) $subscription;
- $object->amount = $amount;
+ $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
@@ -306,7 +305,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
}
print '';
print ''.yn($objp->subscription).' | ';
- print ''.price($objp->amount).' | ';
+ print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).' | ';
print ''.yn($objp->vote).' | ';
print ''.$membertype->getLibStatut(5).' | ';
if ($user->rights->adherent->configurer) {
@@ -446,7 +445,7 @@ if ($rowid > 0) {
print '';
print '| '.$langs->trans("Amount").' | ';
- print price($object->amount);
+ print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
print ' |
';
print '| '.$langs->trans("VoteAllowed").' | ';
@@ -594,24 +593,24 @@ if ($rowid > 0) {
$titre .= " (".$membertype->label.")";
}
- $param = "&rowid=".$object->id;
+ $param = "&rowid=".urlencode($object->id);
if (!empty($status)) {
- $param .= "&status=".$status;
+ $param .= "&status=".urlencode($status);
}
if (!empty($search_lastname)) {
- $param .= "&search_lastname=".$search_lastname;
+ $param .= "&search_lastname=".urlencode($search_lastname);
}
if (!empty($search_firstname)) {
- $param .= "&search_firstname=".$search_firstname;
+ $param .= "&search_firstname=".urlencode($search_firstname);
}
if (!empty($search_login)) {
- $param .= "&search_login=".$search_login;
+ $param .= "&search_login=".urlencode($search_login);
}
if (!empty($search_email)) {
- $param .= "&search_email=".$search_email;
+ $param .= "&search_email=".urlencode($search_email);
}
if (!empty($filter)) {
- $param .= "&filter=".$filter;
+ $param .= "&filter=".urlencode($filter);
}
if ($sall) {
@@ -797,7 +796,9 @@ if ($rowid > 0) {
print ' |
';
print '| '.$langs->trans("Amount").' | ';
- print '';
+ print '';
print ' |
';
print '| '.$langs->trans("VoteAllowed").' | ';
|