[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 25/33: Block new operation with deactivated c
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 25/33: Block new operation with deactivated card |
Date: |
Thu, 18 Jul 2024 12:24:48 -0400 (EDT) |
sparkyx pushed a commit to branch unstable
in repository noalyss.
commit cd644787af832e458e33b7d63a1f9ff3356657fb
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Jul 12 19:03:04 2024 +0200
Block new operation with deactivated card
---
include/class/acc_ledger.class.php | 4 ++++
include/class/acc_ledger_fin.class.php | 9 ++++++---
include/class/acc_ledger_purchase.class.php | 15 ++++++++++++---
include/class/acc_ledger_sale.class.php | 17 ++++++++++++++---
4 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index 17f6dd420..2ae52a103 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1295,7 +1295,11 @@ class Acc_Ledger extends jrn_def_sql
if (isset(${'qc_'.$i})&&trim(${'qc_'.$i})!="")
{
$f=new Fiche($this->db);
+ $f->get_by_qcode(${'qc_'.$i});
$f->quick_code=${'qc_'.$i};
+
+ if ($f->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"),${'qc_'.$i}), 50);
if ($f->belong_ledger($p_jrn) < 1 )
throw new Exception("La fiche quick_code = ".
$f->quick_code." n'est pas dans ce journal", 4);
diff --git a/include/class/acc_ledger_fin.class.php
b/include/class/acc_ledger_fin.class.php
index de3a2ea72..808d625ed 100644
--- a/include/class/acc_ledger_fin.class.php
+++ b/include/class/acc_ledger_fin.class.php
@@ -133,6 +133,11 @@ class Acc_Ledger_Fin extends Acc_Ledger
{
if (noalyss_strlentrim(${'e_other'.$i})==0)
continue;
+ /* check if all card has a ATTR_DEF_ACCOUNT */
+ $fiche=new Fiche($this->db);
+ $fiche->get_by_qcode(${'e_other'.$i});
+ if ($fiche->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"),${'e_other'.$i}), 50);
/* check if amount are numeric and */
if (isNumber(${'e_other'.$i.'_amount'})==0)
throw new Exception('La fiche '.${'e_other'.$i}.'a un montant
invalide ['.${'e_other'.$i.'_amount'}.']',
@@ -140,9 +145,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
/* compute the total */
$tot_amount+=round(${'e_other'.$i.'_amount'}, 2);
- /* check if all card has a ATTR_DEF_ACCOUNT */
- $fiche=new Fiche($this->db);
- $fiche->get_by_qcode(${'e_other'.$i});
+
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT)==true)
throw new Exception('La fiche '.${'e_other'.$i}.'n\'a pas de
poste comptable', 8);
diff --git a/include/class/acc_ledger_purchase.class.php
b/include/class/acc_ledger_purchase.class.php
index 2eebca15e..e95e057e2 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -111,10 +111,14 @@ class Acc_Ledger_Purchase extends Acc_Ledger
/* check the account */
$fiche=new Fiche($this->db);
$fiche->get_by_qcode($e_client);
+ if ($fiche->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"),$e_client), 50);
if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ').$e_client._('n\'a pas de poste
comptable'),8);
+
+
/* get the account and explode if necessary */
$sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
// if 2 accounts, take only the credit one for supplier
@@ -158,6 +162,13 @@ class Acc_Ledger_Purchase extends Acc_Ledger
for ($i=0;$i< $nb_item;$i++)
{
if ( noalyss_strlentrim(${'e_march'.$i})== 0) continue;
+
+ /* check if all card has a ATTR_DEF_ACCOUNT*/
+ $fiche=new Fiche($this->db);
+ $fiche->get_by_qcode(${'e_march'.$i});
+ if ($fiche->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"), ${'e_march' . $i}), 50);
+
/* check if amount are numeric and */
if ( isNumber(${'e_march'.$i.'_price'}) == 0 )
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un
montant invalide').' ['.${'e_march'.$i}.']',6);
@@ -181,9 +192,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
throw new Exception(_(" La TVA ".$tva_rate->tva_label."
utilise des postes comptables inexistants"));
}
- /* check if all card has a ATTR_DEF_ACCOUNT*/
- $fiche=new Fiche($this->db);
- $fiche->get_by_qcode(${'e_march'.$i});
+
if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas
de poste comptable'),8);
diff --git a/include/class/acc_ledger_sale.class.php
b/include/class/acc_ledger_sale.class.php
index bfa9eb539..28e39581d 100644
--- a/include/class/acc_ledger_sale.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -108,9 +108,15 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$fiche = new Fiche($this->db);
$fiche->get_by_qcode($e_client);
+
+ if ($fiche->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"),$e_client), 50);
+
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ') . $e_client . _('n\'a pas de
poste comptable'), 8);
+
+
/* get the account and explode if necessary */
$sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
// if 2 accounts, take only the debit one for customer
@@ -142,14 +148,19 @@ class Acc_Ledger_Sale extends Acc_Ledger {
for ($i = 0; $i < $nb_item; $i++) {
if (! isset (${'e_march' . $i}) || noalyss_strlentrim(${'e_march'
. $i}) == 0)
continue;
+ /* check if all card has a ATTR_DEF_ACCOUNT */
+ $fiche = new Fiche($this->db);
+ $fiche->get_by_qcode(${'e_march' . $i});
+ if ($fiche->get_f_enable() == '0')
+ throw new Exception(sprintf(_("La fiche %s n'est plus
utilisée"), ${'e_march' . $i}), 50);
+
+
/* check if amount are numeric and */
if (isNumber(${'e_march' . $i . '_price'}) == 0)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a
un montant invalide [') . ${'e_march' . $i} . ']', 6);
if (isNumber(${'e_quant' . $i}) == 0)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a
une quantité invalide [') . ${'e_quant' . $i} . ']', 7);
- /* check if all card has a ATTR_DEF_ACCOUNT */
- $fiche = new Fiche($this->db);
- $fiche->get_by_qcode(${'e_march' . $i});
+
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ') . ${'e_march' . $i} .
_('n\'a pas de poste comptable'), 8);
- [Noalyss-commit] [noalyss] 03/33: IMPROVE #0002362: CCARDAT : Attribut de fiche Add control for element (choice) and allow to use VALUE(1, 1), (2, 2), (continued)
- [Noalyss-commit] [noalyss] 03/33: IMPROVE #0002362: CCARDAT : Attribut de fiche Add control for element (choice) and allow to use VALUE(1, 1), (2, 2), dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 01/33: tag 9206, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 05/33: IMPROVE #0002362: CCARDAT : Attribut de fiche Add control for element (choice) and allow to use VALUE(1, 1), (2, 2), dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 26/33: PRINTJRN Cosmetic : 2 columns reversed, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 27/33: SQL : menu cosmetic, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 12/33: Menu not printable, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 14/33: PHP8.2 Allow Dynamic Properties, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 13/33: PRINTTVA : display tva_code, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 30/33: ODS : duplicate in currency, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 11/33: PHP8.2 Allow Dynamic Properties, dwm, 2024/07/18
- [Noalyss-commit] [noalyss] 25/33: Block new operation with deactivated card,
dwm <=
- [Noalyss-commit] [noalyss] 15/33: Menu not printable, dwm, 2024/07/18