diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a8e6f33b950..79b9d30d948 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -542,8 +542,8 @@ if ($type) $sql.= " AND ca.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started -if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } -if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } +if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100)"; } +if ($status == 'todo') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 0ac7dae09ee..eb2f6f112c7 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -295,8 +295,8 @@ if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == '100') { $sql.= " AND a.percent = 100"; } -if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } -if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } +if ($status == 'done') { $sql.= " AND (a.percent = 100)"; } +if ($status == 'todo') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } if ($search_id) $sql.=natural_search("a.id", $search_id, 1); if ($search_title) $sql.=natural_search("a.label", $search_title); // We must filter on assignement table diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 883d6594bab..2fdfa180319 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -424,8 +424,8 @@ if ($type) $sql.= " AND ca.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started -if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } -if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } +if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100)"; } +if ($status == 'todo') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 7bd620fc225..0cf056ef3a9 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -451,8 +451,8 @@ if ($type) $sql.= " AND ca.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started -if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } -if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } +if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100)"; } +if ($status == 'todo') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0d13c45e5bd..2bb08861342 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -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 ''; @@ -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 ";