Add supplier proposal in linkedObjects type select of the suppliers

This commit is contained in:
atm-greg 2018-05-31 10:46:50 +02:00
parent 2a579b707a
commit 0785029fe0

View File

@ -168,6 +168,7 @@ if ($object->fournisseur)
$thirdTypeArray['supplier']=$langs->trans("supplier");
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices');
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders');
if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
}
print '</table>';
@ -254,6 +255,19 @@ if ($type_element == 'supplier_invoice')
$doc_number='f.ref';
$thirdTypeSelect='supplier';
}
if ($type_element == 'supplier_proposal')
{
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$documentstatic=new SupplierProposal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_supplier_proposal = c.rowid";
$where.= " AND c.entity = ".$conf->entity;
$dateprint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
}
if ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
@ -286,7 +300,8 @@ if (!empty($sql_select))
{
$sql = $sql_select;
$sql.= ' d.description as description,';
if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,';
$sql.= " s.rowid as socid ";