Add possibility to add linked object block in object card for external module
Fix: templates integration
This commit is contained in:
parent
a6edf971de
commit
f9c4c30ec5
@ -2217,49 +2217,18 @@ else
|
|||||||
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste des factures
|
* Linked object block
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate('f.datef')." as df";
|
$commande->load_object_linked($commande->id,$commande->element);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."element_element as el";
|
|
||||||
$sql.= " WHERE f.rowid = el.fk_target";
|
|
||||||
$sql.= " AND el.targettype = 'facture'";
|
|
||||||
$sql.= " AND el.fk_source = ".$commande->id;
|
|
||||||
$sql.= " AND el.sourcetype = '".$commande->element."'";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
foreach($commande->linked_object as $object => $objectid)
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
if($conf->$object->enabled)
|
||||||
if ($num)
|
|
||||||
{
|
{
|
||||||
print '<br>';
|
$somethingshown=$commande->showLinkedObjectBlock($object,$objectid,$somethingshown);
|
||||||
print_titre($langs->trans('RelatedBills'));
|
|
||||||
$i = 0; $total = 0;
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans('Ref')."</td>";
|
|
||||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans('Price').'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var=True;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'>';
|
|
||||||
print '<td><a href="../compta/facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber.'</a></td>';
|
|
||||||
print '<td align="center">'.dol_print_date($objp->df,'day').'</td>';
|
|
||||||
print '<td align="right">'.price($objp->total_ttc).'</td></tr>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print '</table>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
print '</td><td valign="top" width="50%">';
|
print '</td><td valign="top" width="50%">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -552,49 +552,17 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
|
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste des factures
|
* Linked object block
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate("f.datef")." as df";
|
$commande->load_object_linked($commande->id,$commande->element);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."element_element as el";
|
|
||||||
$sql.= " WHERE f.rowid = el.fk_target";
|
|
||||||
$sql.= " AND el.targettype = 'facture'";
|
|
||||||
$sql.= " AND el.fk_source = ". $commande->id;
|
|
||||||
$sql.= " AND el.sourcetype = '".$commande->element."'";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
foreach($commande->linked_object as $object => $objectid)
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
if($conf->$object->enabled)
|
||||||
if ($num)
|
|
||||||
{
|
{
|
||||||
if ($somethingshown) print '<br>';
|
$somethingshown=$commande->showLinkedObjectBlock($object,$objectid,$somethingshown);
|
||||||
print_titre($langs->trans("RelatedBills"));
|
|
||||||
$i = 0; $total = 0;
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Ref")."</td>";
|
|
||||||
print '<td align="center">'.$langs->trans("Date").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var=True;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($result);
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td><a href="../facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.'</a></td>';
|
|
||||||
print '<td align="center">'.dol_print_date($objp->df).'</td>';
|
|
||||||
print '<td align="right">'.price($objp->total_ttc).'</td></tr>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td><td valign="top" width="50%">';
|
print '</td><td valign="top" width="50%">';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user