allow many-to-many lettering + cosmetic

This commit is contained in:
sparkyx 2024-07-12 18:39:12 +02:00
parent 5157ee35b8
commit d810da721e
5 changed files with 20 additions and 16 deletions

View file

@ -439,7 +439,7 @@ class Acc_Ledger extends jrn_def_sql
// Add a "concerned operation to bound these op.together
//
$rec=new Acc_Reconciliation($this->db);
$rec=new Acc_Reconciliation($this->db);
$rec->set_jr_id($seq);
$rec->insert($this->jr_id);
@ -449,13 +449,11 @@ class Acc_Ledger extends jrn_def_sql
throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));
}
// the table stock must updated
// also in the stock table
$sql="delete from stock_goods where sg_id = any ( select sg_id
from stock_goods natural join jrnx where j_grpt=".$this->jr_grpt_id.")";
$Res=$this->db->exec_sql($sql);
from stock_goods natural join jrnx where j_grpt=$1)";
$Res=$this->db->exec_sql($sql,array($this->jr_grpt_id));
if ($Res==false)
{
throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));

View file

@ -1804,6 +1804,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
</tr>
EOF;
if ($p_currency_code !=0) {
$sql_currency=new Currency_SQL($this->cn,0);
$iso_code=$sql_currency->getp("cr_code_iso");
$rate=_("Taux ");
$r.=<<<EOF
<tr class="highlight">
@ -1818,7 +1820,7 @@ $r.=<<<EOF
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot_eur} EUR
{$tot_eur} {$iso_code}
</td>
</tr>
EOF;

View file

@ -1064,9 +1064,9 @@ if ( $g_parameter->MY_TVA_USE=="Y") {
</td>
</tr>
EOF;
$sql_currency=new Currency_SQL($this->cn,$p_currency_code);
$iso_code=$sql_currency->getp("cr_code_iso");
if ($p_currency_code !=0) {
$sql_currency=new Currency_SQL($this->cn,0);
$iso_code=$sql_currency->getp("cr_code_iso");
$r.=<<<EOF
<tr class="highlight">

View file

@ -121,8 +121,9 @@ class Acc_Reconciliation
==0)
{
// Ok we can insert
$Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ".
"(".$this->jr_id.",$jr_id2)");
$Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ($1,$2)",
array($this->jr_id,$jr_id2)
);
// try to letter automatically same account from both operation
$this->auto_letter($jr_id2);

View file

@ -161,20 +161,23 @@ class Lettering
return;
// already linked
if ($let1!=0&&$let2!=0&&$let1!=$let2)
/* if ($let1!=0&&$let2!=0&&$let1!=$let2)
return;
*/
// none is linked
if ($let1==0&&$let2==0)
{
$jl_id=$this->db->get_next_seq("jnt_letter_jl_id_seq");
$this->db->exec_sql('insert into jnt_letter(jl_id) values($1)', array($jl_id));
}
// one is linked but not the other
if ($let1==0&&$let2!=0)
} elseif ($let1==0&&$let2!=0)
{
// one is linked but not the other
$jl_id=$let2;
if ($let1!=0&&$let2==0)
}elseif ($let1!=0&&$let2==0) {
$jl_id=$let1;
} else {
throw new \Exception ("LET179 invalid");
}
/* insert */
if ($first=='t')