diff --git a/include/class/class_acc_ledger.php b/include/class/class_acc_ledger.php index 598abf63b..45013b565 100644 --- a/include/class/class_acc_ledger.php +++ b/include/class/class_acc_ledger.php @@ -3589,24 +3589,31 @@ class Acc_Ledger extends jrn_def_sql $this->jrn_def_max_line_deb = ($p_jrn_deb_max_line<1)?1:$p_jrn_deb_max_line; $this->jrn_def_type = $p_jrn_type; $this->jrn_def_pj_pref = $jrn_def_pj_pref; - $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, ',') : ""; $this->jrn_deb_max_line=($min_row<1)?1:$min_row; $this->jrn_def_description=$p_description; switch ($this->jrn_def_type) { - case 'ACH': + case 'ACH': + $this->jrn_def_fiche_cred = (isset($ACH_FICHECRED)) ? join($ACH_FICHECRED, ',') : ''; + $this->jrn_def_fiche_deb = (isset($ACH_FICHEDEB)) ? join($ACH_FICHEDEB, ',') : ""; + break; case 'VEN': - $this->jrn_def_fiche_cred = (isset($FICHECRED)) ? join($FICHECRED, ',') : ''; + $this->jrn_def_fiche_cred = (isset($VEN_FICHECRED)) ? join($VEN_FICHECRED, ',') : ''; + $this->jrn_def_fiche_deb = (isset($VEN_FICHEDEB)) ? join($VEN_FICHEDEB, ',') : ""; + break; case 'ODS': - $this->jrn_def_class_deb = $p_jrn_class_deb; - $this->jrn_def_fiche_cred=null; + $this->jrn_def_class_deb = $p_jrn_class_deb; + $this->jrn_def_fiche_deb = (isset($ODS_FICHEDEB)) ? join($ODS_FICHEDEB, ',') : '';; + $this->jrn_def_fiche_cred = null; break; + case 'FIN': $a = new Fiche($this->db); $result = $a->get_by_qcode(trim(strtoupper($_POST['bank'])), false); $bank = $a->id; $this->jrn_def_bank = $bank; + $this->jrn_def_fiche_deb = (isset($FIN_FICHEDEB)) ? join($FIN_FICHEDEB, ',') : ""; if ($result == -1) throw new Exception(_("Aucun compte en banque n'est donné")); $this->jrn_def_num_op = (isset($numb_operation)) ? 1 : 0; @@ -3744,19 +3751,23 @@ class Acc_Ledger extends jrn_def_sql $this->jrn_def_max_line_deb = $p_jrn_deb_max_line; $this->jrn_def_type = $p_jrn_type; $this->jrn_def_pj_pref = $jrn_def_pj_pref; - $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, ',') : ""; $this->jrn_deb_max_line=$min_row; $this->jrn_def_code = sprintf("%s%02d", trim(substr($this->jrn_def_type, 0, 1)), Acc_Ledger::next_number($this->db, $this->jrn_def_type)); $this->jrn_def_description=$p_description; switch ($this->jrn_def_type) { case 'ACH': + $this->jrn_def_fiche_cred = (isset($ACH_FICHECRED)) ? join($ACH_FICHECRED, ',') : ''; + $this->jrn_def_fiche_deb = (isset($ACH_FICHEDEB)) ? join($ACH_FICHEDEB, ',') : ""; + break; case 'VEN': - $this->jrn_def_fiche_cred = (isset($FICHECRED)) ? join($FICHECRED, ',') : ''; + $this->jrn_def_fiche_cred = (isset($VEN_FICHECRED)) ? join($VEN_FICHECRED, ',') : ''; + $this->jrn_def_fiche_deb = (isset($VEN_FICHEDEB)) ? join($VEN_FICHEDEB, ',') : ""; break; case 'ODS': - $this->jrn_def_class_deb = $p_jrn_class_deb; + $this->jrn_def_class_deb = $p_jrn_class_deb; + $this->jrn_def_fiche_deb = (isset($ODS_FICHEDEB)) ? join($ODS_FICHEDEB, ',') : '';; $this->jrn_def_fiche_cred = null; break; case 'FIN': @@ -3764,6 +3775,7 @@ class Acc_Ledger extends jrn_def_sql $result = $a->get_by_qcode(trim(strtoupper($_POST['bank'])), false); $bank = $a->id; $this->jrn_def_bank = $bank; + $this->jrn_def_fiche_deb = (isset($FIN_FICHEDEB)) ? join($FIN_FICHEDEB, ',') : ""; if ($result == -1) throw new Exception(_("Aucun compte en banque n'est donné")); $this->jrn_def_num_op = (isset($numb_operation)) ? 1 : 0;