Merge pull request #14000 from OPEN-DSI/fix_erreur_facture_v10
FIX: Fix link of the button to create a credit note and fix the awareness of a error happen when to create a credit note
This commit is contained in:
commit
2696a6a4d0
@ -1106,12 +1106,12 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Add link between credit note and origin
|
||||
if(! empty($object->fk_facture_source)) {
|
||||
if(! empty($object->fk_facture_source) && $id>0) {
|
||||
$facture_source->fetch($object->fk_facture_source);
|
||||
$facture_source->fetchObjectLinked();
|
||||
|
||||
if(! empty($facture_source->linkedObjectsIds)) {
|
||||
foreach($facture_source->linkedObjectsIds as $sourcetype => $TIds) {
|
||||
if (!empty($facture_source->linkedObjectsIds)) {
|
||||
foreach ($facture_source->linkedObjectsIds as $sourcetype => $TIds) {
|
||||
$object->add_object_linked($sourcetype, current($TIds));
|
||||
}
|
||||
}
|
||||
@ -4835,9 +4835,8 @@ elseif ($id > 0 || ! empty($ref))
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
|
||||
{
|
||||
if (! $objectidnext)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&fac_avoir=' . $object->id . '&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').'' . ($object->entity > 0 ? '&originentity='.$object->entity : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||
if (! $objectidnext) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid . '&fac_avoir=' . $object->id . '&action=create&type=2' . ($object->fk_project > 0 ? '&projectid=' . $object->fk_project : '') . ($object->entity > 0 ? '&originentity=' . $object->entity : '') . '">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user