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

This commit is contained in:
Laurent Destailleur 2024-08-13 11:59:53 +02:00
commit ed73dc6471
8 changed files with 58 additions and 66 deletions

View File

@ -94,4 +94,4 @@ CI also runs pre-commit to help maintain code quality.
Note:
Code for precommits are saved into:
.cache/pre-commit/repoyXXXXX/py_env-python3/lib/pythonX.Y/site-packages/pre_commit_hooks/no_commit_to_branch.py
.cache/pre-commit/repo*/py_env-python3/lib/python*/site-packages/pre_commit_hooks/no_commit_to_branch.py

View File

@ -196,7 +196,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') ||
$cachekey = 'count_events_user_'.$object->id;
$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
$titlelist = $langs->trans("ActionsOnMember").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
}

View File

@ -83,6 +83,7 @@ if (GETPOSTINT("id") || GETPOST("ref")) {
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
/*
* Actions
*/
@ -147,6 +148,7 @@ if (empty($reshook)) {
$object->domiciliation = $object->address; // deprecated
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_name = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
$object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml'));
$object->owner_town = trim(GETPOST("owner_town", 'alphanohtml'));
@ -262,6 +264,7 @@ if (empty($reshook)) {
$object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1;
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_name = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
$object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml'));
$object->owner_town = trim(GETPOST("owner_town", 'alphanohtml'));
@ -439,7 +442,7 @@ if ($action == 'create') {
print $form->selectarray("clos", $object->labelStatus, (GETPOSTINT('clos') != '' ? GETPOSTINT('clos') : $object->status), 0, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth150onsmartphone');
print '</td></tr>';
// Country
// Bank country
$selectedcode = '';
if (GETPOSTISSET("account_country_id")) {
$selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code;
@ -457,7 +460,7 @@ if ($action == 'create') {
}
print '</td></tr>';
// State
// Bank state
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($selectedcode) {
print img_picto('', 'state', 'class="pictofixedwidth"');
@ -467,6 +470,7 @@ if ($action == 'create') {
}
print '</td></tr>';
// Bank address
$type = (GETPOSTISSET("type") ? GETPOSTINT('type') : Account::TYPE_CURRENT); // add default value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
@ -524,7 +528,7 @@ if ($action == 'create') {
// Sold
print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde") ? GETPOST("solde") : price2num($object->solde)).'"></td></tr>';
print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOSTISSET("solde") ? GETPOST("solde") : price2num($object->solde)).'"></td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td>';
@ -532,10 +536,10 @@ if ($action == 'create') {
print '</td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST("account_min_allowed") ? GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>';
print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOSTISSET("account_min_allowed") ? GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST("account_min_desired") ? GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>';
print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOSTISSET("account_min_desired") ? GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>';
print '</table>';
print '<br>';
@ -546,7 +550,7 @@ if ($action == 'create') {
// If bank account
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST('bank') ? GETPOST('bank', 'alpha') : $object->bank).'"></td>';
print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOSTISSET('bank') ? GETPOST('bank', 'alpha') : $object->bank).'"></td>';
print '</tr>';
$ibankey = FormBank::getIBANLabel($object);
@ -602,26 +606,26 @@ if ($action == 'create') {
print '<table class="border centpercent">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankAccountOwner").'</td>';
print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ? GETPOST('proprio', 'alpha') : $object->proprio).'">';
print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOSTISSET('proprio') ? GETPOST('proprio', 'alpha') : $object->owner_name).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
print(GETPOST('owner_address') ? GETPOST('owner_address', 'alpha') : $object->owner_address);
print(GETPOSTISSET('owner_address') ? GETPOST('owner_address', 'alpha') : $object->owner_address);
print "</textarea></td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerZip").'</td>';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST('owner_zip') ? GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET('owner_zip') ? GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerTown").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST('owner_town') ? GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET('owner_town') ? GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerCountry").'</td>';
print '<td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOST('owner_country_id') ? GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print $form->select_country(GETPOSTISSET('owner_country_id') ? GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print '</td></tr>';
print '</table>';
@ -709,7 +713,7 @@ if ($action == 'create') {
print $langs->trans("Currency".$selectedcode);
print '</td></tr>';
// Conciliate
// Conciliable
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td>';
$conciliate = $object->canBeConciliated();
@ -976,10 +980,10 @@ if ($action == 'create') {
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td class="maxwidth200onsmartphone">';
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOSTINT("clos") : $object->clos));
print $form->selectarray("clos", $object->labelStatus, (GETPOSTISSET("clos") ? GETPOSTINT("clos") : $object->status));
print '</td></tr>';
// Country
// Bank country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
$selectedcode = $object->country_code;
if (GETPOSTISSET("account_country_id")) {
@ -997,7 +1001,7 @@ if ($action == 'create') {
}
print '</td></tr>';
// State
// Bank state
print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
if ($selectedcode) {
print img_picto('', 'state', 'class="pictofixedwidth"');
@ -1007,6 +1011,7 @@ if ($action == 'create') {
}
print '</td></tr>';
// Bank address
$type = (GETPOSTISSET('type') ? GETPOSTINT('type') : $object->type); // add default current value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
@ -1020,9 +1025,9 @@ if ($action == 'create') {
print '<td>';
$conciliate = $object->canBeConciliated();
if ($conciliate == -2) {
print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
} elseif ($conciliate == -3) {
print $langs->trans("No").' ('.$langs->trans("Closed").')';
print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
} else {
print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro" class="opacitymedium">'.$langs->trans("DisableConciliation").'</label>';
}
@ -1197,26 +1202,26 @@ if ($action == 'create') {
print '<table class="border centpercent">';
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.(GETPOSTISSET('proprio') ? GETPOST('proprio', 'alpha') : $object->owner_name).'"></td>';
print '</tr>';
print '<tr><td class="titlefieldcreate tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
print $object->owner_address;
print GETPOSTISSET('owner_address') ? GETPOST('owner_address', 'alpha') : $object->owner_address;
print "</textarea></td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerZip").'</td>';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST('owner_zip') ? GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET('owner_zip') ? GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerTown").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST('owner_town') ? GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET('owner_town') ? GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerCountry").'</td>';
print '<td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOST('owner_country_id') ? GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print $form->select_country(GETPOSTISSET('owner_country_id') ? GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print '</td></tr>';
print '</table>';

View File

@ -74,7 +74,7 @@ class Account extends CommonObject
* @deprecated
* @see $type
*/
private $courant; // @phpstan-ignore-line
public $courant;
/**
* Bank account type. Check TYPE_ constants. It's integer but Company bank account use string to identify type account
@ -95,7 +95,7 @@ class Account extends CommonObject
* @deprecated Duplicate field. We already have the field $this->status
* @see $status
*/
private $clos = self::STATUS_OPEN;
public $clos = self::STATUS_OPEN;
/**
* Does it need to be conciliated?
@ -165,7 +165,7 @@ class Account extends CommonObject
* @deprecated
* @see $owner_name
*/
private $proprio;
public $proprio;
/**
* Name of account holder
@ -199,7 +199,7 @@ class Account extends CommonObject
* @deprecated
* @see $address
*/
private $domiciliation;
public $domiciliation;
/**
* Address of the bank account
@ -278,7 +278,7 @@ class Account extends CommonObject
* @deprecated
* @see $balance
*/
private $solde; // @phpstan-ignore-line
public $solde;
/**
* Balance. Used in Account::create
@ -394,22 +394,6 @@ class Account extends CommonObject
const STATUS_CLOSED = 1;
/**
* Provide list of deprecated properties and replacements
*
* @return array<string,string> Old property to new property mapping
*/
protected function deprecatedProperties()
{
return array(
'proprio' => 'owner_name',
'domiciliation' => 'owner_address',
'courant' => 'type',
'clos' => 'status',
'solde' => 'balance',
) + parent::deprecatedProperties();
}
/**
* Constructor
*
@ -815,7 +799,7 @@ class Account extends CommonObject
$sql .= ", '".$this->db->escape($this->iban)."'";
$sql .= ", '".$this->db->escape($this->address)."'";
$sql .= ", ".((int) $this->pti_in_ctti);
$sql .= ", '".$this->db->escape($this->proprio)."'";
$sql .= ", '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'";
$sql .= ", '".$this->db->escape($this->owner_address)."'";
$sql .= ", '".$this->db->escape($this->owner_zip)."'";
$sql .= ", '".$this->db->escape($this->owner_town)."'";
@ -900,7 +884,7 @@ class Account extends CommonObject
*/
public function update(User $user, $notrigger = 0)
{
global $langs;
global $langs, $conf;
$error = 0;
@ -921,11 +905,9 @@ class Account extends CommonObject
$this->label = "???";
}
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET";
$sql .= " ref = '".$this->db->escape($this->ref)."'";
$sql .= ",label = '".$this->db->escape($this->label)."'";
$sql .= ",courant = ".((int) $this->type);
$sql .= ",clos = ".((int) $this->status);
$sql .= ",rappro = ".((int) $this->rappro);
@ -941,7 +923,7 @@ class Account extends CommonObject
$sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'";
$sql .= ",domiciliation='".$this->db->escape($this->address)."'";
$sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti);
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",proprio = '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
$sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'";
$sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'";
@ -1040,7 +1022,7 @@ class Account extends CommonObject
return -2;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET";
$sql .= " bank = '".$this->db->escape($this->bank)."'";
$sql .= ",code_banque='".$this->db->escape($this->code_banque)."'";
$sql .= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
@ -1048,8 +1030,8 @@ class Account extends CommonObject
$sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
$sql .= ",bic='".$this->db->escape($this->bic)."'";
$sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'";
$sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",domiciliation='".$this->db->escape($this->address ? $this->address : $this->domiciliation)."'";
$sql .= ",proprio = '".$this->db->escape($this->owner_name ? $this->owner_name : $this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
$sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'";
$sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'";
@ -1134,8 +1116,8 @@ class Account extends CommonObject
$this->domiciliation = $obj->address;
$this->address = $obj->address;
$this->pti_in_ctti = $obj->pti_in_ctti;
$this->proprio = $obj->owner_name;
$this->owner_name = $obj->owner_name;
$this->proprio = $obj->owner_name;
$this->owner_name = $obj->owner_name;
$this->owner_address = $obj->owner_address;
$this->owner_zip = $obj->owner_zip;
$this->owner_town = $obj->owner_town;
@ -1933,8 +1915,8 @@ class Account extends CommonObject
$this->label = 'My Big Company Bank account';
$this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN;
$this->type = Account::TYPE_CURRENT;
$this->status = Account::STATUS_OPEN;
$this->type = Account::TYPE_CURRENT;
$this->status = Account::STATUS_OPEN;
$this->code_banque = '30001';
$this->code_guichet = '00794';
$this->number = '12345678901';
@ -1945,7 +1927,7 @@ class Account extends CommonObject
$this->bank = 'MyBank';
$this->address = 'Rue de Paris';
$this->proprio = 'Owner';
$this->owner_name = 'Owner';
$this->owner_name = 'Owner';
$this->owner_address = 'Owner address';
$this->owner_zip = 'Owner zip';
$this->owner_town = 'Owner town';

View File

@ -1744,7 +1744,7 @@ if ($action == 'create') {
if ($objp->fk_product > 0) {
$canchangeproduct = 1;
// TODO: As $canchangeproduct is set just before, in what usecase it can be empty ?
// @TODO: As $canchangeproduct is set just before, in what usecase it can be empty ?
if (empty($canchangeproduct)) {
$productstatic->id = $objp->fk_product;
$productstatic->type = $objp->ptype;
@ -1754,9 +1754,9 @@ if ($action == 'create') {
print $objp->label ? ' - '.dol_trunc($objp->label, 32) : '';
print '<input type="hidden" name="idprod" value="'.$currentLineProductId.'">';
} else {
$senderissupplier = 0;
$senderissupplier = 0; // @TODO Option to allow purchased products ?
if (empty($senderissupplier)) {
print $form->select_produits($currentLineProductId, 'idprod');
print $form->select_produits($currentLineProductId, 'idprod', '', 0, 0, 1, 2, '', 0, array(), 0, 1, 0, 'minwidth250onall maxwidth500 widthcentpercentminusx');
} else {
$form->select_produits_fournisseurs($currentLineProductId, 'idprod');
}
@ -1802,7 +1802,7 @@ if ($action == 'create') {
}
// Discount
print '<td class="nowrap right"><input size="1" type="text" name="elremise_percent" value="'.(GETPOSTISSET('elremise_percent')?GETPOST('elremise_percent'):$objp->remise_percent).'">%</td>';
print '<td class="nowraponall right"><input size="1" type="text" name="elremise_percent" value="'.(GETPOSTISSET('elremise_percent')?GETPOST('elremise_percent'):$objp->remise_percent).'">%</td>';
if (!empty($usemargins)) {
print '<td class="right">';

View File

@ -232,7 +232,7 @@ trait DolDeprecationHandler
// Define deprecated properties and their replacements
return array(
// 'oldProperty' => 'newProperty',
// Add deprecated properties and their replacements in subclass implementation
// Add deprecated properties and their replacements in subclass implementation
);
}

View File

@ -2976,12 +2976,17 @@ if ($action == 'create' || $action == 'adduserldap') {
$MAXEVENT = 10;
$morehtmlcenter = '<div class="nowraponall">';
$morehtmlcenter .= dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/user/messaging.php?id='.$object->id);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/user/agenda.php?id='.$object->id);
$morehtmlcenter .= '</div>';
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', $MAXEVENT, '', '', $object->id);
$somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', $MAXEVENT, '', $morehtmlcenter, $object->id);
print '</div></div>';
}

View File

@ -215,7 +215,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') ||
$cachekey = 'count_events_user_'.$object->id;
$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
$titlelist = $langs->trans("ActionsOnUser").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
}