Add linked object block for contract module
This commit is contained in:
parent
6c560b61b8
commit
cd2aa64cae
@ -662,7 +662,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
$facture->remise_absolue = $_POST['remise_absolue'];
|
||||
$facture->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
// If creation from proposal
|
||||
// If creation from other modules
|
||||
if ($_POST['origin'] && $_POST['originid'])
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
|
||||
@ -1329,6 +1329,27 @@ else
|
||||
print "</div>";
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Linked object block
|
||||
*/
|
||||
$contrat->load_object_linked($contrat->id,$contrat->element);
|
||||
|
||||
if (! empty($contrat->linked_object))
|
||||
{
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
|
||||
foreach($contrat->linked_object as $object => $objectid)
|
||||
{
|
||||
if($conf->$object->enabled && $object != $contrat->element)
|
||||
{
|
||||
$somethingshown=$contrat->showLinkedObjectBlock($object,$objectid,$somethingshown);
|
||||
}
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
60
htdocs/contrat/tpl/linkedobjectblock.tpl.php
Normal file
60
htdocs/contrat/tpl/linkedobjectblock.tpl.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
if ($somethingshown) { echo '<br>'; }
|
||||
print_titre($langs->trans('RelatedContract'));
|
||||
?>
|
||||
<table class="noborder" width="100%">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
$linkedObjectBlock->fetch($objectid[$i]);
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/contrat/fiche.php?id='.$linkedObjectBlock->id.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$linkedObjectBlock->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($linkedObjectBlock->date,'day'); ?></td>
|
||||
<td align="right"><?php echo price($linkedObjectBlock->total_ht); ?></td>
|
||||
<td align="right"><?php echo $linkedObjectBlock->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total = $total + $linkedObjectBlock->total_ht;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -1029,8 +1029,8 @@ class CommonObject
|
||||
// TODO uniformiser emplacement classe
|
||||
$classpath = $object.'/class';
|
||||
$tplpath = $object;
|
||||
if ($object == 'facture') $tplpath = $classpath = 'compta/'.$object;
|
||||
if ($object == 'propal') $tplpath = $classpath = 'comm/'.$object;
|
||||
if ($object == 'facture') $tplpath = 'compta/'.$object; $classpath = $tplpath.'/class';
|
||||
if ($object == 'propal') $tplpath = 'comm/'.$object; $classpath = $tplpath.'/class';
|
||||
|
||||
$classname = ucfirst($object);
|
||||
if(!class_exists($classname)) require(DOL_DOCUMENT_ROOT."/".$classpath."/".$object.".class.php");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user