Improve code

This commit is contained in:
sparkyx 2025-07-23 20:37:22 +02:00
parent e400bef761
commit e6f2d10323

View file

@ -1977,14 +1977,14 @@ class Acc_Ledger extends jrn_def_sql
* operation,
* @param $internal is the internal code
* @param $p_array is normally the $_POST
* @todo rewrite code : remove extract and +SQL value
* \return a string
*/
function create_document($internal, $p_array)
{
extract($p_array, EXTR_SKIP);
$doc=new Document($this->db);
$doc->f_id=$e_client;
$doc->md_id=$gen_doc;
$doc->f_id=$p_array['e_client'];
$doc->md_id=$p_array['gen_doc'];
$doc->ag_id=0;
$p_array['e_pj']=$this->pj;
$filename="";
@ -1992,10 +1992,10 @@ class Acc_Ledger extends jrn_def_sql
// Move the document to the jrn
$doc->moveDocumentPj($internal);
// Update the comment with invoice number, if the comment is empty
if (!isset($e_comm)||noalyss_strlentrim($e_comm)==0)
if (!isset($p_array['e_comm'])||noalyss_strlentrim($p_array['e_comm'])==0)
{
$sql="update jrn set jr_comment=' document ".$doc->d_number."' where jr_internal='$internal'";
$this->db->exec_sql($sql);
$sql="update jrn set jr_comment=' document ".$doc->d_number."' where jr_internal=$1";
$this->db->exec_sql($sql,[$internal]);
}
return h($doc->d_name.' ('.$doc->d_filename.')');
}