From f08ce6d96adc78d8e04ab32828c3c13c5b82f497 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 21 May 2013 14:28:42 +0200 Subject: [PATCH 1/6] Fix bug on DDLCreateDb in Mysql --- htdocs/core/db/mysql.class.php | 35 ++++++++++++++++------------ htdocs/core/db/mysqli.class.php | 41 ++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 81d5d7de4ff..66024689c4f 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -884,22 +884,27 @@ class DoliDBMysql { $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; - if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) - { - if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; - else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + if( preg_match("/^[^\s]/i",$field_desc['value'])) { + $sqlfields[$i] .= "(".$field_desc['value'].")"; + } + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) { + $sqlfields[$i] .= " ".$field_desc['attribute']; + } + if( preg_match("/^[^\s]/i",$field_desc['default'])) + { + if ((preg_match("/null/i",$field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i",$field_desc['default']))) { + $sqlfields[$i] .= " default ".$field_desc['default']; + } + else { + $sqlfields[$i] .= " default '".$field_desc['default']."'"; + } + } + if( preg_match("/^[^\s]/i",$field_desc['null'])) { + $sqlfields[$i] .= " ".$field_desc['null']; + } + if( preg_match("/^[^\s]/i",$field_desc['extra'])) { + $sqlfields[$i] .= " ".$field_desc['extra']; } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; - - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; $i++; } if($primary_key != "") diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index ba24d5c53bf..95a9a24384c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -876,24 +876,29 @@ class DoliDBMysqli $i=0; foreach($fields as $field_name => $field_desc) { - $sqlfields[$i] = $field_name." "; - $sqlfields[$i] .= $field_desc['type']; - if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) - { - if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; - else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; - } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; - - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; + $sqlfields[$i] = $field_name." "; + $sqlfields[$i] .= $field_desc['type']; + if( preg_match("/^[^\s]/i",$field_desc['value'])) { + $sqlfields[$i] .= "(".$field_desc['value'].")"; + } + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) { + $sqlfields[$i] .= " ".$field_desc['attribute']; + } + if( preg_match("/^[^\s]/i",$field_desc['default'])) + { + if ((preg_match("/null/i",$field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i",$field_desc['default']))) { + $sqlfields[$i] .= " default ".$field_desc['default']; + } + else { + $sqlfields[$i] .= " default '".$field_desc['default']."'"; + } + } + if( preg_match("/^[^\s]/i",$field_desc['null'])) { + $sqlfields[$i] .= " ".$field_desc['null']; + } + if( preg_match("/^[^\s]/i",$field_desc['extra'])) { + $sqlfields[$i] .= " ".$field_desc['extra']; + } $i++; } if($primary_key != "") From b36a16ed43bc156e332c546b917391383a03224b Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 21 May 2013 14:32:30 +0200 Subject: [PATCH 2/6] Change-Id: I2e25d4b82388f6a0fc83b97f9162a095247e3fa1 --- htdocs/core/db/mysql.class.php | 2 +- htdocs/core/db/mysqli.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 66024689c4f..10ba70c11af 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -878,7 +878,7 @@ class DoliDBMysql { // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "create table ".$table."("; + $sql = "CREATE TABLE ".$table."("; $i=0; foreach($fields as $field_name => $field_desc) { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 95a9a24384c..b07f3e8e354 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -872,11 +872,11 @@ class DoliDBMysqli { // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql = "create table ".$table."("; + $sql = "CREATE TABLE ".$table."("; $i=0; foreach($fields as $field_name => $field_desc) { - $sqlfields[$i] = $field_name." "; + $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; if( preg_match("/^[^\s]/i",$field_desc['value'])) { $sqlfields[$i] .= "(".$field_desc['value'].")"; From 992600664e2fb397fb23dc26878b55ee5c5ff6f3 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 22 May 2013 10:29:31 +0200 Subject: [PATCH 3/6] fix wrong construction of description when creatin from orders (it was putting a mess on update) --- htdocs/fichinter/fiche.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 086b88fa032..1a2820ef5ce 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -195,8 +195,6 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) // service prédéfini if ($lines[$i]->fk_product > 0) { - $product_static = new Product($db); - // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { @@ -219,15 +217,8 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $label = $lines[$i]->product_label; } - $product_static->type=$lines[$i]->fk_product_type; - $product_static->id=$lines[$i]->fk_product; - $product_static->ref=$lines[$i]->ref; - $product_static->libelle=$label; - $desc=$product_static->getNomUrl(0); - $desc.= ' - '.$label; + $desc = $label; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - if ($conf->global->PRODUIT_DESC_IN_FORM) - $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?'
'.dol_htmlentitiesbr($lines[$i]->desc):''; } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); From 469ae91e70a4517e9bcc0849fd7111dac9ef98ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2013 12:02:39 +0200 Subject: [PATCH 4/6] Fix: regression --- htdocs/core/lib/json.lib.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 24464898a28..9b6f5a95d62 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -72,15 +72,16 @@ function dol_json_encode($elements) $output = '{'; $last = $num - 1; $i = 0; - if (is_array($elements) && count($elements)>0) { - foreach($elements as $key => $value) - { - $output .= '"'.$key.'":'; - if (is_array($value)) $output.= json_encode($value); - else $output .= _val($value); - if ($i !== $last) $output.= ','; - ++$i; - } + $tmpelements=array(); + if (is_array($elements)) $tmpelements=$elements; + if (is_object($elements)) $tmpelements=get_object_vars($elements); + foreach($tmpelements as $key => $value) + { + $output .= '"'.$key.'":'; + if (is_array($value)) $output.= json_encode($value); + else $output .= _val($value); + if ($i !== $last) $output.= ','; + ++$i; } $output.= '}'; } From 7856b7f613ce7e884c455759e249c1f1bfa8a444 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2013 15:52:26 +0200 Subject: [PATCH 5/6] Removed warning --- build/obs/README | 7 +++++-- htdocs/webservices/demo_wsclient_category.php-NORUN | 3 +-- htdocs/webservices/server_category.php | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/obs/README b/build/obs/README index 24a6df2e84b..8b3ea336dc1 100644 --- a/build/obs/README +++ b/build/obs/README @@ -23,10 +23,13 @@ To submit a snapshot for building, we should have a service file with content www.dolibarr.org http - /files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm + /files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm How to have such a service ? -Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm +Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm +Then add into advanded - attributes +OBS:Screenshots http://www.dolibarr.org/images/phocagallery/dolibarr_screenshot1.png +OBS:QualityCategory Testing \ No newline at end of file diff --git a/htdocs/webservices/demo_wsclient_category.php-NORUN b/htdocs/webservices/demo_wsclient_category.php-NORUN index 9feda9dcb9b..0793fd1806c 100755 --- a/htdocs/webservices/demo_wsclient_category.php-NORUN +++ b/htdocs/webservices/demo_wsclient_category.php-NORUN @@ -13,8 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program. If not, see . */ /** diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index abf12b0f591..5e55dae8b18 100755 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -13,8 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program. If not, see . */ /** From ee8445710444430fd4f08e23a8e0fa05b15d95ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2013 10:04:35 +0200 Subject: [PATCH 6/6] Fix: not defined default value --- .../mailings/thirdparties_services_expired.modules.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 75f67ca2c46..f618a156819 100755 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -175,11 +175,9 @@ class mailing_thirdparties_services_expired extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param int $filter Filter - * @param string $option Option * @return int Number of recipients */ - function getNbOfRecipients($sql,$filter=1,$option='') + function getNbOfRecipients($sql='') { $now=dol_now();