Improve code

This commit is contained in:
sparkyx 2025-10-24 11:53:22 +02:00
parent 69b807e2eb
commit 23d77ad996
4 changed files with 8 additions and 9 deletions

View file

@ -1979,7 +1979,7 @@ class Acc_Ledger extends jrn_def_sql
* @param $internal is the internal code
* @param $p_array is normally the $_POST
@see Acc_Document::create_document
* @return a string
* @return html string
*/
function create_document($internal, $p_array)
{

View file

@ -151,15 +151,15 @@ class Document
throw new Exception ("DC121 cannot create $dirname directory",5000);
}
/**
* md_id == -2 is the standard PDF invoice, you don't parse or compute
* md_id == -2 : INVOICE_STD is the standard PDF invoice, you don't parse or compute
* it
*/
if ( $this->md_id == -2)
if ( $this->md_id == INVOICE_STD)
{
$file_to_parse=str_replace(
array('/', '*', '<', '>', ';', ',', '\\', '.', ':', '(', ')', ' ', '[', ']')
, "-"
, "inv-std-".$p_array['e_pj'].".pdf");
, "inv-std-".$p_array['e_pj']).".pdf";
$this->d_number=$this->db->get_next_seq("seq_doc_type_stdinv");
$this->d_filename=$file_to_parse;

View file

@ -176,10 +176,8 @@ if ( isset($_POST['record']) )
}
else
/* Generate an invoice and save it into the database */
if (isset($_POST['gen_invoice']))
if (isset($_POST['gen_invoice']))
{
//@var $invoice_template (int) get the invoice number DOCUMENT_MODELE.MD_ID
$invoice_template=$http->post("gen_doc","number");
// generate an invoice
$file = $Ledger->create_document($internal, $_POST);
$receipt= HtmlInput::show_receipt_document($Ledger->jr_id
@ -228,7 +226,7 @@ if ( isset($_POST['record']) )
$mt=date ('ymd-Hi').'+'.$Ledger->jr_id;
$uniq= $_ENV['TMP']. DIRECTORY_SEPARATOR."$mt-e-invoice.xml";
file_put_contents($uniq, $xml);
chmod ($uniq,774);
chmod ($uniq,"0774");
echo \Noalyss\Dbg::echo_file("file save $uniq");
}

View file

@ -25,7 +25,7 @@
global $version_noalyss;
// version
define('NOALYSS_VERSION', 9312 );
define('NOALYSS_VERSION', 9400 );
// Database schema version
define("DBVERSION", 203);
@ -208,6 +208,7 @@ define("OPEN", 1);
define("CLOSED", 0);
define("NOTCENTRALIZED", 3);
define("ALL", 4);
define("INVOICE_STD", -2);
// Pour les ShowMenuComptaLeft
define("MENU_FACT", 1);