diff --git a/ChangeLog b/ChangeLog
index ab698d84eb8..bde4f7417b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ $Id$
***** ChangeLog for 3.1 compared to 3.0 *****
For users:
+- New: Can edit note of payment.
- New: Login is not mandatory in member module.
- New: Reduce a step into supplier order workflow to save time (if user
has permission to approve, order is approved when order is validated).
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 67446d51795..31342f17436 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -24,12 +24,13 @@
* \brief File of class to manage payments of customers invoices
* \version $Id$
*/
+require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
/** \class Paiement
* \brief Classe permettant la gestion des paiements des factures clients
*/
-class Paiement
+class Paiement extends CommonObject
{
var $db;
var $error;
@@ -65,9 +66,9 @@ class Paiement
}
/**
- * \brief Recupere l'objet paiement
- * \param id id du paiement a recuperer
- * \return int <0 si ko, 0 si non trouve, >0 si ok
+ * Load payment from database
+ * @param id id of payment to get
+ * @return int <0 if KO, 0 if not found, >0 if OK
*/
function fetch($id)
{
@@ -216,10 +217,10 @@ class Paiement
/**
- * \brief Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
- * Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
- * Si le paiement porte sur au moins une facture a "payee", on refuse
- * \return int <0 si ko, >0 si ok
+ * Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
+ * Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
+ * Si le paiement porte sur au moins une facture a "payee", on refuse
+ * @return int <0 si ko, >0 si ok
*/
function delete()
{
diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php
index 03d266e6d29..68883cb500c 100644
--- a/htdocs/compta/paiement/fiche.php
+++ b/htdocs/compta/paiement/fiche.php
@@ -38,8 +38,8 @@ $langs->load('banks');
$langs->load('companies');
// Security check
-$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
-$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
+$id=GETPOST("id");
+$action=GETPOST("action");
if ($user->societe_id) $socid=$user->societe_id;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
@@ -51,12 +51,31 @@ $mesg='';
* Actions
*/
-if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
+if ($action == 'setnote' && $user->rights->facture->paiement)
+{
+ $db->begin();
+
+ $paiement = new Paiement($db);
+ $paiement->fetch($id);
+ $result = $paiement->update_note(GETPOST('note'));
+ if ($result > 0)
+ {
+ $db->commit();
+ $action='';
+ }
+ else
+ {
+ $mesg='
';
// Bank account
if ($conf->banque->enabled)
@@ -305,18 +326,18 @@ if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
{
if ($user->rights->facture->paiement)
{
- print ''.$langs->trans('Valid').'';
+ print ''.$langs->trans('Valid').'';
}
}
}
-if ($user->societe_id == 0 && $_GET['action'] == '')
+if ($user->societe_id == 0 && $action == '')
{
if ($user->rights->facture->paiement)
{
if (! $disable_delete)
{
- print ''.$langs->trans('Delete').'';
+ print ''.$langs->trans('Delete').'';
}
else
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4fe38c99f04..cffc99c96a2 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -85,14 +85,14 @@ class Form
}
/**
- * \brief Output val field for an editable field
- * \param text Text of label (not used in this function)
- * \param htmlname Name of select field
- * \param preselected Preselected value for parameter
- * \param paramkey Key of parameter (unique if there is several parameter to show)
- * \param perm Permission to allow button to edit parameter
- * \param typeofdata Type of data (string by default, email, ...)
- * \return string HTML edit field
+ * Output val field for an editable field
+ * @param text Text of label (not used in this function)
+ * @param htmlname Name of select field
+ * @param preselected Preselected value for parameter
+ * @param paramkey Key of parameter (unique if there is several parameter to show)
+ * @param perm Permission to allow button to edit parameter
+ * @param typeofdata Type of data ('string' by default, 'email', 'text', ...)
+ * @return string HTML edit field
*/
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string')
{
@@ -107,7 +107,14 @@ class Form
$ret.='';
$ret.='