forked from Dolibarr/dolibarr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into d…
…evelop
- Loading branch information
Showing
54 changed files
with
295 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -256,7 +257,7 @@ class Asset extends CommonObject | |
*/ | ||
public function __construct(DoliDB $db) | ||
{ | ||
global $conf, $langs; | ||
global $langs; | ||
|
||
$this->db = $db; | ||
|
||
|
@@ -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); | ||
|
@@ -420,6 +415,7 @@ public function createFromClone(User $user, $fromid) | |
// $this->db->rollback(); | ||
// return -1; | ||
// } | ||
|
||
return -1; | ||
} | ||
|
||
|
@@ -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; | ||
|
@@ -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. | ||
|
@@ -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; | ||
|
@@ -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 : ""; | ||
|
@@ -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. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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); | ||
|
@@ -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. | ||
* | ||
|
@@ -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; | ||
} | ||
} |
Oops, something went wrong.