change conf usage
This commit is contained in:
parent
79fe664365
commit
81adc6913e
@ -96,9 +96,26 @@ print "</tr>\n";
|
|||||||
|
|
||||||
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
|
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
|
||||||
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
|
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
|
||||||
_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
|
//_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
|
||||||
_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
|
||||||
_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
|
$confkey = 'INVOICE_USE_RETAINED_WARRANTY';
|
||||||
|
|
||||||
|
$arrayAvailableType = array(
|
||||||
|
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
|
||||||
|
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
|
||||||
|
);
|
||||||
|
$selected = array();
|
||||||
|
$implodeglue = '+';
|
||||||
|
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
|
||||||
|
$selected = explode('+', $conf->global->{$confkey});
|
||||||
|
}
|
||||||
|
|
||||||
|
$curentInput = (empty($inputCount)?1:($inputCount+1));
|
||||||
|
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
|
||||||
|
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
|
||||||
|
|
||||||
|
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
|
||||||
|
_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
|
||||||
|
|
||||||
$metas = array(
|
$metas = array(
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
@ -229,8 +246,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
|
|||||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
if ($type=='textarea') {
|
if ($type=='textarea') {
|
||||||
print '<textarea ' . $metascompil . ' >' . dol_htmlentities($conf->global->{$confkey}) . '</textarea>';
|
print '<textarea ' . $metascompil . ' >' . dol_htmlentities($conf->global->{$confkey}) . '</textarea>';
|
||||||
} else {
|
}elseif($type=='input'){
|
||||||
print '<input '.$metascompil.' />';
|
print '<input '.$metascompil.' />';
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
// custom
|
||||||
|
print $type;
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,10 +140,9 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
|||||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||||
|
|
||||||
// retained warranty invoice available type
|
// retained warranty invoice available type
|
||||||
if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) {
|
$retainedWarrantyInvoiceAvailableType=array();
|
||||||
$retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION, Facture::TYPE_STANDARD);
|
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||||
} else {
|
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
||||||
$retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4750,15 +4750,15 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// TODO : add a flag on invoices to store this conf : USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL
|
// TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION
|
||||||
|
|
||||||
// note : we dont need to test USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
|
||||||
|
|
||||||
$displayWarranty = false;
|
$displayWarranty = false;
|
||||||
if(!empty($this->retained_warranty)) {
|
if(!empty($this->retained_warranty)) {
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
|
|
||||||
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL)) {
|
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
|
||||||
// Check if this situation invoice is 100% for real
|
// Check if this situation invoice is 100% for real
|
||||||
$displayWarranty = false;
|
$displayWarranty = false;
|
||||||
if (!empty($this->situation_final)) {
|
if (!empty($this->situation_final)) {
|
||||||
@ -4794,7 +4794,7 @@ class Facture extends CommonInvoice
|
|||||||
$retainedWarrantyAmount = 0;
|
$retainedWarrantyAmount = 0;
|
||||||
|
|
||||||
// Billed - retained warranty
|
// Billed - retained warranty
|
||||||
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL))
|
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
|
||||||
{
|
{
|
||||||
$displayWarranty = true;
|
$displayWarranty = true;
|
||||||
// Check if this situation invoice is 100% for real
|
// Check if this situation invoice is 100% for real
|
||||||
|
|||||||
@ -219,6 +219,7 @@ ShowInvoiceSituation=Show situation invoice
|
|||||||
UseSituationInvoices=Allow situation invoice
|
UseSituationInvoices=Allow situation invoice
|
||||||
UseSituationInvoicesCreditNote=Allow situation invoice credit note
|
UseSituationInvoicesCreditNote=Allow situation invoice credit note
|
||||||
Retainedwarranty=Retained warranty
|
Retainedwarranty=Retained warranty
|
||||||
|
AllowedInvoiceForRetainedWarranty=Retained warranty usable on the following types of invoices
|
||||||
RetainedwarrantyDefaultPercent=Retained warranty default percent
|
RetainedwarrantyDefaultPercent=Retained warranty default percent
|
||||||
RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices
|
RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices
|
||||||
RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation
|
RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user