diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index fe41203e946..93316384c2a 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -286,7 +286,10 @@ if ($object->id > 0)
print '
| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
print '';
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 7d00fee0773..8391c6aab06 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -759,7 +759,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
- $regClient = array();
+ $regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{
$maskrefclient = $regClientRef[1].$regClientRef[2];
@@ -791,8 +791,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
}
// Extract value for user
- if (preg_match('/\{(u+)\}/i', $mask, $regType))
- {
+ $regType = array();
+ if (preg_match('/\{(u+)\}/i', $mask, $regType)) {
$lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
if (is_object($objuser)) $lastname = $objuser->lastname;
@@ -931,12 +931,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$sqlwhere .= " (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp1)."'";
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') ";
$sqlwhere .= ')';
- } elseif ($resetEveryMonth)
- {
+ } elseif ($resetEveryMonth) {
$sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."'";
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')";
- } else // reset is done on january
- {
+ } else { // reset is done on january
$sqlwhere .= '(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$db->escape($yearcomp)."')";
}
}
@@ -1040,8 +1038,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
} else dol_print_error($db);
$numFinal = $ref;
- } elseif ($mode == 'next')
- {
+ } elseif ($mode == 'next') {
$counter++;
// If value for $counter has a length higher than $maskcounter chars
@@ -1184,8 +1181,7 @@ function check_value($mask, $value)
$hasglobalcounter = false;
// Extract value for mask counter, mask raz and mask offset
$reg = array();
- if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
- {
+ if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) {
$masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : '');
$maskcounter = $reg[1];
$hasglobalcounter = true;
@@ -1253,31 +1249,25 @@ function check_value($mask, $value)
if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask';
//print "x".$maskwithonlyymcode." ".$maskraz;
}
- //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n";
+ //print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n";
- // Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter)
- //
+ if (function_exists('mb_strrpos')) {
+ $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
+ }
+ else {
+ $posnumstart = strrpos($maskwithnocode, $maskcounter);
+ } // Pos of counter in final string (from 0 to ...)
+ if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
- // Check length
- $len = dol_strlen($maskwithnocode);
- if (dol_strlen($value) != $len) $result = -1;
+ // Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter)
+ // TODO
- // Define $maskLike
- /* seems not used
- $maskLike = dol_string_nospecial($mask);
- $maskLike = str_replace("%","_",$maskLike);
- // Replace protected special codes with matching number of _ as wild card caracter
- $maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike);
- $maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike);
- $maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike);
- $maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike);
- $maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike);
- $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
- if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
- */
+ // Check length
+ $len = dol_strlen($maskwithnocode);
+ if (dol_strlen($value) != $len) $result = -1;
- dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
- return $result;
+ dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
+ return $result;
}
/**
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index a7d9c99f401..9b870bd5dd2 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -272,7 +272,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
- * -5 Other (see this->error)
+ * -5 NotConfigured - Setup empty so any value may be ok or not
+ * -6 Other (see this->error)
*/
public function verif($db, &$code, $soc, $type)
{
@@ -299,12 +300,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$this->error = 'NotConfigured';
return -5;
}
-
$result = check_value($mask, $code);
if (is_string($result))
{
$this->error = $result;
- return -5;
+ return -6;
}
}
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index f6162f1d9f8..807996ddd1c 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -187,11 +187,14 @@ if ($object->id > 0)
if ($object->fournisseur)
{
print '
';
- print '| '.$langs->trans("SupplierCode").' | ';
- print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
- print ' | ';
- print '
';
+ print ''.$langs->trans("SupplierCode").' | ';
+ print $object->code_fournisseur;
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
+ print ' | ';
+ print '';
$langs->load('compta');
print '';
diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php
index 683bc433c29..bfa5ac15811 100644
--- a/htdocs/margin/tabs/thirdpartyMargins.php
+++ b/htdocs/margin/tabs/thirdpartyMargins.php
@@ -96,21 +96,27 @@ if ($socid > 0)
print '';
print '';
- if ($object->client)
- {
- print '| ';
- print $langs->trans('CustomerCode').' | ';
- print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
- print ' |
';
- }
+ if ($object->client)
+ {
+ print '| ';
+ print $langs->trans('CustomerCode').' | ';
+ print $object->code_client;
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
+ print ' |
';
+ }
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
{
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
}
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index fc3d0879691..0fc33232c5d 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2281,7 +2281,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' | ';
print '
';
}
@@ -2292,7 +2295,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' | ';
print '
';
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index f8796739701..0aeb64aa427 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2969,6 +2969,8 @@ class Societe extends CommonObject
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
+ * -5 NotConfigured - Setup empty so any value may be ok or not
+ * -6 Other (see this->error)
*/
public function check_codeclient()
{
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 7c66a8a148f..779bf573341 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -130,7 +130,10 @@ if ($object->client)
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);
@@ -153,7 +156,10 @@ if ($object->fournisseur)
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid;
$resql = $db->query($sql);
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 66ace3650a9..1d7ba3d2925 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -136,7 +136,10 @@ if ($object->id)
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
}
@@ -145,7 +148,10 @@ if ($object->id)
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
}
diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php
index 0632fde21c2..516fb95e464 100644
--- a/htdocs/societe/note.php
+++ b/htdocs/societe/note.php
@@ -94,23 +94,27 @@ if ($object->id > 0)
print '| '.$langs->trans('Prefix').' | '.$object->prefix_comm.' |
';
}
- if ($object->client)
- {
- print '| ';
- print $langs->trans('CustomerCode').' | ';
- print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
- print ' |
';
- }
+ if ($object->client) {
+ print '| ';
+ print $langs->trans('CustomerCode').' | ';
+ print $object->code_client;
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
+ print ' |
';
+ }
- if ($object->fournisseur)
- {
- print '| ';
- print $langs->trans('SupplierCode').' | ';
- print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
- print ' |
';
- }
+ if ($object->fournisseur) {
+ print '| ';
+ print $langs->trans('SupplierCode').' | ';
+ print $object->code_fournisseur;
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
+ print ' |
';
+ }
print "
";
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index 9a16c1aa1be..5730d8f1ff4 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -165,23 +165,27 @@ if ($result > 0)
print '
| '.$langs->trans('Prefix').' | '.$object->prefix_comm.' |
';
}
- if ($object->client)
- {
- print '| ';
- print $langs->trans('CustomerCode').' | ';
- print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
- print ' |
';
- }
+ if ($object->client) {
+ print '| ';
+ print $langs->trans('CustomerCode').' | ';
+ print $object->code_client;
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
+ print ' |
';
+ }
- if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
- {
- print '| ';
- print $langs->trans('SupplierCode').' | ';
- print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
- print ' |
';
- }
+ if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
+ print '| ';
+ print $langs->trans('SupplierCode').' | ';
+ print $object->code_fournisseur;
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
+ print ' |
';
+ }
/*print '| '.$langs->trans("NbOfActiveNotifications").' | '; // Notification for this thirdparty
print '';
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index fa06ea5eae1..ee4ca01e7ee 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -808,7 +808,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print ' |
| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);
@@ -860,7 +863,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);
diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php
index a06b1f0940e..0afe58ece05 100644
--- a/htdocs/societe/price.php
+++ b/htdocs/societe/price.php
@@ -215,8 +215,10 @@ if ($object->client) {
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() != 0)
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
}
@@ -224,8 +226,10 @@ if ($object->fournisseur) {
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() != 0)
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
}
diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php
index aae44983401..54be485d6cd 100644
--- a/htdocs/societe/project.php
+++ b/htdocs/societe/project.php
@@ -99,7 +99,10 @@ if ($socid)
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
}
@@ -108,7 +111,10 @@ if ($socid)
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
}
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index 0d1ae48e9e3..3547c5a1e9b 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -184,20 +184,26 @@ if ($id > 0 || !empty($ref))
if ($object->client)
{
- print '| ';
- print $langs->trans('CustomerCode').' | ';
- print $object->code_client;
- if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
- print ' |
';
+ print '| ';
+ print $langs->trans('CustomerCode').' | ';
+ print $object->code_client;
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
+ print ' |
';
}
if ($object->fournisseur)
{
- print '| ';
- print $langs->trans('SupplierCode').' | ';
- print $object->code_fournisseur;
- if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
- print ' |
';
+ print '| ';
+ print $langs->trans('SupplierCode').' | ';
+ print $object->code_fournisseur;
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
+ print ' |
';
}
print '';
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index 24c4ede34b3..69e8efd02e1 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -213,8 +213,10 @@ if ($object->client) {
print '| ';
print $langs->trans('CustomerCode').' | ';
print $object->code_client;
- if ($object->check_codeclient() != 0)
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
print ' |
';
}
@@ -222,8 +224,10 @@ if ($object->fournisseur) {
print '| ';
print $langs->trans('SupplierCode').' | ';
print $object->code_fournisseur;
- if ($object->check_codefournisseur() != 0)
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
print ' |
';
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index fc1cca1aa0f..53973de6c59 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -426,30 +426,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
print '';
print '';
- // Customer code
- if ($socstat->client && !empty($socstat->code_client)) {
- print '| ';
- print $langs->trans('CustomerCode').' | ';
- print $socstat->code_client;
- if ($socstat->check_codeclient() != 0) {
- print ' ('.$langs->trans("WrongCustomerCode").')';
- }
-
- print ' | ';
- print '
';
- }
- // Supplier code
- if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
- print '| ';
- print $langs->trans('SupplierCode').' | ';
- print $socstat->code_fournisseur;
- if ($socstat->check_codefournisseur() != 0) {
- print ' ('.$langs->trans("WrongSupplierCode").')';
- }
-
- print ' | ';
- print '
';
- }
+ // Customer code
+ if ($socstat->client && !empty($socstat->code_client)) {
+ print '| ';
+ print $langs->trans('CustomerCode').' | ';
+ print $socstat->code_client;
+ $tmpcheck = $socstat->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").')';
+ }
+ print ' | ';
+ print '
';
+ }
+ // Supplier code
+ if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
+ print '| ';
+ print $langs->trans('SupplierCode').' | ';
+ print $socstat->code_fournisseur;
+ $tmpcheck = $socstat->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").')';
+ }
+ print ' | ';
+ print '
';
+ }
print '
';
print '';