diff --git a/dev/setup/pre-commit/README.md b/dev/setup/pre-commit/README.md index e610a55c411..9ebe65c8a58 100644 --- a/dev/setup/pre-commit/README.md +++ b/dev/setup/pre-commit/README.md @@ -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 diff --git a/htdocs/adherents/messaging.php b/htdocs/adherents/messaging.php index 9222b072f5c..2ea83973919 100644 --- a/htdocs/adherents/messaging.php +++ b/htdocs/adherents/messaging.php @@ -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) ? '('.$nbEvent.')' : ''); + $titlelist = $langs->trans("ActionsOnMember").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 036ec02b7a5..af980e35abc 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -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 ''; - // 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 ''; - // State + // Bank state print ''.$langs->trans('State').''; if ($selectedcode) { print img_picto('', 'state', 'class="pictofixedwidth"'); @@ -467,6 +470,7 @@ if ($action == 'create') { } print ''; + // Bank address $type = (GETPOSTISSET("type") ? GETPOSTINT('type') : Account::TYPE_CURRENT); // add default value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''.$langs->trans("BankAccountDomiciliation").''; @@ -524,7 +528,7 @@ if ($action == 'create') { // Sold print ''.$langs->trans("InitialBankBalance").''; - print 'solde)).'">'; + print 'solde)).'">'; print ''.$langs->trans("Date").''; print ''; @@ -532,10 +536,10 @@ if ($action == 'create') { print ''; print ''.$langs->trans("BalanceMinimalAllowed").''; - print 'min_allowed).'">'; + print 'min_allowed).'">'; print ''.$langs->trans("BalanceMinimalDesired").''; - print 'min_desired).'">'; + print 'min_desired).'">'; print ''; print '
'; @@ -546,7 +550,7 @@ if ($action == 'create') { // If bank account print ''.$langs->trans("BankName").''; - print ''; + print ''; print ''; $ibankey = FormBank::getIBANLabel($object); @@ -602,26 +606,26 @@ if ($action == 'create') { print ''; print ''; - print ''; print '"; print ''; - print ''; print ''; - print ''; print ''; print ''; print '
'.$langs->trans("BankAccountOwner").''; + print ''; print '
'.$langs->trans("BankAccountOwnerAddress").''; print '
'.$langs->trans("BankAccountOwnerZip").''; + print ''; print '
'.$langs->trans("BankAccountOwnerTown").''; + print ''; print '
'.$langs->trans("BankAccountOwnerCountry").''; 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 '
'; @@ -709,7 +713,7 @@ if ($action == 'create') { print $langs->trans("Currency".$selectedcode); print ''; - // Conciliate + // Conciliable print ''.$langs->trans("Conciliable").''; print ''; $conciliate = $object->canBeConciliated(); @@ -976,10 +980,10 @@ if ($action == 'create') { // Status print ''.$langs->trans("Status").''; print ''; - 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 ''; - // 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 ''; - // State + // Bank state print ''.$langs->trans('State').''; if ($selectedcode) { print img_picto('', 'state', 'class="pictofixedwidth"'); @@ -1007,6 +1011,7 @@ if ($action == 'create') { } print ''; + // Bank address $type = (GETPOSTISSET('type') ? GETPOSTINT('type') : $object->type); // add default current value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''.$langs->trans("BankAccountDomiciliation").''; @@ -1020,9 +1025,9 @@ if ($action == 'create') { print ''; $conciliate = $object->canBeConciliated(); if ($conciliate == -2) { - print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; + print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; } elseif ($conciliate == -3) { - print $langs->trans("No").' ('.$langs->trans("Closed").')'; + print $langs->trans("No").' ('.$langs->trans("Closed").')'; } else { print ' 0) ? '' : ' checked="checked"').'"> '; } @@ -1197,26 +1202,26 @@ if ($action == 'create') { print ''; print ''; - print ''; + print ''; print ''; print '"; print ''; - print ''; print ''; - print ''; print ''; print ''; print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; print '
'.$langs->trans("BankAccountOwnerZip").''; + print ''; print '
'.$langs->trans("BankAccountOwnerTown").''; + print ''; print '
'.$langs->trans("BankAccountOwnerCountry").''; 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 '
'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b66f728f075..26dd13ea33e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -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 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'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1ee62de8a86..6b445b482c1 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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 ''; } 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 '%'; + print '%'; if (!empty($usemargins)) { print ''; diff --git a/htdocs/core/class/doldeprecationhandler.class.php b/htdocs/core/class/doldeprecationhandler.class.php index 2033794887f..ac5d6afedef 100644 --- a/htdocs/core/class/doldeprecationhandler.class.php +++ b/htdocs/core/class/doldeprecationhandler.class.php @@ -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 ); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index cc3f971a357..b9d038297e8 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2976,12 +2976,17 @@ if ($action == 'create' || $action == 'adduserldap') { $MAXEVENT = 10; + $morehtmlcenter = '
'; + $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 .= '
'; + print '
'; // 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 '
'; } diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index 713c7f83b34..119982736ab 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -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) ? '('.$nbEvent.')' : ''); + $titlelist = $langs->trans("ActionsOnUser").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); }