Fix search on invoice type

This commit is contained in:
Laurent Destailleur 2016-09-29 10:38:15 +02:00
parent 95e02d985e
commit 5c9fa28e79
2 changed files with 15 additions and 8 deletions

View File

@ -690,9 +690,15 @@ if ($resql)
// Type // Type
if (! empty($arrayfields['f.type']['checked'])) if (! empty($arrayfields['f.type']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="right">'; print '<td class="liste_titre maxwidthonsmartphone">';
$listtype=array('0'=>$langs->trans("InvoiceStandard"), '1'=>$langs->trans("InvoiceReplacement"), '2'=>$langs->trans("InvoiceAvoir"), '3'=>$langs->trans("InvoiceDeposit"), '4'=>$langs->trans("InvoiceProForma"), '5'=>$langs->trans("InvoiceDeposit")); $listtype=array(
print $form->selectarray('search_type', $listtype, $search_type, 1); Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
);
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
print '</td>'; print '</td>';
} }
// Date invoice // Date invoice
@ -741,7 +747,7 @@ if ($resql)
if (! empty($arrayfields['typent.code']['checked'])) if (! empty($arrayfields['typent.code']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="center">'; print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100');
print '</td>'; print '</td>';
} }
// Payment mode // Payment mode
@ -852,6 +858,7 @@ if ($resql)
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->type=$obj->type;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))
@ -901,7 +908,7 @@ if ($resql)
if (! empty($arrayfields['f.type']['checked'])) if (! empty($arrayfields['f.type']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print $object->getLibType($obj->type); print $facturestatic->getLibType();
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -198,9 +198,9 @@ abstract class CommonInvoice extends CommonObject
} }
/** /**
* Retourne le libelle du type de facture * Return label of type of invoice
* *
* @return string Libelle * @return string Label of type of invoice
*/ */
function getLibType() function getLibType()
{ {
@ -209,7 +209,7 @@ abstract class CommonInvoice extends CommonObject
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
return $langs->trans("Unknown"); return $langs->trans("Unknown");
} }