Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/lib/functions2.lib.php
	htdocs/fourn/card.php
	htdocs/margin/tabs/thirdpartyMargins.php
	htdocs/societe/card.php
	htdocs/societe/note.php
	htdocs/societe/notify/card.php
	htdocs/societe/societecontact.php
	htdocs/ticket/list.php
This commit is contained in:
Laurent Destailleur 2020-12-20 14:31:54 +01:00
commit 361f13154b
17 changed files with 186 additions and 130 deletions

View File

@ -286,7 +286,10 @@ if ($object->id > 0)
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td>'; print $langs->trans('CustomerCode').'</td><td>';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
print '<tr>'; print '<tr>';

View File

@ -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'; if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter // Extract value for third party mask counter
$regClient = array(); $regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{ {
$maskrefclient = $regClientRef[1].$regClientRef[2]; $maskrefclient = $regClientRef[1].$regClientRef[2];
@ -791,8 +791,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
} }
// Extract value for user // Extract value for user
if (preg_match('/\{(u+)\}/i', $mask, $regType)) $regType = array();
{ if (preg_match('/\{(u+)\}/i', $mask, $regType)) {
$lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
if (is_object($objuser)) $lastname = $objuser->lastname; 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 .= " (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp1)."'";
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') "; $sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') ";
$sqlwhere .= ')'; $sqlwhere .= ')';
} elseif ($resetEveryMonth) } elseif ($resetEveryMonth) {
{
$sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."'"; $sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."'";
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')"; $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)."')"; $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); } else dol_print_error($db);
$numFinal = $ref; $numFinal = $ref;
} elseif ($mode == 'next') } elseif ($mode == 'next') {
{
$counter++; $counter++;
// If value for $counter has a length higher than $maskcounter chars // If value for $counter has a length higher than $maskcounter chars
@ -1184,8 +1181,7 @@ function check_value($mask, $value)
$hasglobalcounter = false; $hasglobalcounter = false;
// Extract value for mask counter, mask raz and mask offset // Extract value for mask counter, mask raz and mask offset
$reg = array(); $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] : ''); $masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : '');
$maskcounter = $reg[1]; $maskcounter = $reg[1];
$hasglobalcounter = true; $hasglobalcounter = true;
@ -1253,31 +1249,25 @@ function check_value($mask, $value)
if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask'; if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask';
//print "x".$maskwithonlyymcode." ".$maskraz; //print "x".$maskwithonlyymcode." ".$maskraz;
} }
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n"; //print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\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 // Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter)
$len = dol_strlen($maskwithnocode); // TODO
if (dol_strlen($value) != $len) $result = -1;
// Define $maskLike // Check length
/* seems not used $len = dol_strlen($maskwithnocode);
$maskLike = dol_string_nospecial($mask); if (dol_strlen($value) != $len) $result = -1;
$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);
*/
dol_syslog("functions2::check_value result=".$result, LOG_DEBUG); dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
return $result; return $result;
} }
/** /**

View File

@ -272,7 +272,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* -2 ErrorCustomerCodeRequired * -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed * -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired * -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) public function verif($db, &$code, $soc, $type)
{ {
@ -299,12 +300,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$this->error = 'NotConfigured'; $this->error = 'NotConfigured';
return -5; return -5;
} }
$result = check_value($mask, $code); $result = check_value($mask, $code);
if (is_string($result)) if (is_string($result))
{ {
$this->error = $result; $this->error = $result;
return -5; return -6;
} }
} }

View File

@ -187,11 +187,14 @@ if ($object->id > 0)
if ($object->fournisseur) if ($object->fournisseur)
{ {
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>'; print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
print '</td>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print '</tr>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>';
print '</tr>';
$langs->load('compta'); $langs->load('compta');
print '<tr>'; print '<tr>';

View File

@ -96,21 +96,27 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield" width="100%">';
if ($object->client) if ($object->client)
{ {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
print '</td></tr>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
} print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
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)) 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 '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -2281,7 +2281,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td>'; print $langs->trans('CustomerCode').'</td><td>';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -2292,7 +2295,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>'; print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td>'; print $langs->trans('SupplierCode').'</td><td>';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -2969,6 +2969,8 @@ class Societe extends CommonObject
* -2 ErrorCustomerCodeRequired * -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed * -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired * -4 ErrorPrefixRequired
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/ */
public function check_codeclient() public function check_codeclient()
{ {

View File

@ -130,7 +130,10 @@ if ($object->client)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
@ -153,7 +156,10 @@ if ($object->fournisseur)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -136,7 +136,10 @@ if ($object->id)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }
@ -145,7 +148,10 @@ if ($object->id)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -94,23 +94,27 @@ if ($object->id > 0)
print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
} }
if ($object->client) if ($object->client) {
{ print '<tr><td class="'.$cssclass.'">';
print '<tr><td class="'.$cssclass.'">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $object->code_client;
print $object->code_client; $tmpcheck = $object->check_codeclient();
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print '</td></tr>'; print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
} }
print '</td></tr>';
}
if ($object->fournisseur) if ($object->fournisseur) {
{ print '<tr><td class="'.$cssclass.'">';
print '<tr><td class="'.$cssclass.'">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $object->code_fournisseur;
print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur();
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print '</td></tr>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
} }
print '</td></tr>';
}
print "</table>"; print "</table>";

