From 25196fa7092b561ab14cd3f0c670aed31a2de2cc Mon Sep 17 00:00:00 2001
From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com>
Date: Thu, 19 May 2022 10:20:31 +0200
Subject: [PATCH 1/3] FIX: new member subscription: bank account and payment
mode might be hidden
---
htdocs/adherents/subscription.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 799f043c4df..c069f0d12e2 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -960,12 +960,12 @@ if ($rowid > 0) {
// Bank account
print '
| '.$langs->trans("FinancialAccount").' | ';
- $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
+ $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200');
print " |
\n";
// Payment mode
print '| '.$langs->trans("PaymentMode").' | ';
- $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
+ $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
print " |
\n";
// Date of payment
From 8231a9ea0fab852d3c9268c29a97833d7f3f49f2 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Fri, 20 May 2022 23:29:35 +0200
Subject: [PATCH 2/3] Fix wrong right test to show button
---
htdocs/expensereport/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 07d3e018390..acd6a60f0f9 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2648,7 +2648,7 @@ if ($action != 'create' && $action != 'edit')
}
// If bank module is not used
- if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->status == ExpenseReport::STATUS_APPROVED)
+ if (($user->rights->expensereport->to_paid && empty($conf->banque->enabled)) && $object->status == ExpenseReport::STATUS_APPROVED)
{
//if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0)
if ($object->paid == 0)
From c3fb7647c5f8cf4d4cd8d744af1fecc2f5e2cbed Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sun, 22 May 2022 02:30:35 +0200
Subject: [PATCH 3/3] Fix delete customer payment
---
htdocs/compta/paiement/card.php | 2 +-
htdocs/core/lib/security.lib.php | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index b53debd79ba..47897902a9c 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -48,7 +48,7 @@ $object = new Paiement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
-$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
+$result = restrictedArea($user, $object->element, $object->id, 'paiement');
// Security check
if ($user->socid) $socid = $user->socid;
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index f8bde1ce489..c1eda701604 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -185,7 +185,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
- //print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
+ //print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."
";
$parentfortableentity = '';
@@ -374,6 +374,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
} elseif ($feature == 'salaries')
{
if (!$user->rights->salaries->delete) $deleteok = 0;
+ } elseif ($feature == 'payment') {
+ if (!$user->rights->facture->paiement) $deleteok = 0;
} elseif ($feature == 'payment_supplier')
{
if (!$user->rights->fournisseur->facture->creer) { $deleteok = 0; }