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 Oct 28, 2024
2 parents abf5323 + 94de6f5 commit b3b8f52
Show file tree
Hide file tree
Showing 54 changed files with 295 additions and 238 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- id: end-of-file-fixer
# Check that there are no completely merged file conflicts
- id: check-merge-conflict
stages: [pre-commit, pre-rebase, pre-commit, pre-merge-commit]
stages: [commit, pre-rebase, pre-commit, pre-merge-commit]
# Check that files with shebangs have the executable bit set (in git)
- id: check-executables-have-shebangs
# Check that shell files are executables
Expand Down Expand Up @@ -252,7 +252,7 @@ repos:
rev: 3.1.0
hooks:
- id: sqlfluff-lint
stages: [pre-commit, manual] # manual needed for ci
stages: [commit, manual] # manual needed for ci
exclude: (?x)^
(dev/initdemo/mysqldump_.*\.sql
|htdocs/core/menus/init_menu_auguria\.sql
Expand Down
4 changes: 4 additions & 0 deletions dev/translation/ignore_translation_keys.lst
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,10 @@ MYMODULE_MYPARAM6
MYMODULE_MYPARAM7
MYMODULE_MYPARAM8
MYMODULE_MYPARAM9
MYMODULE_MYPARAM10
MYMODULE_MYPARAM11
MYMODULE_MYPARAM12
MYMODULE_MYPARAM13
ManufacturingOrders
MemberCreate
MemberTypeCreate
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/accountmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@

$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/fiscalyear.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/journals_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@

$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/productaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/accountancy/admin/subaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/bookkeeping/balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
// If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/adherents/agenda.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/adherents/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/adherents/messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
7 changes: 4 additions & 3 deletions htdocs/adherents/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
Expand Down
42 changes: 5 additions & 37 deletions htdocs/asset/class/asset.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2018-2024 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 Jose MARTINEZ <[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 @@ -256,7 +257,7 @@ class Asset extends CommonObject
*/
public function __construct(DoliDB $db)
{
global $conf, $langs;
global $langs;

$this->db = $db;

Expand Down Expand Up @@ -343,13 +344,7 @@ public function createFromClone(User $user, $fromid)
//
// // Load source object
// $result = $object->fetchCommon($fromid);
// if ($result > 0 && !empty($object->table_element_line)) {
// $object->fetchLines();
// }
//
// // get lines so they will be clone
// //foreach($this->lines as $line)
// // $line->fetch_optionals();
//
// // Reset some properties
// unset($object->id);
Expand Down Expand Up @@ -420,6 +415,7 @@ public function createFromClone(User $user, $fromid)
// $this->db->rollback();
// return -1;
// }

return -1;
}

Expand All @@ -434,10 +430,6 @@ public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
if ($result > 0) {
if (!empty($this->table_element_line)) {
$this->fetchLines();
}

$res = $this->hasDepreciationLinesInBookkeeping();
if ($res < 0) {
return -1;
Expand All @@ -454,18 +446,6 @@ public function fetch($id, $ref = null)
return $result;
}

/**
* Load object lines in memory from the database
*
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
*/
public function fetchLines()
{
$this->lines = array();

return 1;
}


/**
* Load list of objects in memory from the database.
Expand Down Expand Up @@ -1028,7 +1008,7 @@ public function calculationDepreciation()

// Get depreciation period
$depreciation_date_start = $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition;
$depreciation_date_end = dol_time_plus_duree((int) $depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y'));
$depreciation_date_end = dol_time_plus_duree(dol_time_plus_duree((int) $depreciation_date_start, $fields['duration'], $fields['duration_type'] == 1 ? 'm' : ($fields['duration_type'] == 2 ? 'd' : 'y')), -1, 'd');
$depreciation_amount = $fields['amount_base_depreciation_ht'];
if ($fields['duration_type'] == 2) { // Daily
$fiscal_period_start = $depreciation_date_start;
Expand All @@ -1041,7 +1021,7 @@ public function calculationDepreciation()
$fiscal_period_start = $init_fiscal_period_start;
$fiscal_period_end = $init_fiscal_period_end;
}
$cumulative_depreciation_ht = $last_cumulative_depreciation_ht;
$cumulative_depreciation_ht = (float) $last_cumulative_depreciation_ht;
$depreciation_period_amount = $depreciation_amount - (float) $this->reversal_amount_ht;
$start_date = $depreciation_date_start;
$disposal_date = isset($this->disposal_date) && $this->disposal_date !== "" ? $this->disposal_date : "";
Expand Down Expand Up @@ -1591,18 +1571,6 @@ public function initAsSpecimen()
return $this->initAsSpecimenCommon();
}

/**
* Create an array of lines
*
* @return array|int array of lines if OK, <0 if KO
*/
public function getLinesArray()
{
$this->lines = array();

return $this->lines;
}

/**
* Returns the reference to the following non used object depending on the active numbering module.
*
Expand Down
74 changes: 5 additions & 69 deletions htdocs/asset/class/assetmodel.class.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2021 Open-Dsi <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
/* Copyright (C) 2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2021 Open-Dsi <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[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 @@ -263,13 +263,6 @@ public function createFromClone(User $user, $fromid)

// Load source object
$result = $object->fetchCommon($fromid);
if ($result > 0 && !empty($object->table_element_line)) {
$object->fetchLines();
}

// get lines so they will be clone
//foreach($this->lines as $line)
// $line->fetch_optionals();

// Reset some properties
unset($object->id);
Expand Down Expand Up @@ -354,25 +347,10 @@ public function createFromClone(User $user, $fromid)
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result;
}

/**
* Load object lines in memory from the database
*
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
*/
public function fetchLines()
{
$this->lines = array();

return 1;
return $result;
}


/**
* Load list of objects in memory from the database.
*
Expand Down Expand Up @@ -810,46 +788,4 @@ public function initAsSpecimen()

return $this->initAsSpecimenCommon();
}

/**
* Create an array of lines
*
* @return array|int array of lines if OK, <0 if KO
*/
public function getLinesArray()
{
$this->lines = array();

return $this->lines;
}

/**
* Action executed by scheduler
* CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
* Use public function doScheduledJob($param1, $param2, ...) to get parameters
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
public function doScheduledJob()
{
//global $conf, $langs;

//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';

$error = 0;
$this->output = '';
$this->error = '';

dol_syslog(__METHOD__, LOG_DEBUG);

$now = dol_now();

$this->db->begin();

// ...

$this->db->commit();

return $error;
}
}
Loading

0 comments on commit b3b8f52

Please sign in to comment.