Fix: When creating invoice from other object, type must be standard only

This commit is contained in:
Laurent Destailleur 2013-02-17 17:12:19 +01:00
parent e56e182fe9
commit 9a951e4d6d

View File

@ -1935,63 +1935,66 @@ if ($action == 'create')
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print $desc; print $desc;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
}
if ($socid > 0) if ($socid > 0)
{ {
// Replacement // Replacement
print '<tr height="18"><td valign="middle">'; print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="1"'.(GETPOST('type')==1?' checked="checked"':''); print '<input type="radio" name="type" value="1"'.(GETPOST('type')==1?' checked="checked"':'');
if (! $options) print ' disabled="disabled"'; if (! $options) print ' disabled="disabled"';
print '>'; print '>';
print '</td><td valign="middle">'; print '</td><td valign="middle">';
$text=$langs->trans("InvoiceReplacementAsk").' '; $text=$langs->trans("InvoiceReplacementAsk").' ';
$text.='<select class="flat" name="fac_replacement" id="fac_replacement"'; $text.='<select class="flat" name="fac_replacement" id="fac_replacement"';
if (! $options) $text.=' disabled="disabled"'; if (! $options) $text.=' disabled="disabled"';
$text.='>'; $text.='>';
if ($options) if ($options)
{ {
$text.='<option value="-1"></option>'; $text.='<option value="-1"></option>';
$text.=$options; $text.=$options;
} }
else else
{ {
$text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>'; $text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>';
} }
$text.='</select>'; $text.='</select>';
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
print $desc; print $desc;
print '</td></tr>'."\n"; print '</td></tr>'."\n";
}
// Credit note if (empty($origin) && $socid > 0)
print '<tr height="18"><td valign="middle">'; {
print '<input type="radio" name="type" value="2"'.(GETPOST('type')==2?' checked=true':''); // Credit note
if (! $optionsav) print ' disabled="disabled"'; print '<tr height="18"><td valign="middle">';
print '>'; print '<input type="radio" name="type" value="2"'.(GETPOST('type')==2?' checked=true':'');
print '</td><td valign="middle">'; if (! $optionsav) print ' disabled="disabled"';
$text=$langs->transnoentities("InvoiceAvoirAsk").' '; print '>';
// $text.='<input type="text" value="">'; print '</td><td valign="middle">';
$text.='<select class="flat" name="fac_avoir" id="fac_avoir"'; $text=$langs->transnoentities("InvoiceAvoirAsk").' ';
if (! $optionsav) $text.=' disabled="disabled"'; // $text.='<input type="text" value="">';
$text.='>'; $text.='<select class="flat" name="fac_avoir" id="fac_avoir"';
if ($optionsav) if (! $optionsav) $text.=' disabled="disabled"';
{ $text.='>';
$text.='<option value="-1"></option>'; if ($optionsav)
$text.=$optionsav; {
} $text.='<option value="-1"></option>';
else $text.=$optionsav;
{ }
$text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>'; else
} {
$text.='</select>'; $text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
$desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); }
print $desc; $text.='</select>';
print '</td></tr>'."\n"; $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
} print $desc;
print '</td></tr>'."\n";
} }
print '</table>'; print '</table>';
print '</td></tr>'; print '</td></tr>';
if($socid>0) if ($socid > 0)
{ {
// Discounts for third party // Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';