diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index e2da54015cc..31c69d93295 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1588,6 +1588,15 @@ else if ($action == 'down' && $user->rights->facture->creer)
exit;
}
+// Link invoice to order
+if (GETPOST('linkedOrder'))
+{
+ $object->fetch($id);
+ $object->fetch_thirdparty();
+ $result=$object->add_object_linked('commande',GETPOST('linkedOrder'));
+}
+
+
/*
* Add file in email form
*/
@@ -1960,6 +1969,16 @@ $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
+print '
+
+';
+
/*********************************************************************
*
@@ -3727,74 +3746,64 @@ else if ($id > 0 || ! empty($ref))
// Linked object block
$somethingshown=$object->showLinkedObjectBlock();
-
if (empty($somethingshown) && $object->statut > 0)
{
+ print '
'.$langs->trans('LinkedOrder').'';
- print ''.$langs->trans('LinkedOrder').'';
-
- print '
';
- {
+ print '
';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
- $result = $db->query($sql);
- if ($result)
+ $resqlorderlist = $db->query($sql);
+ if ($resqlorderlist)
{
- $num = $db->num_rows($result);
+ $num = $db->num_rows($resqlorderlist);
$i = 0;
-
- print_titre($langs->trans("LinkedOrder"));
- print '
';
- print ' | ';
- print ''.$langs->trans("Ref").' | ';
- print ''.$langs->trans("RefCustomer").' | ';
- print ''.$langs->trans("AmountHTShort").' | ';
- print ''.$langs->trans("Company").' |
-
';
- print '';
+ $db->free($resqlorderlist);
}
- else
+ else
{
dol_print_error($db);
}
- $result=$object->add_object_linked('commande',$_POST['linkedOrder']);
- if($result>0)
- {
- echo '';
+
+ print '';
}
- }
-
- print '';
- }
+
// Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0)
{
@@ -3946,20 +3955,4 @@ dol_htmloutput_mesg('',$mesgs);
llxFooter();
$db->close();
-?>
-
-
+?>
\ No newline at end of file
diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php
index 7840f5e7d9e..28a3c5c2885 100644
--- a/htdocs/societe/societe.php
+++ b/htdocs/societe/societe.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2004-2013 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2012 Marcos García
* Copyright (C) 2013 Raphaël Doursenaud
@@ -22,7 +22,7 @@
/**
* \file htdocs/societe/societe.php
* \ingroup societe
- * \brief Page to show a third party
+ * \brief Page to show list of third parties
*/
require_once '../main.inc.php';