Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2024-10-29 02:59:40 +01:00
commit b717be581f
12 changed files with 96 additions and 130 deletions

View file

@ -3,6 +3,7 @@
* Copyright (C) 2018-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Jose MARTINEZ <jose.martinez@pichinov.com>
*
* 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 @@ class Asset extends CommonObject
//
// // 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 @@ class Asset extends CommonObject
// $this->db->rollback();
// return -1;
// }
return -1;
}
@ -434,10 +430,6 @@ class Asset extends CommonObject
{
$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 @@ class Asset extends CommonObject
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 @@ class Asset extends CommonObject
// 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 @@ class Asset extends CommonObject
$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 @@ class Asset extends CommonObject
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.
*

View file

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 @@ class AssetModel extends CommonObject
// 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 @@ class AssetModel extends CommonObject
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;
}
/**
* Load list of objects in memory from the database.
*
@ -810,46 +788,4 @@ class AssetModel extends CommonObject
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;
}
}

View file

@ -60,7 +60,7 @@ if (empty($action)) {
exit;
}
if ($element === 'facture') {
if ($element === 'facture') { // Test on permission done in top of page
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View file

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -47,7 +47,7 @@ class Invoices extends DolibarrApi
private $invoice;
/**
* @var FactureRec $templte_invoice {@type FactureRec}
* @var FactureRec $template_invoice {@type FactureRec}
*/
private $template_invoice;

View file

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -141,10 +142,20 @@ class Conf extends stdClass
public $format_date_hour_text_short;
public $format_date_hour_text;
/**
* @var int limit for list
*/
public $liste_limit;
/**
* @var int checkboxes are on left column if 1
*/
public $main_checkbox_left_column;
public $tzuserinputkey = 'tzserver'; // Use 'tzuserrel' to always store date in GMT and show date in time zone of user.
/**
* @var string Use 'tzuserrel' to always store date in GMT and show date in time zone of user.
*/
public $tzuserinputkey = 'tzserver';
// TODO Remove this part.

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -44,7 +45,14 @@ class Link extends CommonObject
*/
public $entity;
/**
* @var int|'' date add
*/
public $datea;
/**
* @var string Object url
*/
public $url;
/**
@ -52,7 +60,14 @@ class Link extends CommonObject
*/
public $label;
/**
* @var string Object type
*/
public $objecttype;
/**
* @var int Object ID
*/
public $objectid;
@ -167,11 +182,11 @@ class Link extends CommonObject
}
// Clean parameters
$this->url = clean_url($this->url, 1);
$this->url = clean_url($this->url, 1);
if (empty($this->label)) {
$this->label = basename($this->url);
}
$this->label = trim($this->label);
$this->label = trim($this->label);
$this->db->begin();

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*

View file

@ -3929,7 +3929,7 @@ if (!function_exists("llxFooter")) {
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
}
// Wrapper to add log when clicking on download or preview
// JS wrapper to add log when clicking on download or preview
if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) {
if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture'
print "\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";

View file

@ -86,6 +86,10 @@ while ($tmpobj = $db->fetch_object($resWar)) {
if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
$fk_entrepot = $lastWarehouseID;
}
//If the warehouse is set to the default selected user
if (!GETPOSTISSET('fk_warehouse') && (empty($fk_entrepot) || $fk_entrepot <= 0) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER')) {
$fk_entrepot = $user->fk_warehouse;
}
$texte = '';

View file

@ -68,7 +68,7 @@ if (!$user->hasRight('takepos', 'run')) {
* View
*/
top_httphead('text/html', 1);
top_htmlhead('', '', 1);
if ($place > 0) {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
@ -81,6 +81,25 @@ if ($place > 0) {
$object = new Facture($db);
$object->fetch($facid);
// Record entry in blocked logs
// DOL_DOCUMENT_ROOT.'/blockedlog/ajax/block-add.php?id='.$object->id.'&element='.$object->element.'&action=DOC_PREVIEW&token='.newToken();
print "
<script>
jQuery(document).ready(function () {
console.log('Call /blockedlog/ajax/block-add on output of receipt.php');
$.post('".DOL_URL_ROOT."/blockedlog/ajax/block-add.php'
, {
id: ".((int) $object->id)."
, element: '".dol_escape_js($object->element)."'
, action: 'DOC_PREVIEW'
, token: '".currentToken()."'
}
);
});
</script>";
// Call to external receipt modules if exist
$parameters = array();
$hookmanager->initHooks(array('takeposfrontend'));
@ -103,6 +122,16 @@ if (!empty($hookmanager->resPrint)) {
.left {
text-align: left;
}
.centpercent {
width: 100%;
}
@media only screen and (min-width: 1024px)
{
body {
margin-left: 50px;
margin-right: 50px;
}
}
</style>
<center>
<div style="font-size: 1.5em">
@ -132,7 +161,7 @@ print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>';
if (getDolGlobalString('TAKEPOS_RECEIPT_NAME')) {
print getDolGlobalString('TAKEPOS_RECEIPT_NAME') . " ";
}
if ($object->statut == Facture::STATUS_DRAFT) {
if ($object->status == Facture::STATUS_DRAFT) {
print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref)));
} else {
print $object->ref;
@ -155,7 +184,7 @@ if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) {
</p>
<br>
<table width="100%" style="border-top-style: double;">
<table class="centpercent" style="border-top-style: double;">
<thead>
<tr>
<th class="center"><?php print $langs->trans("Label"); ?></th>
@ -194,7 +223,7 @@ if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) {
<?php if (!empty($line->product_label)) {
echo $line->product_label;
} else {
echo $line->description;
echo $line->desc;
} ?>
</td>
<td class="right"><?php echo $line->qty; ?></td>
@ -219,7 +248,7 @@ if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) {
</tbody>
</table>
<br>
<table class="right">
<table class="right centpercent">
<tr>
<th class="right"><?php if ($gift != 1) {
echo $langs->trans("TotalHT");

View file

@ -372,7 +372,7 @@ print 'fontsizesmaller='.$fontsizesmaller."\n";
print 'topMenuFontSize='.$topMenuFontSize."\n";
print 'toolTipBgColor='.$toolTipBgColor."\n";
print 'toolTipFontColor='.$toolTipFontColor."\n";
print 'conf->global->THEME_SATURATE_RATIO='.(!getDolGlobalString('THEME_SATURATE_RATIO') ? '' : $conf->global->THEME_SATURATE_RATIO)." (must be between 0 and 1)\n";
print 'conf->global->THEME_SATURATE_RATIO='.getDolGlobalString('THEME_SATURATE_RATIO')." (must be between 0 and 1)\n";
print '*/'."\n";

View file

@ -125,6 +125,9 @@ class Context
*/
public $rootUrl;
/**
* @var string[]
*/
public $menu_active = array();
/**