Skip to content

Commit

Permalink
Merge branch 'develop' into phpstan_baseline_action
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 authored Nov 14, 2024
2 parents 40f3ff4 + b6c0377 commit 61ea751
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dev/tools/github_commits_byversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# shellcheck disable=1113,2002,2006,2086,2164,2219

Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "develop")
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "20.0" "develop")
let "counter = 0"

echo "Copy script into /tmp/github_commits_byversion.sh"
Expand Down
18 changes: 18 additions & 0 deletions htdocs/compta/paiement/rapport.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
*/

$action = GETPOST('action', 'aZ09');
$fileToRemove = GETPOST('removefile', 'alpha');

$socid = 0;
if ($user->socid > 0) {
Expand Down Expand Up @@ -93,6 +94,21 @@
$year = GETPOSTINT("reyear");
}

// Delete file from disk
if ($action == 'removedoc' && $permissiontoread && $fileToRemove) {
$fullpathfile = dol_sanitizePathName($dir.'/'.$fileToRemove);
$fileDirectory = dirname($fullpathfile);
if (dol_delete_file($fullpathfile)) {
// Delete empty directory after file deletion
if (empty(dol_dir_list($fileDirectory))) {
dol_delete_dir($fileDirectory);
}
setEventMessages($langs->trans("FileWasRemoved", $fileToRemove), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $fileToRemove), null, 'errors');
}
}


/*
* View
Expand Down Expand Up @@ -140,6 +156,7 @@
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td class="right">'.$langs->trans("Size").'</td>';
print '<td class="right">'.$langs->trans("Date").'</td>';
print '<td class="right"></td>';
print '</tr>';

$files = (dol_dir_list($dir.'/'.$year, 'files', 0, '^payments-[0-9]{4}-[0-9]{2}\.pdf$', '', 'name', SORT_DESC, 1));
Expand All @@ -149,6 +166,7 @@
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$f['name'].'</a>'.$formfile->showPreview($f['name'], 'facture_paiement', $relativepath, 0).'</td>';
print '<td class="right">'.dol_print_size($f['size']).'</td>';
print '<td class="right">'.dol_print_date($f['date'], "dayhour").'</td>';
print '<td class="right"><a href="rapport.php?removefile='.urlencode($relativepath).'&action=removedoc&token='.newToken().'">'.img_delete().'</a></td>';
print '</tr>';
}
print '</table>';
Expand Down
7 changes: 4 additions & 3 deletions htdocs/core/lib/functions2.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2491,12 +2491,12 @@ function colorAgressiveness($hex, $ratio = -50, $brightness = 0)
}
}
if ($brightness > 0) {
$color = ($color * (100 + abs($brightness)) / 100);
$color = (int) ($color * (100 + abs($brightness)) / 100);
} else {
$color = ($color * (100 - abs($brightness)) / 100);
$color = (int) ($color * (100 - abs($brightness)) / 100);
}

$color = max(0, min(255, $color)); // Adjust color to stay into valid range
$color = max(0, min(255, (int) $color)); // Adjust color to stay into valid range
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
}

Expand Down Expand Up @@ -2596,6 +2596,7 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false)
*/
function colorHexToHsl($hex, $alpha = false, $returnArray = false)
{
$hex = colorArrayToHex(colorStringToArray($hex));
$hex = str_replace('#', '', $hex);
$red = hexdec(substr($hex, 0, 2)) / 255;
$green = hexdec(substr($hex, 2, 2)) / 255;
Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/menus/init_menu_auguria.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 3__+MAX_llx_menu__, 'product|service', 'isModEnabled("product") || isModEnabled("service")', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&amp;leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->hasRight("produit","lire") || $user->hasRight("service","lire")', '', 0, 30, __ENTITY__, '<span class="fas fa-cube fa-fw pictofixedwidth" style=" color: #a69944;"></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&amp;leftmenu=', 'TMenuMRP', -1, 'mrp', '$user->hasRight("bom","read") || $user->hasRight("mrp","read")', '', 0, 31, __ENTITY__, '<span class="fas fa-cubes fa-fw pictofixedwidth" style=" color: #a69944;"></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__, '<span class="fas fa-project-diagram em088 infobox-project fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, '<span class="fas fa-suitcase em092 infobox-contrat fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("intervention")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, '<span class="fas fa-suitcase em092 infobox-contrat fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("invoice") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, '<span class="fas fa-file-invoice-dollar infobox-commande fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?search_status=opened&mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__, '<span class="fas fa-university infobox-bank_account fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__, '<span class="fas fa-search-dollar infobox-bank_account fa-fw pictofixedwidth" style=""></span>');
Expand Down Expand Up @@ -216,10 +216,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contrat") && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);

-- Commercial - Interventions
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("ficheinter")', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("ficheinter")', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("ficheinter")', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("ficheinter")', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__);

