Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9349f27742
@ -424,7 +424,7 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
// Link for paypal payment
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||||
|
|||||||
@ -2324,9 +2324,9 @@ if ($action == 'create')
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
// print '</td><td valign="top" width="50%">';
|
// print '</td><td valign="top" width="50%">';
|
||||||
|
|||||||
@ -2589,9 +2589,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
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
|
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
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||||
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||||
@ -4030,9 +4022,9 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
// Link for paypal payment
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||||
|
|||||||
@ -1996,8 +1996,8 @@ else
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?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
|
* 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
|
||||||
@ -18,22 +18,29 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/actions_dellink.inc.php
|
* \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
|
// $action must be defined
|
||||||
// $object must be defined
|
// $object must be defined
|
||||||
// $permissiondellink must be defined
|
// $permissiondellink must be defined
|
||||||
// $uploaddir (example $conf->projet->dir_output . "/";)
|
|
||||||
|
|
||||||
$dellinkid = GETPOST('dellinkid','int');
|
$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)
|
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0)
|
||||||
{
|
{
|
||||||
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
|
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
|
||||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2380,6 +2380,10 @@ abstract class CommonObject
|
|||||||
$origin = (! empty($origin) ? $origin : $this->origin);
|
$origin = (! empty($origin) ? $origin : $this->origin);
|
||||||
$origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id);
|
$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();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||||
@ -2564,7 +2568,10 @@ abstract class CommonObject
|
|||||||
// Set classfile
|
// Set classfile
|
||||||
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
|
$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';
|
$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
|
||||||
}
|
}
|
||||||
else if ($objecttype == 'order_supplier') {
|
else if ($objecttype == 'order_supplier') {
|
||||||
@ -2584,15 +2591,18 @@ abstract class CommonObject
|
|||||||
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||||
{
|
{
|
||||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||||
|
//print '/'.$classpath.'/'.$classfile.'.class.php';
|
||||||
foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
$object = new $classname($this->db);
|
foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element
|
||||||
$ret = $object->fetch($objectid);
|
{
|
||||||
if ($ret >= 0)
|
$object = new $classname($this->db);
|
||||||
{
|
$ret = $object->fetch($objectid);
|
||||||
$this->linkedObjects[$objecttype][$i] = $object;
|
if ($ret >= 0)
|
||||||
}
|
{
|
||||||
|
$this->linkedObjects[$objecttype][$i] = $object;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5267,12 +5267,13 @@ class Form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show block with links to link to other objects.
|
* Show block with links to link to other objects.
|
||||||
*
|
*
|
||||||
* @param CommonObject $object Object we want to show links to
|
* @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')
|
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction.
|
||||||
* @return string <0 if KO, >0 if OK
|
* @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 $conf, $langs, $hookmanager;
|
||||||
global $bc;
|
global $bc;
|
||||||
@ -5281,202 +5282,90 @@ class Form
|
|||||||
|
|
||||||
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
||||||
|
|
||||||
|
$possiblelinks=array(
|
||||||
if (((! is_array($restrictlinksto)) || in_array('order',$restrictlinksto))
|
'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),
|
||||||
&& ! empty($conf->commande->enabled))
|
'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>';
|
$num = 0;
|
||||||
|
|
||||||
print '
|
if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto)))
|
||||||
<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 = $this->db->num_rows($resqlorderlist);
|
print '<div id="'.$key.'list"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
|
||||||
$i = 0;
|
$sql = $possiblelink['sql'];
|
||||||
|
$resqllist = $this->db->query($sql);
|
||||||
print '<br><form action="" method="POST" name="LinkedOrder">';
|
if ($resqllist)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($resqlorderlist);
|
$num = $this->db->num_rows($resqllist);
|
||||||
|
$i = 0;
|
||||||
$var = ! $var;
|
|
||||||
print '<tr ' . $bc [$var] . '>';
|
print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
|
||||||
print '<td aling="left">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
|
print '<input type="hidden" name="action" value="addlink">';
|
||||||
print '</td>';
|
print '<input type="hidden" name="addlink" value="'.$key.'">';
|
||||||
print '<td align="center">' . $objp->ref . '</td>';
|
print '<table class="noborder">';
|
||||||
print '<td>' . $objp->ref_client . '</td>';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . price($objp->total_ht) . '</td>';
|
print '<td class="nowrap"></td>';
|
||||||
print '<td>' . $objp->name . '</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>';
|
print '</tr>';
|
||||||
|
while ($i < $num)
|
||||||
$i ++;
|
{
|
||||||
|
$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>';
|
||||||
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>';
|
if ($num > 0)
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
$this->db->free($resqlorderlist);
|
|
||||||
} else {
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((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);
|
print '
|
||||||
|
<!-- Add js to show linkto box for '.$key.' ('.$num.' records) -->
|
||||||
$var = ! $var;
|
<script type="text/javascript" language="javascript">
|
||||||
print '<tr ' . $bc [$var] . '>';
|
jQuery(document).ready(function() {
|
||||||
print '<td aling="left">';
|
jQuery("#linkto'.$key.'").click(function() {
|
||||||
print '<input type="radio" name="LinkedFichinter" value=' . $objp->rowid . '>';
|
jQuery("#'.$key.'list").toggle();
|
||||||
print '<td align="center">' . $objp->ref . '</td>';
|
jQuery("#linkto'.$key.'").toggle();
|
||||||
print '<td>' . $objp->name . '</td>';
|
});
|
||||||
print '</td>';
|
});
|
||||||
print '</tr>';
|
</script>
|
||||||
|
';
|
||||||
$i ++;
|
}
|
||||||
}
|
|
||||||
print '</table>';
|
$linktoelem.=($linktoelem?' ':'');
|
||||||
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>';
|
if ($num > 0) $linktoelem.='<a href="#linkto'.$key.'" id="linkto'.$key.'">' . $langs->trans($possiblelink['label']) .' ('.$num.')</a>';
|
||||||
print '</form>';
|
//else $linktoelem.=$langs->trans($possiblelink['label']);
|
||||||
$this->db->free($resqlorderlist);
|
else $linktoelem.='<a href="#linkto'.$key.'" class="disabled" id="linkto'.$key.'">' . $langs->trans($possiblelink['label']) . '</a>';
|
||||||
} else {
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((! is_array($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;
|
return $linktoelem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1836,8 +1836,8 @@ else if ($id || $ref)
|
|||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
//if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
|
|||||||
@ -2068,11 +2068,9 @@ if ($action != 'create' && $action != 'edit' && ($id || $ref))
|
|||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelements=array();
|
$linktoelements=array();
|
||||||
if($conf->global->EXPENSES_LINK_TO_INTERVENTION) $linktoelements[]='fichinter';
|
if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION)) $linktoelements[]='fichinter';
|
||||||
$linktoelem='';
|
$linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport'));
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object,$linktoelements);
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
@ -1681,9 +1681,9 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter'));
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
|||||||
@ -2834,8 +2834,8 @@ elseif (! empty($object->id))
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order_supplier'));
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|||||||
@ -2240,9 +2240,9 @@ else
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice_supplier'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
//print '</td><td valign="top" width="50%">';
|
//print '</td><td valign="top" width="50%">';
|
||||||
|
|||||||
@ -641,6 +641,14 @@ NewAttribute=Nouvel attribut
|
|||||||
AttributeCode=Code de l'attribut
|
AttributeCode=Code de l'attribut
|
||||||
URLPhoto=URL de la photo/logo
|
URLPhoto=URL de la photo/logo
|
||||||
SetLinkToAnotherThirdParty=Lier vers un autre tiers
|
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
|
CreateDraft=Créer brouillon
|
||||||
SetToDraft=Retour en brouillon
|
SetToDraft=Retour en brouillon
|
||||||
ClickToEdit=Cliquer ici pour éditer
|
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
|
// Example 2 : Adding links to objects
|
||||||
//$somethingshown=$form->showLinkedObjectBlock($object);
|
//$somethingshown=$form->showLinkedObjectBlock($object);
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($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);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal'));
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user