NEW Link between objects can be done on both side and on all objects
This commit is contained in:
parent
b97223edd7
commit
7f6e2a277a
@ -424,7 +424,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
|
||||
@ -2324,9 +2324,9 @@ if ($action == 'create')
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
// print '</td><td valign="top" width="50%">';
|
||||
|
||||
@ -2614,9 +2614,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -134,14 +134,6 @@ if (empty($reshook))
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Link invoice to order
|
||||
if (GETPOST('linkedOrder') && empty($cancel) && $id > 0)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||
@ -4103,9 +4095,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
|
||||
@ -2021,8 +2021,8 @@ else
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -18,22 +18,29 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/actions_dellink.inc.php
|
||||
* \brief Code for actions on deleting link between elements
|
||||
* \brief Code for actions on linking and deleting link between elements
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $object must be defined
|
||||
// $permissiondellink must be defined
|
||||
// $uploaddir (example $conf->projet->dir_output . "/";)
|
||||
|
||||
$dellinkid = GETPOST('dellinkid','int');
|
||||
$addlinkid = GETPOST('idtolinkto','int');
|
||||
|
||||
// Set public note
|
||||
// Link invoice to order
|
||||
if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $id > 0 && $addlinkid > 0)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->add_object_linked(GETPOST('addlink'), $addlinkid);
|
||||
}
|
||||
|
||||
// Delete link
|
||||
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0)
|
||||
{
|
||||
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2364,6 +2364,10 @@ abstract class CommonObject
|
||||
$origin = (! empty($origin) ? $origin : $this->origin);
|
||||
$origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id);
|
||||
|
||||
// Special case
|
||||
if ($origin == 'order') $origin='commande';
|
||||
if ($origin == 'invoice') $origin='facture';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
@ -2548,7 +2552,10 @@ abstract class CommonObject
|
||||
// Set classfile
|
||||
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
|
||||
|
||||
if ($objecttype == 'invoice_supplier') {
|
||||
if ($objecttype == 'order') {
|
||||
$classfile = 'commande'; $classname = 'Commande';
|
||||
}
|
||||
else if ($objecttype == 'invoice_supplier') {
|
||||
$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
|
||||
}
|
||||
else if ($objecttype == 'order_supplier') {
|
||||
@ -2568,15 +2575,18 @@ abstract class CommonObject
|
||||
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||
{
|
||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||
|
||||
foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element
|
||||
//print '/'.$classpath.'/'.$classfile.'.class.php';
|
||||
if (class_exists($classname))
|
||||
{
|
||||
$object = new $classname($this->db);
|
||||
$ret = $object->fetch($objectid);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
$this->linkedObjects[$objecttype][$i] = $object;
|
||||
}
|
||||
foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element
|
||||
{
|
||||
$object = new $classname($this->db);
|
||||
$ret = $object->fetch($objectid);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
$this->linkedObjects[$objecttype][$i] = $object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5264,12 +5264,13 @@ class Form
|
||||
|
||||
/**
|
||||
* Show block with links to link to other objects.
|
||||
*
|
||||
*
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction.
|
||||
* @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion.
|
||||
* @return string <0 if KO, >0 if OK
|
||||
*/
|
||||
function showLinkToObjectBlock($object, $restrictlinksto=array())
|
||||
function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinksto=array())
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
global $bc;
|
||||
@ -5278,201 +5279,90 @@ class Form
|
||||
|
||||
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
||||
|
||||
if ((empty($restrictlinksto) || in_array('order',$restrictlinksto))
|
||||
&& ! empty($conf->commande->enabled))
|
||||
$possiblelinks=array(
|
||||
'propal'=>array('enabled'=>$conf->propale->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id)
|
||||
);
|
||||
|
||||
foreach($possiblelinks as $key => $possiblelink)
|
||||
{
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linktoorder").click(function() {
|
||||
jQuery("#orderlist").toggle();
|
||||
jQuery("#linktoorder").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<div id="orderlist"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
|
||||
|
||||
$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 = s.rowid AND c.fk_soc = ' . $object->thirdparty->id . '';
|
||||
|
||||
$resqlorderlist = $this->db->query($sql);
|
||||
if ($resqlorderlist)
|
||||
$num = 0;
|
||||
|
||||
if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto)))
|
||||
{
|
||||
$num = $this->db->num_rows($resqlorderlist);
|
||||
$i = 0;
|
||||
|
||||
print '<br><form action="" method="POST" name="LinkedOrder">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("RefCustomer") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
print '<div id="'.$key.'list"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
|
||||
$sql = $possiblelink['sql'];
|
||||
$resqllist = $this->db->query($sql);
|
||||
if ($resqllist)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
|
||||
print '</td>';
|
||||
print '<td align="center">' . $objp->ref . '</td>';
|
||||
print '<td>' . $objp->ref_client . '</td>';
|
||||
print '<td>' . price($objp->total_ht) . '</td>';
|
||||
print '<td>' . $objp->name . '</td>';
|
||||
$num = $this->db->num_rows($resqllist);
|
||||
$i = 0;
|
||||
|
||||
print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addlink">';
|
||||
print '<input type="hidden" name="addlink" value="'.$key.'">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("RefCustomer") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i ++;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
|
||||
print '</td>';
|
||||
print '<td align="center">' . $objp->ref . '</td>';
|
||||
print '<td>' . $objp->ref_client . '</td>';
|
||||
print '<td>' . price($objp->total_ht) . '</td>';
|
||||
print '<td>' . $objp->name . '</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
|
||||
|
||||
print '</form>';
|
||||
$this->db->free($resqllist);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
print '</table>';
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
|
||||
|
||||
print '</form>';
|
||||
$this->db->free($resqlorderlist);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
print '</div>';
|
||||
if ($num > 0)
|
||||
{
|
||||
print '
|
||||
<!-- Add js to show linkto box for '.$key.' ('.$num.' records) -->
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linkto'.$key.'").click(function() {
|
||||
jQuery("#'.$key.'list").toggle();
|
||||
jQuery("#linkto'.$key.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
$linktoelem.=($linktoelem?' ':'');
|
||||
if ($num > 0) $linktoelem.='<a href="#linkto'.$key.'" id="linkto'.$key.'">' . $langs->trans($possiblelink['label']) .' ('.$num.')</a>';
|
||||
//else $linktoelem.=$langs->trans($possiblelink['label']);
|
||||
else $linktoelem.='<a href="#linkto'.$key.'" class="disabled" id="linkto'.$key.'">' . $langs->trans($possiblelink['label']) . '</a>';
|
||||
}
|
||||
|
||||
if ((empty($restrictlinksto) || (in_array('fichinter',$restrictlinksto))) && ! empty($conf->ficheinter->enabled))
|
||||
{
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedFichinter') . '</a>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linktoorder").click(function() {
|
||||
jQuery("#orderlist").toggle();
|
||||
jQuery("#linktoorder").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<div id="orderlist"'.(empty($conf->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 '<br><form action="" method="POST" name="LinkedFichinter">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="LinkedFichinter" value=' . $objp->rowid . '>';
|
||||
print '<td align="center">' . $objp->ref . '</td>';
|
||||
print '<td>' . $objp->name . '</td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
|
||||
print '</form>';
|
||||
$this->db->free($resqlorderlist);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ((empty($restrictlinksto) || in_array('supplier_order',$restrictlinksto))
|
||||
&& ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linktoorder").click(function() {
|
||||
jQuery("#orderlist").toggle();
|
||||
jQuery("#linktoorder").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<div id="orderlist"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_supplier, c.total_ht";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c";
|
||||
$sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $object->thirdparty->id;
|
||||
|
||||
$resqlorderlist = $this->db->query($sql);
|
||||
if ($resqlorderlist)
|
||||
{
|
||||
$num = $this->db->num_rows($resqlorderlist);
|
||||
$i = 0;
|
||||
|
||||
print '<br><form action="" method="POST" name="LinkedOrder">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("RefSupplier") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
|
||||
print '</td>';
|
||||
print '<td align="center">' . $objp->ref . '</td>';
|
||||
print '<td>' . $objp->ref_supplier . '</td>';
|
||||
print '<td>' . price($objp->total_ht) . '</td>';
|
||||
print '<td>' . $objp->name . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
|
||||
print '</form>';
|
||||
$this->db->free($resqlorderlist);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
return $linktoelem;
|
||||
}
|
||||
|
||||
|
||||
@ -1836,8 +1836,8 @@ else if ($id || $ref)
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
//if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
|
||||
@ -2099,11 +2099,9 @@ if ($action != 'create' && $action != 'edit' && ($id || $ref))
|
||||
|
||||
// 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 '<br>'.$linktoelem;
|
||||
|
||||
if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION)) $linktoelements[]='fichinter';
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
}
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -1667,9 +1667,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -2834,8 +2834,8 @@ elseif (! empty($object->id))
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order_supplier'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
@ -2239,9 +2239,9 @@ else
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice_supplier'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//print '</td><td valign="top" width="50%">';
|
||||
|
||||
@ -640,6 +640,14 @@ NewAttribute=Nouvel attribut
|
||||
AttributeCode=Code de l'attribut
|
||||
URLPhoto=URL de la photo/logo
|
||||
SetLinkToAnotherThirdParty=Lier vers un autre tiers
|
||||
LinkToProposal=Link to proposal
|
||||
LinkToOrder=Link to order
|
||||
LinkToInvoice=Link to invoice
|
||||
LinkToSupplierOrder=Link to supplier order
|
||||
LinkToSupplierProposal=Link to supplier proposal
|
||||
LinkToSupplierInvoice=Link to supplier invoice
|
||||
LinkToContract=Link to contract
|
||||
LinkToIntervention=Link to intervention
|
||||
CreateDraft=Créer brouillon
|
||||
SetToDraft=Retour en brouillon
|
||||
ClickToEdit=Cliquer ici pour éditer
|
||||
|
||||
@ -366,8 +366,8 @@ print '<tr><td class="fieldrequired">'.$langs->trans("Fieldimport_key").'</td><t
|
||||
// Example 2 : Adding links to objects
|
||||
//$somethingshown=$form->showLinkedObjectBlock($object);
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
//if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1809,9 +1809,10 @@ if ($action == 'create')
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
|
||||
Loading…
Reference in New Issue
Block a user