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

This commit is contained in:
Laurent Destailleur 2025-01-21 19:15:28 +01:00
commit c11bea799a
29 changed files with 225 additions and 149 deletions

View file

@ -6576,12 +6576,6 @@ parameters:
count: 1
path: ../../../htdocs/compta/sociales/card.php
-
message: '#^Variable \$resteapayer might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/compta/sociales/card.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
@ -16170,12 +16164,6 @@ parameters:
count: 2
path: ../../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
-
message: '#^Variable \$old_MAIN_MAIL_AUTOCOPY_TO might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
-
message: '#^Call to function method_exists\(\) with Contact and ''getContactRoles'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -19593,13 +19581,7 @@ parameters:
-
message: '#^Variable \$begin might not be defined\.$#'
identifier: variable.undefined
count: 5
path: ../../../htdocs/fourn/contact.php
-
message: '#^Variable \$contactname might not be defined\.$#'
identifier: variable.undefined
count: 1
count: 3
path: ../../../htdocs/fourn/contact.php
-
@ -19608,12 +19590,6 @@ parameters:
count: 4
path: ../../../htdocs/fourn/contact.php
-
message: '#^Variable \$stcomm might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/fourn/contact.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -22290,12 +22266,6 @@ parameters:
count: 2
path: ../../../htdocs/loan/class/loanschedule.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../htdocs/loan/class/paymentloan.class.php
-
message: '#^Property PaymentLoan\:\:\$amount_capital \(float\|int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -31926,12 +31896,6 @@ parameters:
count: 1
path: ../../../htdocs/variants/class/ProductCombination.class.php
-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 1
path: ../../../htdocs/variants/class/ProductCombination.class.php
-
message: '#^Property ProductCombination\:\:\$variation_price_percentage type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
@ -32628,21 +32592,9 @@ parameters:
count: 4
path: ../../../htdocs/website/index.php
-
message: '#^Comparison operation "\>\=" between 1 and 0 is always true\.$#'
identifier: greaterOrEqual.alwaysTrue
count: 1
path: ../../../htdocs/website/samples/wrapper.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 3
path: ../../../htdocs/website/samples/wrapper.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 1
path: ../../../htdocs/website/samples/wrapper.php

View file

