Skip to content

Commit

Permalink
Merge branch 'develop' into NEW/32460/SELECT_OBJECT_TABS
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Jan 16, 2025
2 parents 69e9efa + 3bb748a commit e500549
Show file tree
Hide file tree
Showing 18 changed files with 313 additions and 262 deletions.
455 changes: 243 additions & 212 deletions dev/setup/eclipse/PSR-12 [built-in].xml

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions htdocs/accountancy/journal/purchasesjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <[email protected]>
* Copyright (C) 2011 Juanjo Menent <[email protected]>
* Copyright (C) 2012 Regis Houssin <[email protected]>
* Copyright (C) 2013-2024 Alexandre Spangaro <[email protected]>
* Copyright (C) 2013-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2013-2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2013-2016 Florian Henry <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
Expand Down Expand Up @@ -1276,12 +1276,10 @@ function writebookkeeping() {
// Subledger account
print "<td>";
print '</td>';
print "<td>";
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : implode(', ', $def_tva[$key][$k]));
$labelvatrate = $langs->trans("Taxes").' '.$tmpvatrate.' %';
$labelvatrate .= ($numtax ? ' - Localtax '.$numtax : '');
print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate) . "</td>";
print "</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
Expand Down
32 changes: 16 additions & 16 deletions htdocs/admin/ticket.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <[email protected]>
* Copyright (C) 2016 Christophe Battarel <[email protected]>
* Copyright (C) 2022-2023 Udo Tamm <[email protected]>
* Copyright (C) 2023 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 Benjamin Falière <[email protected]>
/* Copyright (C) 2013-2018 Jean-François FERRY <[email protected]>
* Copyright (C) 2016 Christophe Battarel <[email protected]>
* Copyright (C) 2022-2023 Udo Tamm <[email protected]>
* Copyright (C) 2023 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024-2025 Benjamin Falière <[email protected]>
*
* 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
Expand Down Expand Up @@ -563,7 +563,7 @@

// Auto assign ticket to user who created it
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
print '<td><label for="TICKET_AUTO_ASSIGN_USER_CREATE" class="block">'.$langs->trans("TicketsAutoAssignTicket").'</label></td>';
print '<td class="left">';
print '<input class="minwidth100" type="text" id="TICKET_AUTO_ASSIGN_USER_CREATE" name="TICKET_AUTO_ASSIGN_USER_CREATE" value="'.getDolGlobalString('TICKET_AUTO_ASSIGN_USER_CREATE').'">';
print '</td>';
Expand Down Expand Up @@ -598,19 +598,19 @@
print '</tr>';

print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
print '<td><label for="delay_first_response" class="block">'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</label></td>";
print '<td class="left">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" name="delay_first_response" class="width50">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" id="delay_first_response" name="delay_first_response" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
print '</td>';
print '</tr>';

print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
print '<td><label for="delay_between_responses" class="block">'.$langs->trans("TicketsDelayBetweenAnswers")."</label></td>";
print '<td class="left">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" name="delay_between_responses" class="width50">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" id="delay_between_responses" name="delay_between_responses" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
Expand Down Expand Up @@ -655,18 +655,18 @@
// TODO Use module notification instead...

// Email to send notifications
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'</td>';
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
print '<td class="left">';
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_FROM" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print '</td>';
print '</tr>';

// Email for notification of TICKET_CREATE
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").'</td>';
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_TO" class="block">'.$langs->trans("TicketEmailNotificationTo").'</label></td>';
print '<td class="left">';
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').'"></td>';
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_TO" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').'"></td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
print '</td>';
Expand Down
12 changes: 9 additions & 3 deletions htdocs/categories/class/categorie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string,level:?int}> 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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/accounting.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/files.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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") : '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions htdocs/install/mysql/migration/20.0.0-21.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions htdocs/install/mysql/migration/21.0.0-22.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_societe_account.key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);

2 changes: 1 addition & 1 deletion htdocs/loan/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions htdocs/public/payment/paymentok.php
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@
} else {
$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
}
print "<script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script>";
print "<!DOCTYPE html><html><head></head><script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script></html>";
} else {
// Redirect to an error page
// Paymentko page must be created for the specific website
Expand All @@ -2149,6 +2149,6 @@
} else {
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
}
print "<script>window.top.location.href = '".dol_escape_js($ext_urlko)."';</script>";
print "<!DOCTYPE html><html><head></head><script>window.top.location.href = '".dol_escape_js($ext_urlko)."';</script></html>";
}
}
2 changes: 1 addition & 1 deletion htdocs/societe/class/api_thirdparties.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 !');
}
Expand Down
18 changes: 13 additions & 5 deletions htdocs/societe/class/societe.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ public function getTooltipContentArray($params)
$datas['status'] = ' '.$this->getLibStatut(5);
}
if (isset($this->client) && isset($this->fournisseur)) {
$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1);
$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1, '', 0, 'span');
}
$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
if (!empty($this->name_alias) && empty($noaliasinname)) {
Expand Down Expand Up @@ -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 = '';

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions htdocs/societe/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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);

Expand Down
Loading

0 comments on commit e500549

Please sign in to comment.