, 2=To use with
* @param string $file Url used when we click on sort picto
* @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def"
@@ -4277,7 +4277,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
}
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
- $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
+ $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
$out .= '>';
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field
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/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index e391787479d..309d4d4b170 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -552,3 +552,6 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
+
+ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;
+
diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql
index a36adb3a672..1b95444b3a1 100644
--- a/htdocs/install/mysql/tables/llx_projet.sql
+++ b/htdocs/install/mysql/tables/llx_projet.sql
@@ -35,6 +35,7 @@ create table llx_projet
fk_statut integer DEFAULT 0 NOT NULL, -- open or close
fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities
opp_percent double(5,2),
+ fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose)
date_close datetime DEFAULT NULL,
fk_user_close integer DEFAULT NULL,
note_private text,
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/salaries/list.php b/htdocs/salaries/list.php
index 26477900be2..b8a0ba69ef7 100644
--- a/htdocs/salaries/list.php
+++ b/htdocs/salaries/list.php
@@ -154,9 +154,7 @@ if (empty($reshook))
// Mass actions
$objectclass = 'PaymentSalary';
$objectlabel = 'SalariesPayments';
- $permissiontoread = $user->rights->salaries->read;
- $permissiontodelete = $user->rights->salaries->delete;
- $uploaddir = $conf->bom->dir_output;
+ $uploaddir = $conf->salaries->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Validate records
@@ -308,7 +306,7 @@ print ' ';
-// Date
+// Date payment
print '';
print '';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@@ -317,6 +315,9 @@ print '
';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '
';
print '
';
+// Date value
+print '';
+print ' ';
// Type
print '';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
@@ -352,7 +353,8 @@ print ' ';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
-print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
+print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
+print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
@@ -421,6 +423,10 @@ while ($i < ($limit ? min($num, $limit) : $num))
print ''.dol_print_date($db->jdate($obj->datep), 'day')." \n";
if (!$i) $totalarray['nbfield']++;
+ // Date value
+ print ''.dol_print_date($db->jdate($obj->datev), 'day')." \n";
+ if (!$i) $totalarray['nbfield']++;
+
// Type
print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.' ';
if (!$i) $totalarray['nbfield']++;
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 '