Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into d…
Browse files Browse the repository at this point in the history
…ev_27814
  • Loading branch information
FHenry committed Mar 15, 2024
2 parents 778f7b0 + f5a0255 commit 3b7c31c
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 49 deletions.
5 changes: 1 addition & 4 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ return [
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
// PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeInvalidUnaryOperandNumeric : 8 occurrences
// PhanRedefineFunctionInternal : 6 occurrences
// PhanPluginUnsafeEval : 5 occurrences
// PhanParamSuspiciousOrder : 4 occurrences
Expand All @@ -39,7 +38,7 @@ return [
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'],
'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/collab/index.php' => ['PhanParamTooMany'],
'htdocs/comm/action/index.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/comm/action/index.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
Expand Down Expand Up @@ -71,14 +70,12 @@ return [
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'],
'htdocs/loan/class/paymentloan.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'],
'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'],
Expand Down
6 changes: 3 additions & 3 deletions htdocs/comm/action/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@
$next_year = $next['year'];
$next_month = $next['month'];

$max_day_in_prev_month = date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month
$max_day_in_month = date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month
$max_day_in_prev_month = (int) date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month
$max_day_in_month = (int) date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month
// tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
$tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday
$tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) {
$tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
Expand Down
46 changes: 26 additions & 20 deletions htdocs/compta/accounting-files.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Copyright (C) 2020 Maxime DEMAREST <[email protected]>
* Copyright (C) 2021 Gauthier VERDOL <[email protected]>
* Copyright (C) 2022-2024 Alexandre Spangaro <[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 @@ -96,15 +97,15 @@


$arrayfields = array(
'type'=>array('label'=>"Type", 'checked'=>1),
'date'=>array('label'=>"Date", 'checked'=>1),
'date_due'=>array('label'=>"DateDue", 'checked'=>1),
'ref'=>array('label'=>"Ref", 'checked'=>1),
'documents'=>array('label'=>"Documents", 'checked'=>1),
'paid'=>array('label'=>"Paid", 'checked'=>1),
'total_ht'=>array('label'=>"TotalHT", 'checked'=>1),
'total_ttc'=>array('label'=>"TotalTTC", 'checked'=>1),
'total_vat'=>array('label'=>"TotalVAT", 'checked'=>1),
'type' => array('label' => "Type", 'checked' => 1),
'date' => array('label' => "Date", 'checked' => 1),
'date_due' => array('label' => "DateDue", 'checked' => 1),
'ref' => array('label' => "Ref", 'checked' => 1),
'documents' => array('label' => "Documents", 'checked' => 1),
'paid' => array('label' => "Paid", 'checked' => 1),
'total_ht' => array('label' => "TotalHT", 'checked' => 1),
'total_ttc' => array('label' => "TotalTTC", 'checked' => 1),
'total_vat' => array('label' => "TotalVAT", 'checked' => 1),
//...
);

Expand Down Expand Up @@ -135,14 +136,14 @@
$error = 0;

$listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'picto'=>'bill', 'lang'=>'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')),
'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')),
'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')),
'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')),
'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')),
'selectinvoices' => array('label' => 'Invoices', 'picto' => 'bill', 'lang' => 'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')),
'selectsupplierinvoices' => array('label' => 'BillsSuppliers', 'picto' => 'supplier_invoice', 'lang' => 'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')),
'selectexpensereports' => array('label' => 'ExpenseReports', 'picto' => 'expensereport', 'lang' => 'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')),
'selectdonations' => array('label' => 'Donations', 'picto' => 'donation', 'lang' => 'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')),
'selectsocialcontributions' => array('label' => 'SocialContributions', 'picto' => 'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')),
'selectpaymentsofsalaries' => array('label' => 'SalariesPayments', 'picto' => 'salary', 'lang' => 'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')),
'selectvariouspayment' => array('label' => 'VariousPayment', 'picto' => 'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')),
'selectloanspayment' => array('label' => 'PaymentLoan','picto' => 'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')),
);


Expand All @@ -157,6 +158,9 @@
//if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

$filesarray = array();

