Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Mar 8, 2024
2 parents fb16af0 + 79adb60 commit a4faa48
Show file tree
Hide file tree
Showing 142 changed files with 1,437 additions and 1,011 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ The following changes may create regressions for some external modules, but were
cross platform compatibility. On linux the exit(-1) was caught as 255, it may be now exit(1) so will be caught as 1.
* the parameter $filter of method fetchAll does not accept array of SQL but must be a string of an Universal Search Filter syntax.
* Use of dol_eval with parameter $returnvalue=0 is deprecated.
* The signature for all ->delete() method has been modified to match the modulebuilder template (so first paramis now always $user), except
the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version.



***** ChangeLog for 19.0.1 compared to 19.0.0 *****
Expand Down
13 changes: 7 additions & 6 deletions dev/setup/pre-commit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ the project: `pre-commit-config.yaml`.

### Installation in your git project

1. Install `pre-commit` tool.\
1. Install pre-commit tool.\
If you do not have python installed, install [python](https://www.python.org) first.\
If you do not have [`pip`](https://pypi.org/project/pip), install that as well.\\

Then you can install pre-commit tool: `python -m pip install pre-commit`.
Then you can install pre-commit tool:
`python3 -m pip install pre-commit`

2. In your local git clone of the project, run `pre-commit install` to add the hooks.\
or copy the file git/hooks/pre-commit manually. (recommended because this file differs
from the file installed with pre-commit install as it redirects output to the error
channel so your IDE will be able to catch the error.
2. In your local git clone of the project, run `pre-commit install` to add the hooks
or copy the file *dev/setup/git/hooks/pre-commit* manually into *.git/hooks/pre-commit*
(recommended because this file may differ from the file installed with the pre-commit install).
The good file redirects output to the error channel so your IDE will be able to catch the error.


### Tips
Expand Down
3 changes: 3 additions & 0 deletions dev/tools/apstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@
foreach ($phan_notices as $notice) {
if (!empty($notice['location'])) {
$path = $notice['location']['path'];
if ($path == 'internal') {
continue;
}
$line_start = $notice['location']['lines']['begin'];
$line_end = $notice['location']['lines']['end'];
if ($line_start == $line_end) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/fiscalyear_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}

if ($action == 'confirm_delete' && $confirm == "yes") {
$result = $object->delete($id);
$result = $object->delete($user);
if ($result >= 0) {
header("Location: fiscalyear.php");
exit();
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/class/accountingaccount.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function __construct($db)
* Load record in memory
*
* @param int $rowid Id
* @param string $account_number Account number
* @param string|null $account_number Account number
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
* @return int Return integer <0 if KO, 0 if not found, Id of record if OK and found
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/class/accountingjournal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AccountingJournal extends CommonObject
public $active;

/**
* @var array array of lines
* @var AccountingJournal[] array of lines
*/
public $lines;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/class/bookkeeping.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $o
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->escape($this->db->escapeforlike($value))."%'";
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
}
}
}
Expand Down Expand Up @@ -1632,7 +1632,7 @@ public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '',
* Delete bookkeeping by piece number
*
* @param int $piecenum Piecenum to delete
* @param string $mode Mode
* @param string $mode Mode ('' or '_tmp')
* @return int Result
*/
public function deleteMvtNum($piecenum, $mode = '')
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@
}

if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->delete($id, $user);
$result = $object->delete($user);
if ($result > 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'errors');
if (!empty($backtopage) && !preg_match('/'.preg_quote($_SERVER["PHP_SELF"], '/').'/', $backtopage)) {
Expand Down
7 changes: 2 additions & 5 deletions htdocs/adherents/class/adherent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1061,21 +1061,18 @@ public function update_end_date($user)
/**
* Fonction to delete a member and its data
*
* @param int $rowid Id of member to delete
* @param User $user User object
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Return integer <0 if KO, 0=nothing to do, >0 if OK
*/
public function delete($rowid, $user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
$result = 0;
$error = 0;
$errorflag = 0;

// Check parameters
if (empty($rowid)) {
$rowid = $this->id;
}
$rowid = $this->id;

$this->db->begin();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/class/api_members.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public function delete($id)
}


$res = $member->delete($member->id, DolibarrApiAccess::$user);
$res = $member->delete(DolibarrApiAccess::$user);
if ($res < 0) {
throw new RestException(500, "Can't delete, error occurs");
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/adherents/subscription/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td class="valeur">';
print '<input type="text" class="flat" name="note" value="'.$object->note_private.'"></td></tr>';
print '<input type="text" class="flat" name="note" value="'.$object->note_public.'"></td></tr>';

// Bank line
if (isModEnabled("bank") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) {
Expand Down Expand Up @@ -334,7 +334,7 @@
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur"><span class="amount">'.price($object->amount).'</span></td></tr>';

// Label
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)).'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).'</td></tr>';

// Bank line
if (isModEnabled("bank") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) {
Expand Down
12 changes: 7 additions & 5 deletions htdocs/admin/agenda_extsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
}

//print '-name='.$name.'-color='.$color;
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
$res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
Expand Down Expand Up @@ -205,10 +206,10 @@


$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT');
if ($selectedvalue==1) {
$selectedvalue=0;
if ($selectedvalue == 1) {
$selectedvalue = 0;
} else {
$selectedvalue=1;
$selectedvalue = 1;
}

print "<table class=\"noborder\" width=\"100%\">";
Expand All @@ -224,7 +225,7 @@
print "<td>".$langs->trans("ExtSitesEnableThisTool")."</td>";
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1);
print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled' => array(0 => '.hideifnotset')), null, 1);
} else {
if (!getDolGlobalString('AGENDA_DISABLE_EXT')) {
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
Expand Down Expand Up @@ -269,7 +270,7 @@
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;

print '<tr class="oddeven">';
// Nb
// Nb @phan-suppress-next-line PhanPluginSuspiciousParamPosition
print '<td width="180" class="nowrap">' . $langs->trans("AgendaExtNb", $key) . "</td>";
// Name
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME' . $key . '" value="' . (GETPOST('AGENDA_EXT_NAME' . $key) ? GETPOST('AGENDA_EXT_NAME' . $key, 'alpha') : getDolGlobalString($name)) . '" size="28"></td>';
Expand All @@ -286,6 +287,7 @@
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
} else {
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
if (getDolGlobalString($default)) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
} else {
Expand Down
Loading

0 comments on commit a4faa48

Please sign in to comment.