Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop_n…
Browse files Browse the repository at this point in the history
…ew_duration_on_ticket
  • Loading branch information
kkhelifa-opendsi committed Sep 23, 2024
2 parents 780811c + 5470ad0 commit 111fc31
Show file tree
Hide file tree
Showing 387 changed files with 4,521 additions and 3,002 deletions.
14 changes: 8 additions & 6 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ The following changes may create regressions for some external modules, but were
* More class properties (with old name in french) are now deprecated in favor of the property name in english.
* The json emulator dol_json_encode/decode() is removed. The native json PHP module must be enabled/available (this is the case by default with most PHP installation).
* The experimental and deprecated module WebserviceClient is completely removed (SOAP technology is deprecated). May be replaced with the stable module Webhook.

* The dynamic properties ->no_button_delete, ->no_button_edit, ->no_button_copy for $object Product that could be set by an external module must no more
be set (not allowed by PHP 8.2). A module can already return an array with key 'no_button_delete', 'no_button_edit', 'no_button_copy' for same purpose.


***** ChangeLog for 20.0.0 compared to 19.0 *****
Expand All @@ -44,6 +45,10 @@ NEW: Accountancy - Add possibility for specific format FEC to sort with the FEC
NEW: Accountancy - Expense report - Add an option to use end period for transfer (#26706)
NEW: Accountancy - Show accounting result on balance
NEW: Accountancy - Show import key if exist (#29265)
NEW: Accountancy - Auto-determine piece number in FEC import (#29672)
NEW: Accountancy - Option to transfer only reconciled lines from bank (#29408)
NEW: Accountancy - Separation of accounting default account for salary and expense report
NEW: Various payment - Use list of accounting account when edit (#27992)
NEW: Add option to change all service dates at once
NEW: Add a default limit in nb to agenda export
NEW: Add a Feedback-ID into email headers
Expand Down Expand Up @@ -96,7 +101,6 @@ NEW: Allow smileys into emailing html content
NEW: Allow to set a default project for POS sales (#27042)
NEW: animation for display spinner when waiting response
NEW: Asset Module - make asset model creation in a single step (#26982)
NEW: auto-determine piece number in FEC import (#29672)
NEW: auto fill infos in template email
NEW: Automatically fill matching extra fields of object on line creation. (#27240)
NEW: Can add documents on a payment (#29660)
Expand Down Expand Up @@ -133,7 +137,7 @@ NEW: fetch object by element for website account card
NEW: filter on sale representative in contact list
NEW: Filter shipments by selecting multiple shipping methods (#28376)
NEW: Font param Look and Feel (#29302)
NEW: fuctionnality for stock configuration prompt in AI module (#28030)
NEW: functionality for stock configuration prompt in AI module (#28030)
NEW: functionality to delete contact of company list
NEW: functionality to display codebar on pdf files (#29623)
NEW: functionality to list event for user
Expand Down Expand Up @@ -165,7 +169,6 @@ NEW: notification action triggers for cancelling orders and invoices
NEW: now button when editing an event
NEW: online signature of shipments (#29559)
NEW: On OAuth Google login, no prompt at all if already logged in Google
NEW: Option to transfer only reconciliated lines from bank (#29408)
NEW: Param to show main menu logo in color look and feel (#29305)
NEW: Payment page received from donations
NEW: possibility to define a completely inactive module (#29289)
Expand All @@ -178,7 +181,6 @@ NEW: resource address, phone, email & maxusers (#28185)
NEW: Script for fast identification of missing/unused/duplicate translations
NEW: search member by date
NEW: See the documents of my subordinates (#28318)
NEW: separation of expense report from salary accounting code
NEW: Show error on ical parse
NEW: Show the profit per attendee on events
NEW: signed status CRUD to contract and fichinter
Expand All @@ -205,7 +207,6 @@ NEW: Update expense report card.php to allow pdf preview even without thumbnail
NEW: update price with auto to use const for rounding prices (#29350)
NEW: Use a nicer combo list to select the export accounting format
NEW: users can set their own length for short lists
NEW: Various payment - Use list of account when edit (#27992)
NEW: warning message when cloning a product whose status is not to sell (#28374)
PERF: Performance enhancement on Invoice/Paiement area page
PERF: Use cache for loaded users/contact on project list
Expand All @@ -218,6 +219,7 @@ SEC: Reduce nb of var without WAF used when using the website module

For developers or integrators:
------------------------------
NEW: Situation invoice - Add new official progressive mode - (constant INVOICE_USE_SITUATION = 2)
NEW: $noescapetags param of dol_escape_html works if attributes
NEW: Add createInvoiceFromContract to API invoice (#27277)
NEW: add debugging info to api/status if non-production
Expand Down
3 changes: 2 additions & 1 deletion build/generate_filelist_xml.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2015-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 @@ -199,7 +200,7 @@
fputs($fp, '</dolibarr_htdocs_dir>'."\n");

asort($checksumconcat); // Sort list of checksum
//var_dump($checksumconcat);

fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
fputs($fp, md5(join(',', $checksumconcat))."\n");
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n");
Expand Down
2 changes: 1 addition & 1 deletion dev/initdata/purge-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?php
/* Copyright (C) 2016 Laurent Destailleur <[email protected]>
* Copyright (C) 2016 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[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
* the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -225,7 +226,6 @@
$user=new User($db);
}

//var_dump($user->db->database_name);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'An admin user with login "admin" must exists to use this script.'."\n";
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/codespell/codespell-lines-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ", '".$this->db->idate($this->periode)."'";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key";
$sql .= ", periode='".$this->db->idate($this->periode)."'";
$sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
$sql = "SELECT id_users, nom as name, id_sondage, reponses";
$sql = "SELECT id_users, nom as name, reponses";
Expand Down
67 changes: 61 additions & 6 deletions dev/tools/fixcopyrightheader.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@ function getGitUserInfo()
'php' => ['/* ', ' * ', ' */', '<?php'],
];


/**
* Expand tabs in string to spaces.
*
* @param $str String in which to expand the tabs to spaces
* @param $tabWidth Width to use for a tabstop
*
* @return string Expanded string value.
*/
function expandTabs($str, $tabWidth)
{
$expanded = '';
$col = 0;
$len = mb_strlen($str);
for ($i = 0; $i < $len; $i++) {
if ($str[$i] == "\t") {
$expanded .= str_repeat(' ', $tabWidth - ($col % $tabWidth));
$col += $tabWidth - ($col % $tabWidth);
} else {
$expanded .= $str[$i];
$col++;
}
}
return $expanded;
}

/**
* Update or add copyright notice in a file
*
Expand Down Expand Up @@ -70,18 +96,45 @@ function updateCopyrightNotice($filename, $fileType, $name, $email)
$n = 50;
$lines = implode('', array_slice(file($filename), 0, $n));

// Define the regex pattern for matching copyright notices
$pattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?<year>\d{4}))\s+{$r_name}\s*\<{$r_email}>~";
// Based on the tendency to limit the length of the spacing between the name
// and email to the smallest one, determine the biggest offset from the start
// of a name to the start of the email, and use that for the current name/email
// offset if it is sufficient.

// Pattern to match any copyright already present
$allpattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?:\d{4}))\s+(\S.*)<\S+>~";
// Set minimum offset based of width of new name
$nameStartToMailStartOffset = 4 * (int) ((mb_strlen($r_name) + 4) / 4);

if (preg_match_all($allpattern, $lines, $allmatches)) {
foreach ($allmatches[1] as $nameAndSpaces) {
//print $nameAndSpaces."\n";
$nameAndSpaces = expandTabs($nameAndSpaces, 4);
$currentOffset = mb_strlen($nameAndSpaces);
$currentOffset = 4 * (int) ((3 + $currentOffset) / 4);
//print "Other offset $nameAndSpaces: $currentOffset\n";
if ($currentOffset > $nameStartToMailStartOffset) {
$nameStartToMailStartOffset = $currentOffset;
}
}
}

// Pattern to match the line matching the current developer
$pattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:(?<start>\d{4})-)?(?<last>\d{4}))\s+{$r_name}\s*\<{$r_email}>~";
// Check if the lines match the pattern
$matches = array();
if (preg_match($pattern, $lines, $matches)) {
$existingYear = $matches['year'];
$existingYear = $matches['last'];
if (array_key_exists('start', $matches)) {
$startYear = $matches['start'];
} else {
$startYear = $existingYear;
}

// Check if the existing year is different from the current year
if ($existingYear !== date('Y')) {
// Update the year range to include or be up to the current year
$updatedNotice = preg_replace('/(\d{4})(-\d{4})?\s+/', $existingYear . '-' . date('Y') . "\t", $matches[0]);
// Extend the year range to the current year
$updatedNotice = preg_replace('/(?:\d{4}-)?\d{4}\s+/', $startYear . '-' . date('Y') . "\t", $matches[0]);

// Replace the old notice with the updated one in the file
file_put_contents($filename, preg_replace($pattern, $updatedNotice, file_get_contents($filename)));
Expand All @@ -90,7 +143,8 @@ function updateCopyrightNotice($filename, $fileType, $name, $email)
// If the existing year is the same, no need to update
} else {
// Adjust tabs for proper alignment
$emailTabs = str_repeat("\t", (int) (max(0, (31 - mb_strlen($name)) / 4)));
// print "Offset:".$nameStartToMailStartOffset."\n";
$emailTabs = str_repeat("\t", (int) (max(0, ($nameStartToMailStartOffset + 4 - mb_strlen($name)) / 4)));

// No match found, add a new line to the header
$newNotice = "Copyright (C) " . date('Y') . "\t\t" . $name . $emailTabs . "<" . $email . ">";
Expand All @@ -114,6 +168,7 @@ function updateCopyrightNotice($filename, $fileType, $name, $email)

// Write the updated content back to the file
file_put_contents($filename, $fileContent);
// print $fileContent;
return true; // Change detected
}

Expand Down
Loading

0 comments on commit 111fc31

Please sign in to comment.