[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 21/46: if you want to modify the accounting ,
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 21/46: if you want to modify the accounting , it must not be used before. |
Date: |
Mon, 4 May 2020 13:38:48 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit be7b7af895464646c0176157b75a61bd27d64560
Author: Dany De Bontridder <address@hidden>
AuthorDate: Thu Mar 5 23:25:40 2020 +0100
if you want to modify the accounting , it must not be used before.
---
include/class/acc_plan_mtable.class.php | 81 +++++++++++++++++++++++++--------
1 file changed, 62 insertions(+), 19 deletions(-)
diff --git a/include/class/acc_plan_mtable.class.php
b/include/class/acc_plan_mtable.class.php
index 9f37cbc..b5537e9 100644
--- a/include/class/acc_plan_mtable.class.php
+++ b/include/class/acc_plan_mtable.class.php
@@ -62,21 +62,24 @@ class Acc_Plan_MTable extends Manage_Table_SQL
["label"=>_("Produit inversé"),"value"=>"PROINV"],
["label"=>_("Contexte"),"value"=>"CON"]
]);
- $this->set_col_type("pcm_direct_use",
"select",array(["label"=>_("Oui"),"value"=>"Y"],["label"=>"Non","value"=>"N"]));
-
$this->a_order=["pcm_val","pcm_lib","parent_accounting","pcm_direct_use","pcm_type","fiche_qcode"];
+ $this->set_col_type("pcm_direct_use", "select",
+ array(["label" => _("Oui"), "value" => "Y"], ["label" => "Non",
"value" => "N"]));
+ $this->set_col_type("pcm_val", "custom");
+ $this->a_order = ["pcm_val", "pcm_lib", "parent_accounting",
"pcm_direct_use", "pcm_type", "fiche_qcode"];
$this->set_icon_mod("first");
}
+
/**
* Display a row
* @param type $p_row array of value key column=>value
*/
function display_row($p_row)
{
- printf('<tr id="%s_%s">',
+ printf('<tr id="%s_%s">',
$this->object_name,
$p_row[$this->table->primary_key])
;
-
+
$dossier_id=Dossier::id();
$nb_order=count($this->a_order);
for ($i=0; $i<$nb_order; $i++)
@@ -99,29 +102,29 @@ class Acc_Plan_MTable extends Manage_Table_SQL
elseif ($v == "fiche_qcode") {
$count=$this->table->cn->get_value("select count(*) from
fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val']));
if ($count == 0) echo td("");
- elseif ($count == 1 ) {
+ elseif ($count == 1 ) {
echo '<td>';
- echo HtmlInput::card_detail($p_row[$v]) ;
+ echo HtmlInput::card_detail($p_row[$v]) ;
echo '</td>';
-
+
}
- elseif ($count > 1) {
+ elseif ($count > 1) {
echo '<td>';
$a_code=explode(",",$p_row[$v]);
$nb_code=count($a_code);
for ($xx = 0;$xx < $nb_code;$xx++)
{
- echo HtmlInput::card_detail($a_code[$xx])."," ;
+ echo HtmlInput::card_detail($a_code[$xx])."," ;
}
echo " ($count) ";
echo Icon_Action::more(uniqid(),
sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"]));
echo '</td>';
-
- }
+
+ }
}
elseif ($v=="pcm_lib")
{
-
+
if ( $nb >0){
echo "<td>";
if ($nb_used > 0) {
@@ -148,13 +151,14 @@ class Acc_Plan_MTable extends Manage_Table_SQL
echo '</tr>';
}
+
/**
- * Check that the entered data are valid before recording them into
+ * Check that the entered data are valid before recording them into
* tmp_pcmn, the errors are stored into this->a_error and if someting wrong
* is found it returns false, if the data can be saved it returns true
- * @return return false if an error is found,
+ * @return return false if an error is found,
*/
- function check()
+ function check()
{
$cn=Dossier::connect();
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val =
$1 and id <> $2",
@@ -180,12 +184,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL
if ($exist_parent == 0) {
$this->set_error("parent_accounting", _("Compte parent n'existe
pas"));
}
- if ( count($this->aerror) > 0 ) return false;
+ /**
+ * check that accounting is not already used
+ */
+ $old_accounting = $cn->get_value("select pcm_val from tmp_pcmn where
id = $1",
+ array($this->table->id));
+ // it is not a new accounting and is different
+ if ($old_accounting != "" && $old_accounting != $this->table->pcm_val)
{
+ // count it is used
+ if ($cn->get_value("select count(*) from jrnx where j_poste=$1",
+ [$old_accounting]) > 0) {
+ $this->set_error("pcm_val", _("Poste utilisé"));
+ }
+ }
+ if (count($this->aerror) > 0) return false;
return true;
}
-
+
/**
- * @brief display into a dialog box the datarow in order
+ * @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
*/
@@ -195,5 +212,31 @@ class Acc_Plan_MTable extends Manage_Table_SQL
$dossier_id=Dossier::id();
echo HtmlInput::button_action(_("Toutes les fiches") ,
sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val));
}
-
+
+ /**
+ * if pcm_val already used then it cannot be modified
+ *
+ * @param $p_key always pcm_val
+ * @param $p_value current value of pcm_val
+ * @return nothing|void
+ */
+ function input_custom($p_key, $p_value)
+ {
+ $readonly=true;
+ $cn=Dossier::connect();
+ if (
+ $p_value == "" ||
+ ($p_value !="" && $cn->get_value("select count(*) from jrnx where
j_poste=$1",[$p_value]) == 0 )
+ )
+ {
+ $readonly=false;
+ }
+ $text=new IText($p_key);
+ $text->setReadOnly($readonly);
+ $text->value=$p_value;
+ $min_size=(strlen($p_value)<30)?30:strlen($p_value)+5;
+ $text->size=$min_size;
+ echo $text->input();
+ }
+
}
- [Noalyss-commit] [noalyss] 18/46: Task #1694: Opération FIN: opération liée - code fiche mais pas nom, (continued)
- [Noalyss-commit] [noalyss] 18/46: Task #1694: Opération FIN: opération liée - code fiche mais pas nom, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 19/46: Task #0001704: Faciliter l'ajout de plusieurs lignes, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 23/46: Output_Html_Tab : cosmetic, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 24/46: Create test folder for phpunit, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 25/46: Task #0001704: Faciliter l'ajout de plusieurs lignes Fichier oublié html_input_noalyss.class.php, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 15/46: replace $_GET by httpInput, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 30/46: Task #0001793: Installation mot de passe Password cannot be empty, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 14/46: Task #0001699: Affichage PDF balance - totaux niveaux, etc'., Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 20/46: Cosmetic : Opération prédéfinie, modèle, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 17/46: Task #1756: Avertissement qcode, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 21/46: if you want to modify the accounting , it must not be used before.,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 26/46: Task #0001793: Installation mot de passe, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 32/46: Task #0001793: Installation mot de passe Empêche @mobile , doc, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 34/46: Bug #0001245: Type actif - passif pour nouvelle fiche à partir de fiche Erreur dans PARM_POSTE pour la compta française, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 35/46: Bug #0001245: Type actif - passif pour nouvelle fiche à partir de fiche Erreur dans PARM_POSTE pour la compta française, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 28/46: Task #0001793: Installation mot de passe remove debug info, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 33/46: Task #1277 : RTF conversion char accentuated, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 36/46: Merge branch 'dev7202', Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 38/46: Fiche.Test : add test cmp_name and get_row, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 40/46: Fix cosmetic and typo, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 22/46: HtmlOutput tab , add mode row, Dany De Bontridder, 2020/05/04