View File

@ -165,23 +165,27 @@ if ($result > 0)
print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
} }
if ($object->client) if ($object->client) {
{ print '<tr><td class="titlefield">';
print '<tr><td class="titlefield">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $object->code_client;
print $object->code_client; $tmpcheck = $object->check_codeclient();
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print '</td></tr>'; print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
} }
print '</td></tr>';
}
if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
{ print '<tr><td class="titlefield">';
print '<tr><td class="titlefield">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $object->code_fournisseur;
print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur();
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print '</td></tr>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
} }
print '</td></tr>';
}
/*print '<tr><td class="titlefield">'.$langs->trans("NbOfActiveNotifications").'</td>'; // Notification for this thirdparty /*print '<tr><td class="titlefield">'.$langs->trans("NbOfActiveNotifications").'</td>'; // Notification for this thirdparty
print '<td colspan="3">'; print '<td colspan="3">';

View File

@ -808,7 +808,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="2">'; print $langs->trans('CustomerCode').'</td><td colspan="2">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
@ -860,7 +863,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="2">'; print $langs->trans('SupplierCode').'</td><td colspan="2">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -215,8 +215,10 @@ if ($object->client) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() != 0) $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }
@ -224,8 +226,10 @@ if ($object->fournisseur) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0) $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -99,7 +99,10 @@ if ($socid)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }
@ -108,7 +111,10 @@ if ($socid)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -184,20 +184,26 @@ if ($id > 0 || !empty($ref))
if ($object->client) if ($object->client)
{ {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
print '</td></tr>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
} }
if ($object->fournisseur) if ($object->fournisseur)
{ {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
print '</td></tr>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -213,8 +213,10 @@ if ($object->client) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() != 0) $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }
@ -222,8 +224,10 @@ if ($object->fournisseur) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">'; print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0) $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -426,30 +426,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Customer code // Customer code
if ($socstat->client && !empty($socstat->code_client)) { if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>'; print $langs->trans('CustomerCode').'</td><td>';
print $socstat->code_client; print $socstat->code_client;
if ($socstat->check_codeclient() != 0) { $tmpcheck = $socstat->check_codeclient();
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
} print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Supplier code // Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) { if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>'; print $langs->trans('SupplierCode').'</td><td>';
print $socstat->code_fournisseur; print $socstat->code_fournisseur;
if ($socstat->check_codefournisseur() != 0) { $tmpcheck = $socstat->check_codefournisseur();
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; if ($tmpcheck != 0 && $tmpcheck != -5) {
} print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';