From b6c2a6509dedd9d0c64979e64fb725eaf712d33f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Dec 2025 16:24:52 +0100 Subject: [PATCH] Debug v23 --- htdocs/compta/facture/card.php | 42 +++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f0bbdcc7b0b..51b0c19ea49 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1725,7 +1725,7 @@ if (empty($reshook)) { $srcobject = new $classname($db); '@phan-var-force CommonObject $srcobject'; - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines or deposit lines"); + dol_syslog("Try to find source object origin_type=".$object->origin_type." origin_id=".$object->origin_id." to add lines or deposit lines"); $result = $srcobject->fetch($object->origin_id); $i = -1; // Ensure initialised for static analysis, but with invalid idx. @@ -1839,7 +1839,7 @@ if (empty($reshook)) { 0, // product_type 1, $i >= 0 ? $lines[$i]->special_code : 0, - $object->origin, + $object->origin_type, 0, 0, 0, @@ -2025,7 +2025,7 @@ if (empty($reshook)) { $product_type, $lines[$i]->rang, $lines[$i]->special_code, - $object->origin, + $object->origin_type, $lines[$i]->rowid, $fk_parent_line, isset($lines[$i]->fk_fournprice) ? $lines[$i]->fk_fournprice : null, @@ -3726,19 +3726,19 @@ if ($action == 'create') { $projectid = (!empty($projectid) ? $projectid : $objectsrc->fk_project); // Propagate ref customer of src object to the invoice ? - if (getDolGlobalString("INVOICE_DO_NOT_PROPAGATE_REF_CUSTOMER_Of_SRC_TO_INVOICE")) { + if (getDolGlobalString("INVOICE_DO_NOT_PROPAGATE_REF_CUSTOMER_OF_SRC_TO_INVOICE")) { $ref_client = ""; } else { $ref_client = (!empty($objectsrc->ref_client) ? $objectsrc->ref_client : (!empty($objectsrc->ref_customer) ? $objectsrc->ref_customer : '')); } - // only if socid not filled else it's already done above + // Only if socid not filled else it's already done above if (empty($socid)) { $soc = $objectsrc->thirdparty; } if ($element == 'expedition') { - $elem = $subelem = $objectsrc->origin; + $elem = $subelem = $objectsrc->origin_type; $expeoriginid = $objectsrc->origin_id; dol_include_once('/'.$elem.'/class/'.$subelem.'.class.php'); $classname = ucfirst($subelem); @@ -4515,10 +4515,14 @@ if ($action == 'create') { } // Source / Channel - What trigger creation - print ''.$langs->trans('Source').''; - print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason((string) $inputReasonId, 'input_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print ''; + if (!getDolGlobalInt('INVOICE_DISABLE_SOURCE')) { + print ''.$langs->trans('Source').''; + print img_picto('', 'question', 'class="pictofixedwidth"'); + $form->selectInputReason((string) $inputReasonId, 'input_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print ''; + } else { + print ''; + } // Project if (isModEnabled('project') && is_object($formproject)) { @@ -5422,15 +5426,17 @@ if ($action == 'create') { } // Source reason (why we have an invoice) - print ''; - print $form->editfieldkey('Source', 'input_reason', '', $object, (int) $usercancreate); - print ''; - if ($action == 'editinput_reason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'input_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none'); + if (!getDolGlobalInt('INVOICE_DISABLE_SOURCE')) { + print ''; + print $form->editfieldkey('Source', 'input_reason', '', $object, (int) $usercancreate); + print ''; + if ($action == 'editinput_reason') { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'input_reason_id', 1); + } else { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none'); + } + print ''; } - print ''; // Payment term print '';