forked from Wavyzz/dolibarr
Fix check on VAT syntax not visible on list
This commit is contained in:
@@ -3441,16 +3441,17 @@ function img_info($titlealt = 'default')
|
|||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute.
|
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute.
|
||||||
|
* @param string $morecss Add more CSS
|
||||||
* @return string Return img tag
|
* @return string Return img tag
|
||||||
*/
|
*/
|
||||||
function img_warning($titlealt = 'default', $moreatt = '')
|
function img_warning($titlealt = 'default', $moreatt = '', $morecss = 'pictowarning')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
|
if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
|
||||||
|
|
||||||
//return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>';
|
//return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>';
|
||||||
return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): ''));
|
return img_picto($titlealt, 'warning.png', 'class="valignmiddle'.($morecss?' '.$morecss:'').'"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ function isValidVATID($company)
|
|||||||
$vatprefix = $company->country_code;
|
$vatprefix = $company->country_code;
|
||||||
if ($vatprefix == 'GR') $vatprefix = '(EL|GR)';
|
if ($vatprefix == 'GR') $vatprefix = '(EL|GR)';
|
||||||
else $vatprefix = preg_quote($vatprefix, '/');
|
else $vatprefix = preg_quote($vatprefix, '/');
|
||||||
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra))
|
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.\s]{5,12}$/', $company->tva_intra))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ require_once '../main.inc.php';
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||||
|
|
||||||
@@ -989,6 +990,8 @@ while ($i < min($num, $limit))
|
|||||||
$companystatic->fournisseur=$obj->fournisseur;
|
$companystatic->fournisseur=$obj->fournisseur;
|
||||||
$companystatic->code_client=$obj->code_client;
|
$companystatic->code_client=$obj->code_client;
|
||||||
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
||||||
|
$companystatic->tva_intra=$obj->tva_intra;
|
||||||
|
$companystatic->country_code=$obj->country_code;
|
||||||
|
|
||||||
$companystatic->code_compta_client=$obj->code_compta;
|
$companystatic->code_compta_client=$obj->code_compta;
|
||||||
$companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur;
|
$companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur;
|
||||||
@@ -1166,7 +1169,13 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.tva_intra']['checked']))
|
if (! empty($arrayfields['s.tva_intra']['checked']))
|
||||||
{
|
{
|
||||||
print "<td>".$obj->tva_intra."</td>\n";
|
print "<td>";
|
||||||
|
print $obj->tva_intra;
|
||||||
|
if ($obj->tva_intra && ! isValidVATID($companystatic))
|
||||||
|
{
|
||||||
|
print img_warning("BadVATNumber", '', '');
|
||||||
|
}
|
||||||
|
print "</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Type
|
// Type
|
||||||
|
|||||||
Reference in New Issue
Block a user