'@phan-var-force array<string,array{id:string,entity:string,date:string,date_due:string,paid:float|int,amount_ht:float|int,amount_ttc:float|int,amount_vat:float|int,amount_localtax1:float|int,amount_localtax2:float|int,amount_revenuestamp:float|int,ref:string,fk:string,item:string,thirdparty_name:string,thirdparty_code:string,country_code:string,vatnum:string,sens:string,currency:string,line?:string,name?:string,files?:mixed}> $filesarray';

$result = false;
if (($action == 'searchfiles' || $action == 'dl')) {
if (empty($date_start)) {
Expand Down Expand Up @@ -411,6 +415,7 @@
$nofile['link'] = '';
$nofile['name'] = '';


$filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile;
} else {
foreach ($files as $key => $file) {
Expand Down Expand Up @@ -446,8 +451,8 @@
}
$filesarray[$file['item'].'_'.$file['id']]['files'][] = array(
'link' => $link.urlencode($file['name']),
'name'=>$file['name'],
'ref'=>$file['ref'],
'name' => $file['name'],
'ref' => $file['ref'],
'fullname' => $file['fullname'],
'relpath' => '/'.$file['name'],
'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name'],
Expand Down Expand Up @@ -522,7 +527,7 @@
$zipname .= '_'.$project->ref;
}
}
$zipname .='_export.zip';
$zipname .= '_export.zip';

dol_delete_file($zipname);

Expand Down Expand Up @@ -689,6 +694,7 @@
}

$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
'@phan-var-force array<string,array{id:string,entity:string,date:string,date_due:string,paid:float|int,amount_ht:float|int,amount_ttc:float|int,amount_vat:float|int,amount_localtax1:float|int,amount_localtax2:float|int,amount_revenuestamp:float|int,ref:string,fk:string,item:string,thirdparty_name:string,thirdparty_code:string,country_code:string,vatnum:string,sens:string,currency:string,line?:string,name?:string,files?:mixed}> $TData';


$filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
Expand Down
16 changes: 13 additions & 3 deletions htdocs/compta/sociales/class/paymentsocialcontribution.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <[email protected]>
* Copyright (C) 2022 Alexandre Spangaro <[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 @@ -82,12 +83,19 @@ class PaymentSocialContribution extends CommonObject
public $bank_line;

/**
* @deprecated
* @deprecated Use $amount instead.
* @see $amount
* @var float|int
*/
public $total;

/**
* @var float|int
*/
public $amount; // Total amount of payment
/**
* @var array<float|int>
*/
public $amounts = array(); // Array of amounts

/**
Expand All @@ -97,7 +105,7 @@ class PaymentSocialContribution extends CommonObject

/**
* @var string
* @deprecated
* @deprecated Use $num_payment instead
* @see $num_payment
*/
public $num_paiement;
Expand Down Expand Up @@ -318,8 +326,10 @@ public function fetch($id)
$this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep);
$this->amount = $obj->amount;
$this->total = $obj->amount;
$this->fk_typepaiement = $obj->fk_typepaiement;
$this->num_payment = $obj->num_payment;
$this->num_paiement = $obj->num_payment;
$this->note_private = $obj->note;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
Expand Down Expand Up @@ -577,7 +587,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom
$acc = new Account($this->db);
$acc->fetch($accountid);

$total = $this->total;
$total = $this->amount;
if ($mode == 'payment_sc') {
$total = -$total;
}
Expand Down
15 changes: 12 additions & 3 deletions htdocs/compta/tva/class/paymentvat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <[email protected]>
* Copyright (C) 2021 Gauthier VERDOL <[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 @@ -58,12 +59,20 @@ class PaymentVAT extends CommonObject
public $datep = '';

/**
* @deprecated
* @deprecated Use $amount instead
* @see $amount
* @var float|int
*/
public $total;

/**
* @var float|int
*/
public $amount; // Total amount of payment

/**
* @var array<float|int>
*/
public $amounts = array(); // Array of amounts

/**
Expand All @@ -73,7 +82,7 @@ class PaymentVAT extends CommonObject

/**
* @var string
* @deprecated
* @deprecated Use $num_payment instead
* @see $num_payment
*/
public $num_paiement;
Expand Down Expand Up @@ -578,7 +587,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom
$acc = new Account($this->db);
$acc->fetch($accountid);

$total = $this->total;
$total = $this->amount;
if ($mode == 'payment_vat') {
$total = -$total;
}
Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/tpl/admin_extrafields_add.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ function init_typeoffields(type)
});

