diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b27f6965e86..e60883c7149 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5100,7 +5100,68 @@ class Form
print '';
}
- if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto))
+ if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled))
+ {
+ $linktoelem.=($linktoelem?' ':'').'' . $langs->trans('LinkedFichinter') . '';
+
+ print '
+
+ ';
+
+ print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
+
+ $sql = "SELECT s.rowid as socid, s.nom as name, s.client, f.rowid, f.ref";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
+ $sql .= ", " . MAIN_DB_PREFIX . "fichinter as f";
+ $sql .= ' WHERE f.fk_soc = s.rowid';
+
+ $resqlorderlist = $this->db->query($sql);
+ if ($resqlorderlist)
+ {
+ $num = $this->db->num_rows($resqlorderlist);
+ $i = 0;
+
+ print '
';
+ $this->db->free($resqlorderlist);
+ } else {
+ dol_print_error($this->db);
+ }
+
+ print '
';
+ }
+
+ if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto))
&& ! empty($conf->fournisseur->enabled))
{
$linktoelem.=($linktoelem?' ':'').'' . $langs->trans('LinkedOrder') . '';
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 5036fd617f0..ba860d17465 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2086,7 +2086,28 @@ if($user->rights->expensereport->export && $object->fk_statut>0 && $action != 'e
print '';
+if ($action != 'create' && $action != 'edit' && ($id || $ref))
+{
+ $permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
+ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
+ // Link invoice to intervention
+ if (GETPOST('LinkedFichinter')) {
+ $object->fetch($id);
+ $object->fetch_thirdparty();
+ $result = $object->add_object_linked('fichinter', GETPOST('LinkedFichinter'));
+ }
+ // Linked object block
+ $somethingshown = $form->showLinkedObjectBlock($object);
+
+ // Show links to link elements
+ $linktoelements=array();
+ if($conf->global->EXPENSES_LINK_TO_INTERVENTION) $linktoelements[]='fichinter';
+ $linktoelem='';
+ $linktoelem = $form->showLinkToObjectBlock($object,$linktoelements);
+ if ($linktoelem) print '
'.$linktoelem;
+
+}
llxFooter();
$db->close();
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 14cacf57022..964a7c30678 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -220,4 +220,5 @@ AddExtraReport=Extra reports
OtherCountriesCustomersReport=Foreign customers report
BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Based on the two first letters of the VAT number being different from your own company's country code
SameCountryCustomersWithVAT=National customers report
-BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code
\ No newline at end of file
+BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code
+LinkedFichinter=Link to an intervention
diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang
index dd7ca2fc4cc..96cc123c2c6 100644
--- a/htdocs/langs/fr_FR/compta.lang
+++ b/htdocs/langs/fr_FR/compta.lang
@@ -221,3 +221,4 @@ OtherCountriesCustomersReport=Rapport client étranger
BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant différent du code de pays de votre propre entreprise
SameCountryCustomersWithVAT=Rapport clients nationaux
BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant les mêmes que le code pays de votre propre entreprise
+LinkedFichinter=Lier à une intervention