From 13ad88832c3413155bc21970db8005b3cc0c28e7 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 21 May 2013 14:31:39 +0200 Subject: [PATCH 1/8] Fix bug in DDLCreateTable --- htdocs/core/db/mysql.class.php | 23 +++++++++------- htdocs/core/db/mysqli.class.php | 48 ++++++++++++++++----------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 4868fb81642..287fba04bcc 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -879,30 +879,33 @@ 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) { $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; - if( preg_match("/^[^\s]/i",$field_desc['value'])) + if( preg_match("/^[^\s]/i",$field_desc['value'])) { $sqlfields[$i] .= "(".$field_desc['value'].")"; - if( preg_match("/^[^\s]/i",$field_desc['attribute'])) + } + 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'])) + if ((preg_match("/null/i",$field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i",$field_desc['default']))) { $sqlfields[$i] .= " default ".$field_desc['default']; - elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') - $sqlfields[$i] .= " default ".$field_desc['default']; - else + } + else { $sqlfields[$i] .= " default '".$field_desc['default']."'"; + } } - if( preg_match("/^[^\s]/i",$field_desc['null'])) + if( preg_match("/^[^\s]/i",$field_desc['null'])) { $sqlfields[$i] .= " ".$field_desc['null']; - - if( preg_match("/^[^\s]/i",$field_desc['extra'])) + } + 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 e7ccebbd0ee..2ae51e7def5 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -873,33 +873,33 @@ 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_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'])) - $sqlfields[$i] .= " default ".$field_desc['default']; - elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') - $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']; + $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 961ce6e3e2837ba19ca76223ea9c95a7f0f4263e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 May 2013 19:53:10 +0200 Subject: [PATCH 2/8] Fix: Removed error blocking redirect --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b93d383638b..545a0254eed 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -68,7 +68,7 @@ $conffiletoshow = "htdocs/conf/conf.php"; // Include configuration -$result=include_once $conffile; +$result=@include_once $conffile; // Keep @ because with some error reporting this break the redirect if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done and we are in a web session { From bb42f8384b9da0873020fd4fd7d1d2546fd933d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Pr=C3=B6mer?= Date: Wed, 22 May 2013 14:59:21 +0200 Subject: [PATCH 3/8] Fix: 'rights' instead of 'right' --- htdocs/core/lib/company.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index de42a730b2b..6279e4ee9a0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -60,15 +60,15 @@ function societe_prepare_head($object) $head[$h][2] = 'supplier'; $h++; } - if (! empty($conf->agenda->enabled) && !empty($user->right->agenda->lire)) - { + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; $head[$h][1] = $langs->trans("Agenda"); $head[$h][2] = 'agenda'; $h++; } //show categorie tab - if (! empty($conf->categorie->enabled) && !empty($user->right->categorie->lire)) + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { $type = 2; if ($object->fournisseur) $type = 1; From 3b6c55f90850374166ced57cf4cbead23baa9ac3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2013 17:29:25 +0200 Subject: [PATCH 4/8] Fix: Param was renamed --- htdocs/fourn/facture/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index d4010f6c495..3a157d74ceb 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -95,7 +95,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes') $result=$object->createFromClone($id); if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF'].'?action=editfacnumber&id='.$result); + header("Location: ".$_SERVER['PHP_SELF'].'?action=editref_supplier&id='.$result); exit; } else @@ -1158,7 +1158,7 @@ if ($action == 'create') print ''.$langs->trans('DateMaxPayment').''; $form->select_date($datedue,'ech','','','',"add",1,1); print ''; - + // Project if (! empty($conf->projet->enabled)) { From 7bbdae239f12e7ec3dc0413fbf8ad33aabc0781f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2013 14:32:12 +0200 Subject: [PATCH 5/8] Fix: Removed errors with not defined vars --- htdocs/core/get_menudiv.php | 2 ++ htdocs/user/class/user.class.php | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 0f1da52c46e..f320b7cc8eb 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -45,6 +45,8 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); * View */ +$title=$langs->trans("Menu"); + // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests $arrayofjs=array(); $arrayofcss=array(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 32dafcef617..4639405bfd4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1113,7 +1113,10 @@ class User extends CommonObject $this->note = trim($this->note); $this->openid = trim(empty($this->openid)?'':$this->openid); // Avoid warning $this->admin = $this->admin?$this->admin:0; - + $this->address = empty($this->address)?'':$this->address; + $this->zip = empty($this->zip)?'':$this->zip; + $this->town = empty($this->town)?'':$this->town; + // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) { @@ -1133,8 +1136,8 @@ class User extends CommonObject $sql.= ", address = '".$this->db->escape($this->address)."'"; $sql.= ", zip = '".$this->db->escape($this->zip)."'"; $sql.= ", town = '".$this->db->escape($this->town)."'"; - $sql.= ", fk_state = ".($this->state_id > 0?"'".$this->db->escape($this->state_id)."'":"null"); - $sql.= ", fk_country = ".($this->country_id > 0?"'".$this->db->escape($this->country_id)."'":"null"); + $sql.= ", fk_state = ".((! empty($this->state_id) && $this->state_id > 0)?"'".$this->db->escape($this->state_id)."'":"null"); + $sql.= ", fk_country = ".((! empty($this->country_id) && $this->country_id > 0)?"'".$this->db->escape($this->country_id)."'":"null"); $sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'"; $sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'"; $sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'"; From c97d1cb15b94d9b3850d2d179d620e0e3d828fb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2013 19:29:39 +0200 Subject: [PATCH 6/8] Try a fix for some browsers --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5a39f4b09ef..d27bb64e6d0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -931,7 +931,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($disablehead)) { print "\n"; - + if (GETPOST('dol_basehref')) print ''."\n"; // Displays meta print ''."\n"; // Evite indexation par robots print ''."\n"; From 9ecb1ddcb4cc2c83d6f6ae5b9a4e7c6e2ceafd51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2013 18:20:28 +0200 Subject: [PATCH 7/8] Fix: Missing translation --- htdocs/fourn/fiche.php | 3 ++- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/langs/fr_FR/cashdesk.lang | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 3fcfa4b7a86..38ce1e648b3 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -102,13 +102,14 @@ if ($object->fetch($id)) if ($object->fournisseur) { - print ''; + print ''; print ''.$langs->trans("SupplierCode"). ''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; print ''; + $langs->load('compta'); print ''; print ''; print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer); diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 2f252d39923..f8e1d1fa780 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -13,6 +13,7 @@ CashDeskProducts=Products CashDeskStock=Stock CashDeskOn=on CashDeskThirdParty=Third party +CashdeskDashboard=Point of sale access ShoppingCart=Shopping cart NewSell=New sell BackOffice=Back office diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 5c59db99c57..6eab6e5b3d0 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -13,6 +13,7 @@ CashDeskProducts=Produits CashDeskStock=Stock CashDeskOn=de CashDeskThirdParty=Tiers +CashdeskDashboard=Accès Point de vente ShoppingCart=Panier NewSell=Nouvelle vente BackOffice=Back office From eecfbf9670ec7a3faee3097a700a225405dd605c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2013 18:49:40 +0200 Subject: [PATCH 8/8] Fix: Bad link if not supplier defined for product --- htdocs/fourn/product/liste.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index fc35d0a8057..3f8b3ed0353 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -231,7 +231,9 @@ if ($resql) $companystatic->nom=$objp->nom; $companystatic->id=$objp->socid; - print ''.$companystatic->getNomUrl(1,'supplier').''; + print ''; + if ($companystatic->id > 0) print $companystatic->getNomUrl(1,'supplier'); + print ''; print ''.price($objp->price).'';