Debug v23

This commit is contained in:
Laurent Destailleur 2025-12-20 16:24:52 +01:00
parent d191e1060c
commit b6c2a6509d

View file

@ -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 '<tr><td>'.$langs->trans('Source').'</td><td>';
print img_picto('', 'question', 'class="pictofixedwidth"');
$form->selectInputReason((string) $inputReasonId, 'input_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
if (!getDolGlobalInt('INVOICE_DISABLE_SOURCE')) {
print '<tr><td>'.$langs->trans('Source').'</td><td>';
print img_picto('', 'question', 'class="pictofixedwidth"');
$form->selectInputReason((string) $inputReasonId, 'input_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
} else {
print '<input type="hidden" name="input_reason_id" value="'.((string) $inputReasonId).'">';
}
// Project
if (isModEnabled('project') && is_object($formproject)) {
@ -5422,15 +5426,17 @@ if ($action == 'create') {
}
// Source reason (why we have an invoice)
print '<tr><td>';
print $form->editfieldkey('Source', 'input_reason', '', $object, (int) $usercancreate);
print '</td><td class="valuefield">';
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 '<tr><td>';
print $form->editfieldkey('Source', 'input_reason', '', $object, (int) $usercancreate);
print '</td><td class="valuefield">';
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 '</td></tr>';
}
print '</td></tr>';
// Payment term
print '<tr><td>';