Skip to content

Commit

Permalink
Close #8907
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 1, 2019
1 parent b79831e commit ce090d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
13 changes: 10 additions & 3 deletions htdocs/fourn/card.php
Expand Up @@ -605,9 +605,16 @@
$sql2.= ' WHERE c.fk_soc = s.rowid';
$sql2.= " AND c.entity IN (".getEntity('commande_fournisseur').")";
$sql2.= ' AND s.rowid = '.$object->id;
// Show orders with status validated, shipping started and delivered (even if any order we can bill).
//$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")";
$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/orderstoinvoice.php
// Show orders we can bill
if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS))
{
$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/orderstoinvoice.php
}
else
{
// CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
$sql2.= " AND c.fk_statut IN (".$db->escape($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
}
$sql2.= " AND c.billed = 0";
// Find order that are not already invoiced
// just need to check received status because we have the billed status now
Expand Down
13 changes: 11 additions & 2 deletions htdocs/fourn/commande/orderstoinvoice.php
Expand Up @@ -449,8 +449,17 @@
$sql .= ' WHERE c.entity = ' . $conf->entity;
$sql .= ' AND c.fk_soc = s.rowid';

// Show orders with status validated, shipping started and delivered (well any order we can bill)
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/card.php
// Show orders we can bill
if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS))
{
$sql.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/card.php
}
else
{
// CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
$sql.= " AND c.fk_statut IN (".$db->escape($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
}

$sql .= " AND c.billed = 0";

// Find order that are not already invoiced
Expand Down

0 comments on commit ce090d4

Please sign in to comment.