Skip to content

Commit

Permalink
Merge branch '21.0' of [email protected]:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 16, 2025
2 parents b41584d + 162b3b1 commit 683f4f9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
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/files.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3885,7 +3885,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
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>";
}
}
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
19 changes: 10 additions & 9 deletions htdocs/website/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2905,7 +2905,7 @@

print "\n";
print '<!-- Open form for all page -->'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].($action == 'file_manager' ? '?uploadform=1' : '').'" method="POST" enctype="multipart/form-data" class="websiteformtoolbar">';
print '<form action="'.$_SERVER["PHP_SELF"].($action == 'file_manager' ? '?uploadform=1' : '').'" method="POST" enctype="multipart/form-data" class="websiteformtoolbar">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.'">';
Expand Down Expand Up @@ -2947,7 +2947,7 @@
print '<input type="hidden" name="mode" value="'.$mode.'">';
}

print '<div>';
print '<div>'."\n";

// Add a margin under toolbar ?
$style = '';
Expand Down Expand Up @@ -2991,7 +2991,7 @@


//var_dump($objectpage);exit;
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hiddenforpopup' : '').'">';
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hiddenforpopup' : '').'">'."\n";

//
// Toolbar for websites
Expand Down Expand Up @@ -3291,10 +3291,10 @@
//

if ($websitekey && $websitekey != '-1' && (!in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm'))) && (!in_array($mode, array('replacesite'))) && !$file_manager) {
print '</div>'; // Close current websitebar to open a new one
print '</div>'."\n"; // Close current websitebar to open a new one

print '<!-- Toolbar for websitepage -->';
print '<div class="centpercent websitebar"'.($style ? ' style="'.$style.'"' : '').'>';
print '<div class="centpercent websitebar"'.($style ? ' style="'.$style.'"' : '').'>'."\n";

print '<div class="websiteselection hideonsmartphoneimp minwidth75 tdoverflowmax100 inline-block">';
print $langs->trans("PageContainer").': ';
Expand Down Expand Up @@ -3854,7 +3854,7 @@ function switchEditorOnline(forceenable)
}
}

print '</div>'; // end current websitebar
print '</div>'."\n"; // end current websitebar
}


Expand Down Expand Up @@ -5537,7 +5537,8 @@ function switchEditorOnline(forceenable)
*/

$out .= "</head>\n";
$out .= "\n<body>";
$out .= "\n";
$out .= "<body>\n";


$out .= '<div id="websitecontentundertopmenu" class="websitecontentundertopmenu boostrap-iso">'."\n";
Expand Down Expand Up @@ -5618,9 +5619,9 @@ function switchEditorOnline(forceenable)
$out .= dolWebsiteReplacementOfLinks($object, $newcontent, 0, 'html', $objectpage->id)."\n";
//$out.=$newcontent;

$out .= '</div>';
$out .= '</div>'."\n";

$out .= '</div> <!-- End div id=websitecontentundertopmenu -->';
$out .= '</div> <!-- End div id=websitecontentundertopmenu -->'."\n";

/*if ($includepageintoaframeoradiv == 'iframe')
{
Expand Down

0 comments on commit 683f4f9

Please sign in to comment.