Fix message of discount
This commit is contained in:
parent
b412f0b76b
commit
0abcf5694c
@ -220,15 +220,15 @@ class Contact extends CommonObject
|
|||||||
$sql.= ", import_key";
|
$sql.= ", import_key";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= "'".$this->db->idate($now)."',";
|
$sql.= "'".$this->db->idate($now)."',";
|
||||||
if ($this->socid > 0) $sql.= " ".$this->socid.",";
|
if ($this->socid > 0) $sql.= " ".$this->db->escape($this->socid).",";
|
||||||
else $sql.= "null,";
|
else $sql.= "null,";
|
||||||
$sql.= "'".$this->db->escape($this->lastname)."',";
|
$sql.= "'".$this->db->escape($this->lastname)."',";
|
||||||
$sql.= "'".$this->db->escape($this->firstname)."',";
|
$sql.= "'".$this->db->escape($this->firstname)."',";
|
||||||
$sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").",";
|
$sql.= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"null").",";
|
||||||
$sql.= " ".$this->priv.",";
|
$sql.= " ".$this->db->escape($this->priv).",";
|
||||||
$sql.= " ".$this->statut.",";
|
$sql.= " ".$this->db->escape($this->statut).",";
|
||||||
$sql.= " ".(! empty($this->canvas)?"'".$this->db->escape($this->canvas)."'":"null").",";
|
$sql.= " ".(! empty($this->canvas)?"'".$this->db->escape($this->canvas)."'":"null").",";
|
||||||
$sql.= " ".$entity.",";
|
$sql.= " ".$this->db->escape($entity).",";
|
||||||
$sql.= "'".$this->db->escape($this->ref_ext)."',";
|
$sql.= "'".$this->db->escape($this->ref_ext)."',";
|
||||||
$sql.= " ".(! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
$sql.= " ".(! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
@ -349,7 +349,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||||
$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
|
$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
|
||||||
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
||||||
$sql .= ", statut = ".$this->statut;
|
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
||||||
$sql .= ", default_lang=".($this->default_lang?"'".$this->db->escape($this->default_lang)."'":"NULL");
|
$sql .= ", default_lang=".($this->default_lang?"'".$this->db->escape($this->default_lang)."'":"NULL");
|
||||||
$sql .= ", no_email=".($this->no_email?"'".$this->db->escape($this->no_email)."'":"0");
|
$sql .= ", no_email=".($this->no_email?"'".$this->db->escape($this->no_email)."'":"0");
|
||||||
|
|||||||
@ -258,6 +258,7 @@ function GETPOSTISSET($paramname)
|
|||||||
* ''=no check (deprecated)
|
* ''=no check (deprecated)
|
||||||
* 'none'=no check (only for param that should have very rich content)
|
* 'none'=no check (only for param that should have very rich content)
|
||||||
* 'int'=check it's numeric (integer or float)
|
* 'int'=check it's numeric (integer or float)
|
||||||
|
* 'intcomma'=check it's integer+comma ('1,2,3,4...')
|
||||||
* 'alpha'=check it's text and sign
|
* 'alpha'=check it's text and sign
|
||||||
* 'aZ'=check it's a-z only
|
* 'aZ'=check it's a-z only
|
||||||
* 'aZ09'=check it's simple alpha string (recommended for keys)
|
* 'aZ09'=check it's simple alpha string (recommended for keys)
|
||||||
|
|||||||
@ -34,16 +34,20 @@ $addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thir
|
|||||||
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
||||||
|
|
||||||
$fixedDiscount = $thirdparty->remise_percent;
|
$fixedDiscount = $thirdparty->remise_percent;
|
||||||
|
|
||||||
if(! empty($discount_type)) {
|
if(! empty($discount_type)) {
|
||||||
$fixedDiscount = $thirdparty->remise_supplier_percent;
|
$fixedDiscount = $thirdparty->remise_supplier_percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
$translationKey = ! empty($discount_type) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
|
|
||||||
if ($fixedDiscount > 0)
|
if ($fixedDiscount > 0)
|
||||||
|
{
|
||||||
|
$translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
|
||||||
print $langs->trans($translationKey, $fixedDiscount).'.';
|
print $langs->trans($translationKey, $fixedDiscount).'.';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
$translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
|
||||||
print $langs->trans($translationKey).'.';
|
print $langs->trans($translationKey).'.';
|
||||||
|
}
|
||||||
if($isNewObject) print ' ('.$addrelativediscount.')';
|
if($isNewObject) print ' ('.$addrelativediscount.')';
|
||||||
|
|
||||||
// Is there is commercial discount or down payment available ?
|
// Is there is commercial discount or down payment available ?
|
||||||
@ -56,7 +60,7 @@ if ($absolute_discount > 0) {
|
|||||||
if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
|
if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
|
||||||
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
|
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isNewObject) {
|
if ($isNewObject) {
|
||||||
$text.= ' ('.$addabsolutediscount.')';
|
$text.= ' ('.$addabsolutediscount.')';
|
||||||
}
|
}
|
||||||
@ -71,7 +75,7 @@ if ($absolute_discount > 0) {
|
|||||||
|
|
||||||
// Is there credit notes availables ?
|
// Is there credit notes availables ?
|
||||||
if ($absolute_creditnote > 0) {
|
if ($absolute_creditnote > 0) {
|
||||||
|
|
||||||
// If validated, we show link "add credit note to payment"
|
// If validated, we show link "add credit note to payment"
|
||||||
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) {
|
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) {
|
||||||
$translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
|
$translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
|
||||||
@ -80,7 +84,7 @@ if ($absolute_creditnote > 0) {
|
|||||||
if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) {
|
if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) {
|
||||||
$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
|
$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($absolute_discount <= 0 || $isNewObject) {
|
if ($absolute_discount <= 0 || $isNewObject) {
|
||||||
$text.= '('.$addabsolutediscount.')';
|
$text.= '('.$addabsolutediscount.')';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user