|
@@ -3910,15 +3910,16 @@ class Form
|
|
|
*
|
|
|
* @param string $page Page URL where form is shown
|
|
|
* @param int $selected Value pre-selected
|
|
|
- * @param string $htmlname Nom du formulaire select. Si 'none', non modifiable. Example 'remise_id'.
|
|
|
+ * @param string $htmlname Name of SELECT component. If 'none', not changeable. Example 'remise_id'.
|
|
|
* @param int $socid Third party id
|
|
|
* @param float $amount Total amount available
|
|
|
* @param string $filter SQL filter on discounts
|
|
|
* @param int $maxvalue Max value for lines that can be selected
|
|
|
* @param string $more More string to add
|
|
|
+ * @param int $hidelist 1=Hide list
|
|
|
* @return void
|
|
|
*/
|
|
|
- function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='')
|
|
|
+ function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0)
|
|
|
{
|
|
|
global $conf,$langs;
|
|
|
if ($htmlname != "none")
|
|
@@ -3929,25 +3930,30 @@ class Form
|
|
|
print '<div class="inline-block">';
|
|
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
|
|
{
|
|
|
- if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice
|
|
|
- else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
|
|
|
+ if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)); // If we want deposit to be substracted to payments only and not to total of final invoice
|
|
|
+ else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
|
|
|
- else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
|
|
|
+ if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
|
|
|
+ else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
|
|
|
}
|
|
|
- print '</div><div class="inline-block" style="padding-right: 10px">';
|
|
|
- $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
|
|
|
- if ($filter) $newfilter.=' AND ('.$filter.')';
|
|
|
- $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
|
|
|
- if ($nbqualifiedlines > 0)
|
|
|
+ if (empty($hidelist)) print ': ';
|
|
|
+ print '</div>';
|
|
|
+ if (empty($hidelist))
|
|
|
{
|
|
|
- print ' <input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
|
|
|
- if ($filter && $filter != "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
|
|
|
- print '>';
|
|
|
+ print '<div class="inline-block" style="padding-right: 10px">';
|
|
|
+ $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
|
|
|
+ if ($filter) $newfilter.=' AND ('.$filter.')';
|
|
|
+ $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
|
|
|
+ if ($nbqualifiedlines > 0)
|
|
|
+ {
|
|
|
+ print ' <input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
|
|
|
+ if ($filter && $filter != "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
|
|
|
+ print '>';
|
|
|
+ }
|
|
|
+ print '</div>';
|
|
|
}
|
|
|
- print '</div>';
|
|
|
if ($more)
|
|
|
{
|
|
|
print '<div class="inline-block">';
|