@ -150,7 +150,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$fuser->loadRights();
$result=$object->create($fuser);
if ($result >= 0) {

View file

@ -180,7 +180,7 @@ for ($s = 0; $s < GEN_NUMBER_COMMANDE; $s++) {
$fuser = new User($db);
$fuser->fetch($listofuserid[mt_rand(0, 2)]);
$fuser->getRights();
$fuser->loadRights();
$db->begin();

View file

@ -171,7 +171,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) {
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$fuser->loadRights();
$object->contactid = $contids[$socids[$socid]][0];
$object->socid = $socids[$socid];

View file

@ -763,6 +763,11 @@ class Adherent extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$nbrowsaffected = 0;
$error = 0;

View file

@ -3,7 +3,7 @@
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
class Members extends DolibarrApi
{
/**
* @var string[] $FIELDS Mandatory fields, checked when create and update object
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'morphy',
@ -159,7 +159,7 @@ class Members extends DolibarrApi
throw new RestException(404, 'member not found');
}
} else {
throw new RestException(404, 'This account have many thirdparties attached or does not exist.');
throw new RestException(404, 'This account have many thirdparties attached or does not exist.');
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
@ -355,7 +355,9 @@ class Members extends DolibarrApi
/**
* Create member object
*
* @param array<string,string> $request_data Request data
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of member
*
* @throws RestException 403 Access denied

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2025 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
@ -28,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
class MembersTypes extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'label',
@ -39,7 +40,7 @@ class MembersTypes extends DolibarrApi
*/
public function __construct()
{
global $db, $conf;
global $db;
$this->db = $db;
}
@ -84,13 +85,13 @@ class MembersTypes extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of member type objects
* @phan-return AdherentType[]
* @phpstan-return AdherentType[]
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
{
global $db, $conf;
$obj_ret = array();
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
@ -143,7 +144,9 @@ class MembersTypes extends DolibarrApi
/**
* Create member type object
*
* @param array $request_data Request data
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of member type
*/
public function post($request_data = null)
@ -151,8 +154,8 @@ class MembersTypes extends DolibarrApi
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
// Check mandatory fields. Throw exception on error.
$this->_validate($request_data);
$membertype = new AdherentType($this->db);
foreach ($request_data as $field => $value) {
@ -175,7 +178,9 @@ class MembersTypes extends DolibarrApi
*
* @param int $id ID of member type to update
* @param array $request_data Datas
* @return int
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return Object
*/
public function put($id, $request_data = null)
{
@ -227,6 +232,8 @@ class MembersTypes extends DolibarrApi
*
* @param int $id member type ID
* @return array
* @phan-return array<string,array{code:int,message:string}>
* @phpstan-return array<string,array{code:int,message:string}>
*/
public function delete($id)
{
@ -261,8 +268,8 @@ class MembersTypes extends DolibarrApi
/**
* Validate fields before creating an object
*
* @param array|null $data Data to validate
* @return array
* @param ?array<null|int|float|string> $data Data to validate
* @return array<string,null|int|float|string>
*
* @throws RestException
*/
@ -282,8 +289,8 @@ class MembersTypes extends DolibarrApi
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return Object Object with cleaned properties
* @param Object $object Object to clean
* @return Object Object with cleaned properties
*/
protected function _cleanObjectDatas($object)
{

View file

@ -760,6 +760,11 @@ class Account extends CommonObject
$this->status = $this->clos;
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
// Load the library to validate/check a BAN account
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
@ -900,6 +905,11 @@ class Account extends CommonObject
{
global $langs, $conf;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
$this->db->begin();

View file

@ -4743,19 +4743,21 @@ if ($action == 'create') {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1, '', 32)).'</span>';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir");
$i = 0;
foreach ($facidavoir as $id) {
foreach ($object->creditnote_ids as $invoiceid) {
if ($i == 0) {
print ' ';
} else {
print ',';
}
$facavoir = new Facture($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1, '', 32);
$creditnote = new Facture($db);
$creditnote->fetch($invoiceid);
print $creditnote->getNomUrl(1, '', 32);
}
print '</span>';
}

View file

@ -149,6 +149,9 @@ class Invoices extends DolibarrApi
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
// Retrieve credit note ids
$this->invoice->getListIdAvoirFromInvoice();
// Add external contacts ids
if ($contact_list > -1) {
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
@ -268,6 +271,9 @@ class Invoices extends DolibarrApi
$invoice_static->totaldeposits = $invoice_static->getSumDepositsUsed();
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Retrieve credit note ids
$invoice_static->getListIdAvoirFromInvoice();
// Add external contacts ids
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {

View file

@ -439,17 +439,19 @@ if ($object->id > 0) {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).'</span>';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
foreach ($object->creditnote_ids as $invoiceid) {
if ($type == 'bank-transfer') {
$facavoir = new FactureFournisseur($db);
$creditnote = new FactureFournisseur($db);
} else {
$facavoir = new Facture($db);
$creditnote = new Facture($db);
}
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir");
print ' '. (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);

View file

@ -607,6 +607,11 @@ class Contact extends CommonObject
{
global $conf;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
$this->id = $id;

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.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
@ -46,28 +47,29 @@ class Ccountry extends CommonDict
public $code_iso;
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
* @var string
*/
public $fields = array(
'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1)
);
public $ecc;
/**
* @var int
*/
public $favorite;
/**
* @var int
*/
public $eec;
/**
* @var string
*/
public $numeric_code;
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
*/
public $fields = array(
'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1)
);
/**
* Constructor
*
@ -190,9 +192,9 @@ class Ccountry extends CommonDict
$this->code = $obj->code;
$this->code_iso = $obj->code_iso;
$this->label = $obj->label;
$this->ecc = $obj->ecc;
$this->active = $obj->active;
$this->favorite = $obj->favorite;
$this->eec = $obj->eec;
$this->numeric_code = $obj->numeric_code;
}

View file

@ -162,6 +162,11 @@ abstract class CommonInvoice extends CommonObject
*/
public $nbofopendirectdebitorcredittransfer;
/**
* @var int[] return of getListIdAvoirFromInvoice()
*/
public $creditnote_ids;
/**
* @var int
*/
@ -450,6 +455,9 @@ abstract class CommonInvoice extends CommonObject
} else {
dol_print_error($this->db);
}
$this->creditnote_ids = $idarray;
return $idarray;
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2014-2016 Jean-François Ferry <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -178,6 +178,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
// Send email to assigned user
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
@ -206,6 +207,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
// Send email to assigned user
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';

View file

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* 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
@ -82,6 +82,9 @@ class SupplierInvoices extends DolibarrApi
throw new RestException(404, 'Supplier invoice not found');
}
// Retrieve credit note ids
$this->invoice->getListIdAvoirFromInvoice();
$this->invoice->fetchObjectLinked();
return $this->_cleanObjectDatas($this->invoice);
}

View file

@ -3339,13 +3339,15 @@ if ($action == 'create') {
}
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $id) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($id);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
print '</span>';

View file

@ -211,13 +211,15 @@ if ($id > 0 || !empty($ref)) {
print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1));
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' '.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
}

View file

@ -187,13 +187,15 @@ if ($object->id > 0) {
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' ('.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits) . ')';
}

View file

@ -169,13 +169,15 @@ if ($object->id > 0) {
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' ('.$langs->transnoentities("InvoiceHasAvoir") . implode(',', $invoicecredits) . ')';
}

View file

@ -0,0 +1,57 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2025 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2015-2017 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2018 Abbes bahfir <dolipar@dolipar.org>
-- Copyright (C) 2020 Udo Tamm <dev@dolibit.de>
-- Copyright (C) 2023 Nick Fragoulis
-- Copyright (C) 2023 Santiago Payà <santiagopim@gmail.com>
--
--
--------------------------------------------------------------------------------------
-- License
-- #######
-- 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
--------------------------------------------------------------------------------------
-- Comment
-- #######
-- (EN)
-- Do not place a comment at the end of the line, this file is parsed at the end of the line.
-- from the install and all '--' are removed.
--
-- (FR)
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--------------------------------------------------------------------------------------
-- PCG = Plan Comptable Général (FR) - General Accounting Plan (EN)
--------------------------------------------------------------------------------------
-- Accounting Journals
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, __ENTITY__);

View file

@ -3,7 +3,7 @@
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2005-2025 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2015-2017 Juanjo Menent <jmenent@2byte.es>
@ -46,17 +46,6 @@
--------------------------------------------------------------------------------------
-- Accounting Journals
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, 1);
-- Accounting Charts / Plans (Templates) for Countries
-- Description of chart of account FR PCG25-DEV

View file

@ -1423,6 +1423,10 @@ class Product extends CommonObject
if (empty($this->country_id)) {
$this->country_id = 0;
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
if (empty($this->state_id)) {
$this->state_id = 0;

View file

@ -255,6 +255,10 @@ class Entrepot extends CommonObject
$this->error = "ErrorFieldRequired";
return 0;
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$now = dol_now();
@ -325,6 +329,11 @@ class Entrepot extends CommonObject
*/
public function update($id, $user, $notrigger = 0)
{
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
if (empty($id)) {

View file

@ -1658,7 +1658,8 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
// Validate
if ($object->status == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer')) {
if ($userWrite > 0) {
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&amp;token='.newToken().'&amp;id='.$object->id, '');
//print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, '');
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_validate&confirm=yes&token='.newToken().'&id='.$object->id, '');
} else {
print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
}
@ -1667,7 +1668,8 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
// Close
if ($object->status == Project::STATUS_VALIDATED && $user->hasRight('projet', 'creer')) {
if ($userWrite > 0) {
print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=close&amp;token='.newToken().'&amp;id='.$object->id, '');
//print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=close&amp;token='.newToken().'&amp;id='.$object->id, '');
print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_close&confirm=yes&token='.newToken().'&id='.$object->id, '');
} else {
print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
}

View file

@ -1012,11 +1012,6 @@ class Societe extends CommonObject
$this->fk_multicurrency = 0;
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
dol_syslog(get_class($this)."::create ".$this->name);
$now = dol_now();
@ -1446,6 +1441,11 @@ class Societe extends CommonObject
$this->country_id = dol_getIdFromCode($this->db, $this->country_code, 'c_country', 'code', 'rowid');
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);

View file

@ -2096,6 +2096,11 @@ class User extends CommonObject
{
global $conf, $langs;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$nbrowsaffected = 0;
$error = 0;

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -884,11 +884,7 @@ class ProductCombination
$productCombinationLevel->fk_price_level = $i;
$productCombinationLevel->variation_price = $price_impact[$i];
if (is_array($price_var_percent)) {
$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ;
} else {
$productCombinationLevel->variation_price_percentage = $price_var_percent;
}
$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ;
$newcomb->combination_price_levels[$i] = $productCombinationLevel;
}

View file

@ -88,7 +88,7 @@ class SupplierProposalTest extends CommonClassTest
// Set permission not set by default sql sample
$user->addrights(0, 'supplier_proposal');
$user->getrights('supplier_proposal', 1);
$user->loadRights('supplier_proposal', 1);
}
/**
@ -183,7 +183,7 @@ class SupplierProposalTest extends CommonClassTest
$result = $user->addrights(0, 'supplier_proposal');
$this->assertLessThan($result, 0);
$result = $user->getrights('supplier_proposal', 1);
$result = $user->loadRights('supplier_proposal', 1);
//$this->assertLessThan($result, 0);
$result = $localobject->valid($user);