*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -563,7 +563,7 @@
// Auto assign ticket to user who created it
print '';
-print ''.$langs->trans("TicketsAutoAssignTicket").' ';
+print ''.$langs->trans("TicketsAutoAssignTicket").' ';
print '';
print ' ';
print ' ';
@@ -598,9 +598,9 @@
print ' ';
print '';
-print ''.$langs->trans("TicketsDelayBeforeFirstAnswer")." ";
+print ''.$langs->trans("TicketsDelayBeforeFirstAnswer")." ";
print '
-
+
';
print '';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
@@ -608,9 +608,9 @@
print ' ';
print '';
-print ''.$langs->trans("TicketsDelayBetweenAnswers")." ";
+print ''.$langs->trans("TicketsDelayBetweenAnswers")." ";
print '
-
+
';
print '';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
@@ -655,18 +655,18 @@
// TODO Use module notification instead...
// Email to send notifications
-print ' '.$langs->trans("TicketEmailNotificationFrom").' ';
+print ''.$langs->trans("TicketEmailNotificationFrom").' ';
print '';
-print ' ';
+print ' ';
print '';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print ' ';
print ' ';
// Email for notification of TICKET_CREATE
-print ''.$langs->trans("TicketEmailNotificationTo").' ';
+print ''.$langs->trans("TicketEmailNotificationTo").' ';
print '';
-print ' ';
+print ' ';
print '';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
print ' ';
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index f8c77afa6c0b3..6e1b908321033 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1187,9 +1187,10 @@ protected function load_motherof()
* - string (categories ids separated by comma)
* - array (list of categories ids)
* @param int<0,1> $include [=0] Removed or 1=Keep only
+ * @param string $forcelangcode Lang code to force ('fr_FR', 'en_US', ...)
* @return int<-1,-1>|array Array of categories. this->cats and this->motherof are set, -1 on error
*/
- public function get_full_arbo($type, $fromid = 0, $include = 0)
+ public function get_full_arbo($type, $fromid = 0, $include = 0, $forcelangcode = '')
{
// phpcs:enable
global $langs;
@@ -1219,7 +1220,12 @@ public function get_full_arbo($type, $fromid = 0, $include = 0)
// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
- $current_lang = $langs->getDefaultLang();
+
+ if ($forcelangcode) {
+ $current_lang = $forcelangcode;
+ } else {
+ $current_lang = $langs->getDefaultLang();
+ }
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.ref_ext, c.description, c.color, c.position, c.fk_parent, c.visible"; // Distinct reduce pb with old tables with duplicates
@@ -1228,7 +1234,7 @@ public function get_full_arbo($type, $fromid = 0, $include = 0)
}
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (getDolGlobalInt('MAIN_MULTILANGS')) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$this->db->escape($current_lang)."'";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang = '".$this->db->escape($current_lang)."'";
}
$sql .= " WHERE c.entity IN (".getEntity('category').")";
$sql .= " AND c.type = ".(int) $type;
diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php
index e3876491055e3..ff23193441e50 100644
--- a/htdocs/core/lib/accounting.lib.php
+++ b/htdocs/core/lib/accounting.lib.php
@@ -295,7 +295,7 @@ function getDefaultDatesForTransfer()
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
- if ($res->num_rows > 0) {
+ if ($db->num_rows($res) > 0) {
$obj = $db->fetch_object($res);
$date_start = $db->jdate($obj->date_start);
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 6f4f9dbaa7a0c..832af66fab15c 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -3929,7 +3929,7 @@ function archiveOrBackupFile($srcfile, $max_versions = 5, $archivedir = '', $suf
if (count($sorted_files) >= $max_versions) {
$oldest_files = array_slice($sorted_files, $max_versions - 1);
foreach ($oldest_files as $oldest_file) {
- dol_delete_file($oldest_file);
+ dol_delete_file($oldest_file, 0, 0, 0, null, false, 0);
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index d38ea55a4ece6..7269209109726 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9186,7 +9186,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
} elseif (property_exists($object, 'delivery_date')) {
$date_delivery = $object->delivery_date;
}
- $substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', 0, $outputlangs) : '');
+ $substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%d") : '');
$substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%A") : '');
$substitutionarray['__DATE_DELIVERY_MON__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%m") : '');
diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
index c3bdc97132888..86bf821cd365a 100644
--- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
+++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
@@ -99,9 +99,6 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$notify = new Notify($this->db);
$resultSend = $notify->send($action, $object);
if ($resultSend < 0) {
- if (!isset($this->errors)) {
- $this->errors = [];
- }
$this->errors = array_merge($this->errors, $notify->errors);
return $resultSend;
}
diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
index 2ea5cf7a51ef8..189922844e21d 100644
--- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
+++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
@@ -403,3 +403,7 @@ ALTER TABLE llx_societe_rib DROP INDEX uk_societe_rib;
ALTER TABLE llx_societe_rib ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
-- select entity, label, fk_soc, default_rib, MIN(iban_prefix), MAX(iban_prefix), MIN(rowid), MAX(rowid), COUNT(rowid) from llx_societe_rib GROUP BY entity, label, fk_soc, default_rib HAVING COUNT(rowid) > 1;
ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc);
+
+
+ALTER TABLE llx_societe_account DROP INDEX uk_societe_account_login_website_soc;
+ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);
diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql
index 5af4f5bd7a928..a629c3c313e89 100644
--- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql
+++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql
@@ -37,6 +37,9 @@
ALTER TABLE llx_societe_rib MODIFY COLUMN label varchar(180);
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(100);
+ALTER TABLE llx_societe_account DROP INDEX uk_societe_account_login_website_soc;
+ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);
+
-- V22 migration
diff --git a/htdocs/install/mysql/tables/llx_societe_account.key.sql b/htdocs/install/mysql/tables/llx_societe_account.key.sql
index e889a38d5277d..a98272dbce761 100644
--- a/htdocs/install/mysql/tables/llx_societe_account.key.sql
+++ b/htdocs/install/mysql/tables/llx_societe_account.key.sql
@@ -22,11 +22,13 @@ ALTER TABLE llx_societe_account ADD INDEX idx_societe_account_fk_website (fk_web
ALTER TABLE llx_societe_account ADD INDEX idx_societe_account_fk_soc (fk_soc);
-- END MODULEBUILDER INDEXES
-ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website_soc(entity, fk_soc, login, site, fk_website);
+-- Only one unique login in the same website (note: we can still have the same login in database for 2 different companies if fk_website is null)
+ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);
+-- Only one unique login in the same external account in the same company
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_key_account_soc(entity, fk_soc, key_account, site, fk_website);
+
-- Table website does not always exists
--ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
-
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 709465adb0f36..4e072122887f5 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -205,7 +205,7 @@
$object->capital = $capital;
$object->nbterm = GETPOSTINT("nbterm");
- $object->rate = price2num(GETPOST("rate", 'alpha'));
+ $object->rate = GETPOSTFLOAT("rate");
$object->insurance_amount = GETPOSTFLOAT('insurance_amount');
$accountancy_account_capital = GETPOST('accountancy_account_capital');
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 3ddf784f0e1cb..cbfaae760799c 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -2140,7 +2140,7 @@
} else {
$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
}
- print "";
+ print "";
} else {
// Redirect to an error page
// Paymentko page must be created for the specific website
@@ -2149,6 +2149,6 @@
} else {
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
}
- print "";
+ print "";
}
}
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index 4461bb644e3de..9f1049544cfde 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -1865,7 +1865,7 @@ public function putSocieteAccount($id, $site, $request_data = null)
$result = $this->db->query($sql);
// We do not found an existing SocieteAccount entity for this fk_soc and site ; we then create a new one.
- if ($result && $this->db->num_rows == 0) {
+ if ($result && $this->db->num_rows($result) == 0) {
if (!isset($request_data['key_account'])) {
throw new RestException(422, 'Unprocessable Entity: You must pass the key_account attribute in your request data !');
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index fa785fc230c63..a1a3b9306bb11 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2913,7 +2913,7 @@ public function getTooltipContentArray($params)
$datas['status'] = ' '.$this->getLibStatut(5);
}
if (isset($this->client) && isset($this->fournisseur)) {
- $datas['type'] = ' ' . $this->getTypeUrl(1);
+ $datas['type'] = ' ' . $this->getTypeUrl(1, '', 0, 'span');
}
$datas['name'] = ''.$langs->trans('Name').': '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -3075,7 +3075,8 @@ public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip
} else {
$label = implode($this->getTooltipContentArray($params));
}
-
+ print "\n";
+ //var_dump($label);exit;
$linkstart = '';
$linkend = '';
@@ -3183,19 +3184,26 @@ public function getTypeUrl($withpicto = 0, $option = '', $notooltip = 0, $tag =
$s = '';
if (empty($option) || preg_match('/prospect/', $option)) {
if (($this->client == 2 || $this->client == 3) && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
- $s .= '<'.$tag.' class="customer-back opacitymedium" title="'.$langs->trans("Prospect").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'">'.dol_substr($langs->trans("Prospect"), 0, 1).''.$tag.'>';
+ $s .= '<'.$tag.' class="customer-back opacitymedium" title="'.dolPrintHTMLForAttribute($langs->trans("Prospect")).'"';
+ $s .= $tag == 'a' ? ' href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'"' : '';
+ $s .= '>'.dol_substr($langs->trans("Prospect"), 0, 1).''.$tag.'>';
}
}
if (empty($option) || preg_match('/customer/', $option)) {
if (($this->client == 1 || $this->client == 3) && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
- $s .= '<'.$tag.' class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).''.$tag.'>';
+ $s .= '<'.$tag.' class="customer-back" title="'.dolPrintHTMLForAttribute($langs->trans("Customer")).'"';
+ $s.= $tag == 'a' ? ' href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'"' : '';
+ $s .= '>'.dol_substr($langs->trans("Customer"), 0, 1).''.$tag.'>';
}
}
if (empty($option) || preg_match('/supplier/', $option)) {
if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $this->fournisseur) {
- $s .= '<'.$tag.' class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).''.$tag.'>';
+ $s .= '<'.$tag.' class="vendor-back" title="'.dolPrintHTMLForAttribute($langs->trans("Supplier")).'"';
+ $s .= $tag == 'a' ? ' href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id.'"' : '';
+ $s .= '>'.dol_substr($langs->trans("Supplier"), 0, 1).''.$tag.'>';
}
}
+
return $s;
}
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index ec7e8ba23a529..cce3e430b6c64 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -2009,6 +2009,7 @@
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
$userstatic->statut = $val['statut'];
+ $userstatic->status = $val['statut'];
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php
index 0a9a378fb35bf..edd8ff48472f5 100644
--- a/htdocs/user/bank.php
+++ b/htdocs/user/bank.php
@@ -125,7 +125,7 @@
if ($user->hasRight('hrm', 'read')) {
$ok = true;
}
-if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'readall') && in_array($object->id, $childids))) {
+if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && in_array($object->id, $childids))) {
$ok = true;
}
if ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && in_array($object->id, $childids))) {
@@ -778,7 +778,7 @@
// Latest expense report
if (isModEnabled('expensereport') &&
- ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'lire') && $object->id == $user->id))
+ ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && $object->id == $user->id))
) {
$exp = new ExpenseReport($db);
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index b69a1697d3f6b..7a8acf4e21bbd 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2905,7 +2905,7 @@
print "\n";
print ''."\n";
-print '