dolibarr-bugtrack
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-bugtrack] [Bug #1764] Creation of product/service with masks h


From: Doliforge
Subject: [Dolibarr-bugtrack] [Bug #1764] Creation of product/service with masks having "/", get replaced by "_"
Date: Mon, 16 Mar 2015 14:32:27 +0100

Doliforge
Is this email not displaying correctly?
update email preferences.

Creation of product/service with masks having "/", get replaced by "_"

Latest modifications

2015-03-16 14:32 (Europe/Paris)
[Here is my complete answer, deleted by using the Canned Response]

Reading the code makes me say that it is not a bug.
Files can be attached to a product/service, they are stored in the filesystem under {DOL_DATA_ROOT}/documents/produit/{product_reference}.
In the example the path would be {DOL_DATA_ROOT}/documents/produit/PR0001/122014 which is not possible on linux OS.

In source code of the 3.6.2 version the creation of a product/service is assumed by the function create() (htdocs/product/class/product.class.php l.220) which call the following code on the product/service reference:
$this->ref = dol_string_nospecial(trim($this->ref));

The source code of dol_string_nospecial() function (htdocs/core/lib/functions.lib.php l.431) indicates that several characters are forbidden:
$forbidden_characters_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");


However this bug notification raises some question about the product/service reference template rules, which seem to be a little bit confusing: people can define a template which is not used by Dolibarr without any warning to the user!

In my opinion there is (at least) 2 ways to avoid this confusion:
- the 'Product and Services' configuration page can be updated to forbid these characters typing in the reference template. I think this is the less complicated to implement.
- the product/service configuration can be updated with a new field dedicated to store the real path which will contain the filtered reference (forbidden characters replaced by the undersore as current behaviour). Then the forbidden characters would become authorized in the reference template. As I just started some development on Dolibarr my vision of the global impact is not clear enough to say this appproach is the good one!

Answer now

Snapshot

 Details
Last Modified On:  2015-03-16 14:29 Submitted by:  marcosgdf
Submitted on:  2014-12-25 20:34 
Summary:  Creation of product/service with masks having "/", get replaced by "_"
Description:  Having a product/service with a mask PR{0000}/{mm}{yyyy} creates products/services with ref PR0001_122014
Step to reproduce bug:  
Detected in version:  3.7.0 Category:  Module: Products-Services
Severity:  3 OS Type/Version:  
PHP version:   Database type and version:  
 Status
Status:  Open Assigned to:  None
Resolution:  None 

Comments

zglorb 2015-03-16 14:32
[Here is my complete answer, deleted by using the Canned Response]

Reading the code makes me say that it is not a bug.
Files can be attached to a product/service, they are stored in the filesystem under {DOL_DATA_ROOT}/documents/produit/{product_reference}.
In the example the path would be {DOL_DATA_ROOT}/documents/produit/PR0001/122014 which is not possible on linux OS.

In source code of the 3.6.2 version the creation of a product/service is assumed by the function create() (htdocs/product/class/product.class.php l.220) which call the following code on the product/service reference:
$this->ref = dol_string_nospecial(trim($this->ref));

The source code of dol_string_nospecial() function (htdocs/core/lib/functions.lib.php l.431) indicates that several characters are forbidden:
$forbidden_characters_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");


However this bug notification raises some question about the product/service reference template rules, which seem to be a little bit confusing: people can define a template which is not used by Dolibarr without any warning to the user!

In my opinion there is (at least) 2 ways to avoid this confusion:
- the 'Product and Services' configuration page can be updated to forbid these characters typing in the reference template. I think this is the less complicated to implement.
- the product/service configuration can be updated with a new field dedicated to store the real path which will contain the filtered reference (forbidden characters replaced by the undersore as current behaviour). Then the forbidden characters would become authorized in the reference template. As I just started some development on Dolibarr my vision of the global impact is not clear enough to say this appproach is the good one!
zglorb 2015-03-16 14:29
Report looks to be more a feature request than a bug report. So i
close the request to move it from bug list. Waiting for a
developer to develop enhancement and send a request to include it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]