From a9e55fd08f48fd7193afeeac76cd13940ea91f88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Oct 2015 12:57:58 +0200 Subject: [PATCH] FIX Missing contracts into list in page of Refering objects of a thirdparty. --- htdocs/langs/en_US/companies.lang | 2 +- htdocs/societe/consumption.php | 31 ++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 764ca969350..74a1045215f 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -406,7 +406,7 @@ UniqueThirdParties=Total of unique third parties InActivity=Open ActivityCeased=Closed ActivityStateFilter=Activity status -ProductsIntoElements=List of products into %s +ProductsIntoElements=List of products/services into %s CurrentOutstandingBill=Current outstanding bill OutstandingBill=Max. for outstanding bill OutstandingBillReached=Reached max. for outstanding bill diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index d28c7af5c2e..e075f67cdaf 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -78,6 +78,7 @@ $langs->load("orders"); $langs->load("suppliers"); $langs->load("propal"); $langs->load("interventions"); +$langs->load("contracts"); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('consumptionthirdparty')); @@ -149,7 +150,8 @@ if ($object->client) if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); - if ($conf->ficheinter>enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); + if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); } if ($object->fournisseur) @@ -265,10 +267,24 @@ if ($type_element == 'supplier_order') $doc_number='c.ref'; $thirdTypeSelect='supplier'; } +if ($type_element == 'contract') +{ // Supplier : Show products from orders. + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + $documentstatic=new Contrat($db); + $documentstaticline=new ContratLigne($db); + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; + $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; + $where.= " AND d.fk_contrat = c.rowid"; + $dateprint = 'c.date_valid'; + $doc_number='c.ref'; + $thirdTypeSelect='customer'; +} $sql = $sql_select; $sql.= ' d.description as description,'; -if ($type_element != 'fichinter') $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,'; +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,'; +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,'; 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,'; $sql.= " s.rowid as socid "; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; @@ -351,6 +367,8 @@ if ($sql_select) $documentstatic->statut=$objp->status; $documentstatic->status=$objp->status; $documentstatic->paye=$objp->paid; + + if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; $var=!$var; print ""; @@ -361,7 +379,14 @@ if ($sql_select) // Status print ''; - print $documentstatic->getLibStatut(2); + if ($type_element == 'contract') + { + print $documentstaticline->getLibStatut(2); + } + else + { + print $documentstatic->getLibStatut(2); + } print ''; print '';