Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table names in object.class.php #31056

Open
dolibarr95 opened this issue Sep 20, 2024 · 1 comment
Open

Table names in object.class.php #31056

dolibarr95 opened this issue Sep 20, 2024 · 1 comment
Labels
Feature request This is a feature request

Comments

@dolibarr95
Copy link
Contributor

Feature Request

Hello

Just a question or a misunderstanding :
Why in object classes we declare the name of the table.
For example:

/**
 * @var string Name of table without prefix where object is stored
 */
public $table_element = 'commande';

But in the queries we write the name of the table

$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > '.self::STATUS_DRAFT;

and not:

$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element .' SET facture = 1';
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > '.self::STATUS_DRAFT;

Tks for reading.

Use case

No response

Suggested implementation

No response

Suggested steps

No response

@dolibarr95 dolibarr95 added the Feature request This is a feature request label Sep 20, 2024
@zephyriony
Copy link
Contributor

Probably because it was done after the fact, or because the developer wasn't aware that this property existed, you can make a pull request. In my opinion, you should actually do this

dolibarr95 added a commit to dolibarr95/dolibarr that referenced this issue Sep 27, 2024
Replace the values :
propal: $this->table_element
propaldet : $this->table_element_line
in the sql queries.
see Dolibarr#31056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request This is a feature request
Projects
None yet
Development

No branches or pull requests

2 participants