-- Billing - Supplier invoice
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("supplier_invoice")', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?mainmenu=billing&amp;leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
Expand Down
4 changes: 4 additions & 0 deletions htdocs/core/modules/DolibarrModules.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,10 @@ public function insert_cronjobs()

global $conf, $user;

if (empty($user)) {
$user = new User($this->db);
}

$err = 0;

if (is_array($this->cronjobs)) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modAsset.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct($db)
$this->descriptionlong = "Asset module to manage assets module and depreciation charge on Dolibarr";

// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'development';
$this->version = 'experimental';
// Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.
Expand Down
20 changes: 19 additions & 1 deletion htdocs/fourn/facture/rapport.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
$result = restrictedArea($user, 'fournisseur', 0, 'facture_fourn', 'facture');

$action = GETPOST('action', 'aZ09');
$fileToRemove = GETPOST('removefile', 'alpha');

$socid = 0;
if ($user->socid > 0) {
Expand Down Expand Up @@ -95,6 +96,20 @@
$year = GETPOSTINT("reyear");
}

// Delete file from disk
if ($action == 'removedoc' && $permissiontoread && $fileToRemove) {
$fileDirectory = dirname($dir.'/'.$fileToRemove);
if (dol_delete_file($dir.'/'.$fileToRemove)) {
// Delete empty directory after file deletion
if (empty(dol_dir_list($fileDirectory))) {
dol_delete_dir($fileDirectory);
}
setEventMessages($langs->trans("FileWasRemoved", $fileToRemove), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $fileToRemove), null, 'errors');
}
}


/*
* View
Expand Down Expand Up @@ -158,6 +173,7 @@
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td class="right">'.$langs->trans("Size").'</td>';
print '<td class="right">'.$langs->trans("Date").'</td>';
print '<td class="right"></td>';
print '</tr>';

if (is_resource($handle)) {
Expand All @@ -167,7 +183,9 @@
$relativepath = $year.'/'.$file;
print '<tr class="oddeven"><td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_fournisseur&amp;file=payments/'.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a>'.$formfile->showPreview($file, 'facture_fournisseur', 'payments/'.$relativepath, 0).'</td>';
print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td></tr>';
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
print '<td class="right"><a href="rapport.php?removefile='.urlencode($relativepath).'&action=removedoc&token='.newToken().'">'.img_delete().'</a></td>';
print '</tr>';
}
}
closedir($handle);
Expand Down
8 changes: 7 additions & 1 deletion htdocs/install/upgrade2.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,14 @@
*/

// Scripts for 20.0
$afterversionarray = explode('.', '19.0.9');
/*$afterversionarray = explode('.', '19.0.9');
$beforeversionarray = explode('.', '20.0.9');
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
}*/

// Scripts for 21.0
$afterversionarray = explode('.', '20.0.9');
$beforeversionarray = explode('.', '21.0.9');
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
migrate_productlot_path();
}
Expand Down
8 changes: 5 additions & 3 deletions htdocs/theme/eldy/dropdown.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
}
include_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
?>
/* <style type="text/css" > don't remove this line it's an ide hack */
/*
* Dropdown of user popup
Expand Down Expand Up @@ -453,7 +455,7 @@
}

.dropdown-search-input::placeholder {
color: color(#575756);
color: #888;
letter-spacing: 1.5px;
}

Expand Down Expand Up @@ -541,7 +543,7 @@
div.quickaddblock:hover,
div.quickaddblock:active,
div.quickaddblock:focus {
background: <?php print $colorbacklinepair1; ?>;
background: <?php print "#".colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?>;
}


Expand Down

0 comments on commit 61ea751

Please sign in to comment.