diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 07989b457dea67b5d90e8f4590d833cbc8ed1fe5..a4aff6d71c145e321f9093be11aa9917cda356a7 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -341,22 +341,22 @@ if ($socid > 0) $var = !$var; print "<tr ".$bc[$var].">"; print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>'; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print '<td class="nowrap">'; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print '</td>'; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print '<td class="nowrap">'; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print '</td>'; } else @@ -500,22 +500,22 @@ if ($socid > 0) $var = !$var; print "<tr ".$bc[$var].">"; print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>'; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print '<td class="nowrap">'; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print '</td>'; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print '<td class="nowrap">'; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print '</td>'; } else diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4dbc60569bbd15352c72702f5ec0fe7d0f3c0a7b..489eee739329a85c35a8c93fe65492d052b7b213 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1900,8 +1900,8 @@ if ($action == 'create' && $user->rights->commande->creer) // invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } // Relative and absolute discounts diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 79045fe54b9447d8006ce532539a55b7237615f2..8604e95b5a28a244106362c3eff3c6cd72bcbc4a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2563,8 +2563,8 @@ else if ($id > 0 || ! empty($ref)) $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); @@ -2982,9 +2982,9 @@ else if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir if (! $absolute_discount) print '<br>'; - // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, - // $filtercreditnote, $resteapayer); - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We allow credit note even if amount is higher + // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer + $more=' ('.$addcreditnote.')'; + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher } } if (! $absolute_discount && ! $absolute_creditnote) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7232f6ec2708f06a3f0fcaadec43ecdbdc37a708..8fb0118cd2e29adfcff1ed140e6070e8bbe525ac 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1128,8 +1128,8 @@ class Form { $obj = $this->db->fetch_object($resql); $desc=dol_trunc($obj->description,40); - if ($desc=='(CREDIT_NOTE)') $desc=$langs->trans("CreditNote"); - if ($desc=='(DEPOSIT)') $desc=$langs->trans("Deposit"); + if (preg_match('/\(CREDIT_NOTE\)/', $desc)) $desc=preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc); + if (preg_match('/\(DEPOSIT\)/', $desc)) $desc=preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc); $selectstring=''; if ($selected > 0 && $selected == $obj->rowid) $selectstring=' selected'; @@ -3762,7 +3762,7 @@ class Form } else { - if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",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)).': '; } $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles @@ -3773,7 +3773,7 @@ class Form 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='(DEPOSIT)')") print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; + 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 '>'; } if ($more) print $more;