Merge branch 'develop' into patch-11

This commit is contained in:
Frédéric FRANCE 2024-03-07 20:08:17 +01:00 committed by GitHub
commit 01466b0056
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 38 additions and 31 deletions

View file

@ -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

View file

@ -238,7 +238,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'edit') {
// 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)) {
@ -334,7 +334,7 @@ if ($rowid && $action != 'edit') {
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)) {

View file

@ -143,7 +143,7 @@ class ICal
$this->cal = array(); // new empty array
$this->event_count = -1;
$this->file_text = null;
$this->file_text = '';
// Save file into a cache
if ($usecachefile) {
@ -168,10 +168,10 @@ class ICal
}
}
$this->file_text = preg_split("[\n]", $this->file_text);
$file_text_array = preg_split("[\n]", $this->file_text);
// is this text vcalendar standard text ? on line 1 is BEGIN:VCALENDAR
if (!stristr($this->file_text[0], 'BEGIN:VCALENDAR')) {
if (!stristr($file_text_array[0], 'BEGIN:VCALENDAR')) {
return 'error not VCALENDAR';
}
@ -179,7 +179,7 @@ class ICal
$tmpkey = '';
$tmpvalue = '';
$type = '';
foreach ($this->file_text as $text) {
foreach ($file_text_array as $text) {
$text = trim($text); // trim one line
if (!empty($text)) {
// get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin

View file

@ -258,7 +258,7 @@ if ($sourcetype != 'salary') {
$pricetowithdraw = $bprev->SommeAPrelever($type, 'salary');
}
if ($nb < 0) {
dol_print_error($bprev->error);
dol_print_error($db, $bprev->error);
}
print '<table class="border centpercent tableforfield">';
@ -479,7 +479,7 @@ if ($resql) {
}
$title = $langs->trans("InvoiceWaitingWithdraw");
$picto = 'bill';
if ($type =='bank-transfer') {
if ($type == 'bank-transfer') {
if ($sourcetype != 'salary') {
$title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
} else {

View file

@ -359,13 +359,14 @@ class ConferenceOrBooth extends ActionComm
/**
* Delete object in database
*
* @param int $notrigger false=launch triggers after, true=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user User making the delete
* @param int $notrigger false=launch triggers after, true=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($notrigger = 0)
public function delete($user, $notrigger = 0)
{
//TODO delete attendees and subscription
return parent::delete($notrigger);
return parent::delete($user, $notrigger);
}
/**

View file

@ -506,7 +506,7 @@ if (empty($reshook)) {
}
} elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) {
$also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0);
$result = $object->delete(0, $also_update_stock);
$result = $object->delete($user, 0, $also_update_stock);
if ($result > 0) {
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
exit;

View file

@ -1242,7 +1242,7 @@ class Expedition extends CommonObject
$mouvS = new MouvementStock($this->db);
// we do not log origin because it will be deleted
$mouvS->origin = null;
$mouvS->origin = '';
// get lot/serial
$lotArray = null;
if (isModEnabled('productbatch')) {
@ -1440,7 +1440,7 @@ class Expedition extends CommonObject
$mouvS = new MouvementStock($this->db);
// we do not log origin because it will be deleted
$mouvS->origin = null;
$mouvS->origin = '';
// get lot/serial
$lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
if (!is_array($lotArray)) {

View file

@ -8,7 +8,7 @@
* Copyright (C) 2014-2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
* Copyright (C) 2018-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Benjamin Grembi <benjamin@oarces.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
*
@ -338,7 +338,7 @@ if (empty($reshook)) {
if ($product_type == Product::TYPE_SERVICE || getDolGlobalString('FICHINTER_PRINT_PRODUCTS')) { //only services except if config includes products
$duration = 3600; // Default to one hour
$desc = '';
// Predefined products & services
if ($lines[$i]->fk_product > 0) {
$prod = new Product($db);

View file

@ -2316,6 +2316,8 @@ class CommandeFournisseur extends CommonOrder
*/
public function deleteLine($idline, $notrigger = 0)
{
global $user;
if ($this->statut == 0) {
$line = new CommandeFournisseurLigne($this->db);
@ -2333,12 +2335,11 @@ class CommandeFournisseur extends CommonOrder
}
}
if ($line->delete($notrigger) > 0) {
if ($line->delete($user, $notrigger) > 0) {
$this->update_price(1);
return 1;
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->setErrorsFromObject($line);
return -1;
}
} else {
@ -4162,9 +4163,11 @@ class CommandeFournisseurLigne extends CommonOrderLine
* @param int $notrigger 1=Disable call to triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $user;
if (empty($user)) {
global $user;
}
$error = 0;

View file

@ -327,7 +327,6 @@ class Establishment extends CommonObject
* Delete record
*
* @param User $user User making the change
* @param int $id Id of record to delete
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($user)

View file

@ -655,7 +655,7 @@ Module2200Desc=Use maths expressions for auto-generation of prices
Module2300Name=Scheduled jobs
Module2300Desc=Scheduled jobs management (alias cron or chrono table)
Module2400Name=Events/Agenda
Module2400Desc=Track events. Log automatic events for tracking purposes or record manual events or meetings. This is the principal module for good Customer or Vendor Relationship Management.
Module2400Desc=Manage manual and automatic events. Provide a calendar to record events manually. Log also events automatically for tracking purposes or record manual events or meetings. This is the principal module for good Customer or Vendor Relationship Management.
Module2430Name=Online appointment scheduling
Module2430Desc=Provides an online appointment booking system. This allow anyone to book rendez-vous, according to predefined ranges or availabilities.
Module2500Name=DMS / ECM

View file

@ -530,6 +530,8 @@ class Dolresource extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$rowid = $this->id;
$error = 0;
$this->db->begin();

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2016 Jean-François Ferry <hello@librethic.io>
* 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
@ -410,7 +411,7 @@ class Tickets extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$this->ticket->delete($user)) {
if (!$this->ticket->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when deleting ticket');
}