/* Autofill the code with label */
<?php if (!getDolGlobalInt('MAIN_EXTRAFIELDS_CODE_AUTOFILL_DISABLED')) : ?>
jQuery("#label").keyup(function() {
console.log("Update new field");
$("#attrname").val( $(this).val().replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() );
$("#attrname").val( $(this).val().normalize('NFD').replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, '').toLowerCase() );
});
<?php endif; ?>
});
</script>

Expand Down
16 changes: 15 additions & 1 deletion htdocs/expensereport/class/paymentexpensereport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2015-2017 Alexandre Spangaro <[email protected]>
* Copyright (C) 2018 Nicolas ZABOURI <[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 @@ -65,7 +66,13 @@ class PaymentExpenseReport extends CommonObject
* @var int|string
*/
public $datep = '';
/**
* @var float|int
*/
public $amount; // Total amount of payment
/**
* @var array<float|int>
*/
public $amounts = array(); // Array of amounts

/**
Expand Down Expand Up @@ -94,7 +101,14 @@ class PaymentExpenseReport extends CommonObject
*/
public $fk_user_modif;

/**
* @var string
*/
public $type_code;

/**
* @var string
*/
public $type_label;

/**
Expand Down Expand Up @@ -693,7 +707,7 @@ public function getNomUrl($withpicto = 0, $maxlen = 0)
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static function ($arg) {
/**
* Previx option with '-' for single characters and -- for more than single characters
* @param string $arg
* @return straing
* @return string
*/
static function ($arg) {
if (strlen($arg) > 1) {
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,4 @@ AllowStockMovementVariantParent=Also records stock movements on parent products
AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtual product, so no stock is managed for it. By enabling this option, a stock will be managed for parent products and each time a stock quantity is modified for a variant product, the same quantity will be modified for the parent product. You should not need this option, except if you are using variant to manage the same product than parent (but with different descriptions, prices...)
ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?<br>The quantities currently set in the inventory will be reset.
WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned
PriceLabel=Price label
1 change: 1 addition & 0 deletions htdocs/langs/fr_FR/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,4 @@ WarningConvertFromBatchToSerial=Si vous disposez actuellement d'une quantité su
AllowStockMovementVariantParent=Enregistre également les mouvements de stock sur les produits parent des produits variants
AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un produit virtuel, donc aucun stock n'est géré pour celui-ci. En activant cette option, un stock sera géré pour les produits parents et à chaque fois qu'une quantité de stock est modifiée pour une variante de produit, la même quantité sera modifiée pour le produit parent. Vous ne devriez pas avoir besoin de cette option, sauf si vous utilisez une variante pour gérer le même produit que le parent (mais avec des descriptions, des prix différents...)
ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ?<br>Les quantités actuellement définies dans l'inventaire seront réinitialisées.
PriceLabel=Libellé du prix
28 changes: 25 additions & 3 deletions htdocs/loan/class/paymentloan.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2014-2018 Alexandre Spangaro <[email protected]>
* Copyright (C) 2015-2024 Frédéric France <[email protected]>
* Copyright (C) 2020 Maxime DEMAREST <[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 @@ -62,14 +63,23 @@ class PaymentLoan extends CommonObject
public $datep = '';

/**
* @var array Array of amounts
* @var array<float|int> Array of amounts
*/
public $amounts = array();

public $amount_capital; // Total amount of payment
/**
* @var float|int Total amount of payment
*/
public $amount_capital;

/**
* @var float|int
*/
public $amount_insurance;

/**
* @var float|int
*/
public $amount_interest;

/**
Expand Down Expand Up @@ -98,10 +108,22 @@ class PaymentLoan extends CommonObject
*/
public $fk_user_modif;

/**
* @var string
*/
public $type_code;
/**
* @var string
*/
public $type_label;
public $chid;
/**
* @var string
*/
public $label;
/**
* @var string
*/
public $paymenttype;
public $bank_account;
public $bank_line;
Expand Down Expand Up @@ -666,7 +688,7 @@ public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $moretitl

global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
Expand Down
Loading

0 comments on commit 3b7c31c

Please sign in to comment.