diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 9fe184d99ba..0c0eed06783 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2884,8 +2884,7 @@ else if ($id > 0 || ! empty($ref))
// Invoice content
$linkback = '' . $langs->trans("BackToList") . '';
-
-
+
$morehtmlref='
';
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 83da8f68e75..af543c5f5e8 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -70,6 +70,7 @@ $userid=GETPOST('userid','int');
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_refcustomer=GETPOST('search_refcustomer','alpha');
+$search_type=GETPOST('search_type','int');
$search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha');
@@ -142,6 +143,7 @@ $checkedtypetiers=0;
$arrayfields=array(
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
+ 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
@@ -191,6 +193,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
$search_product_category='';
$search_ref='';
$search_refcustomer='';
+ $search_type='';
$search_project='';
$search_societe='';
$search_montant_ht='';
@@ -295,6 +298,15 @@ if ($filtre)
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
+if ($search_type != '' && $search_type >= 0)
+{
+ if ($search_type == '0') $sql.=" AND f.type = 0"; // standard
+ if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement
+ if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note
+ if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit
+ if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma
+ if ($search_type == '5') $sql.=" AND f.type = 5"; // situation
+}
if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town);
@@ -310,7 +322,7 @@ if ($search_status != '' && $search_status >= 0)
{
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed
- if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some correupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
+ if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
}
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
@@ -400,7 +412,7 @@ if ($resql)
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
-
+
if ($socid)
{
$soc = new Societe($db);
@@ -419,6 +431,7 @@ if ($resql)
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
+ if ($search_type != '') $param.='&search_type='.urlencode($search_type);
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
@@ -438,7 +451,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
-
+
$arrayofmassactions=array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge")
@@ -457,7 +470,7 @@ if ($resql)
}
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
-
+
$i = 0;
print '