From 408a02832034339a1ff1349baee8fc3505197468 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2014 20:07:25 +0100 Subject: [PATCH 1/7] Fix: Must return a string --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8b572bc5635..7aa09f556b9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -705,7 +705,7 @@ class Form } else {*/ - print $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit); + return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit); //} } From 1ae87887fb26fd6ccf3a934016a5f6d1ea515d68 Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 4 Feb 2014 17:53:41 +0100 Subject: [PATCH 2/7] Fix into user webservices : better error management and country detection - Avoid errors when creating an user with thirdparty - Add country detection in webservices when country_code is filled --- htdocs/webservices/server_user.php | 53 +++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 3a7d0a89283..c33bfaf07ea 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -181,7 +181,8 @@ $thirdpartywithuser_fields = array( 'tva_intra' => array('name'=>'tva_intra','type'=>'xsd:string'), // For user 'login' => array('name'=>'login','type'=>'xsd:string'), - 'password' => array('name'=>'password','type'=>'xsd:string') + 'password' => array('name'=>'password','type'=>'xsd:string'), + 'group_id' => array('name'=>'group_id','type'=>'xsd:string') ); //Retreive all extrafield for contact @@ -523,6 +524,7 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) } else { + $db->begin(); /* * Company creation */ @@ -533,6 +535,25 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) $thirdparty->town=$thirdpartywithuser['town']; $thirdparty->country_id=$thirdpartywithuser['country_id']; $thirdparty->country_code=$thirdpartywithuser['country_code']; + + // find the country id by code + $langs->load("dict"); + + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_pays"; + $sql.= " WHERE active = 1"; + $sql.= " AND code='".$thirdparty->country_code."'"; + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num) + { + $obj = $db->fetch_object($resql); + $thirdparty->country_id = $obj->rowid; + } + } $thirdparty->phone=$thirdpartywithuser['phone']; $thirdparty->fax=$thirdpartywithuser['fax']; $thirdparty->email=$thirdpartywithuser['email']; @@ -570,6 +591,9 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) $contact->phone_pro = $thirdparty->phone; $contact->phone_mobile = $thirdpartywithuser['phone_mobile']; $contact->fax = $thirdparty->fax; + $contact->statut = 1; + $contact->country_id = $thirdparty->country_id; + $contact->country_code = $thirdparty->country_code; //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels @@ -591,33 +615,29 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) * */ $edituser = new User($db); - $db->begin(); $id = $edituser->create_from_contact($contact,$thirdpartywithuser["login"]); if ($id > 0) { - $edituser->setPassword($user,trim($thirdpartywithuser['password'])); + $edituser->setPassword($fuser,trim($thirdpartywithuser['password'])); + + if($thirdpartywithuser['group_id'] > 0 ) + $edituser->SetInGroup($thirdpartywithuser['group_id'],$conf->entity); } else { $error++; - $errorcode='NOT_CREATE'; $errorlabel='Object not create : no contact found or create'; - } - - - if (! $error && $id > 0) - { - $db->commit(); - } - else - { - $db->rollback(); - $error++; - $errorcode='NOT_CREATE'; $errorlabel='Contact not create'; + $errorcode='NOT_CREATE'; $errorlabel='Object not create : '.$edituser->error; } } + else + { + $error++; + $errorcode='NOT_CREATE'; $errorlabel='Object not create : '.$contact->error; + } if(!$error) { + $db->commit(); $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>'SUCCESS'),'id'=>$socid_return); $error=0; } @@ -645,6 +665,7 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) if ($error) { + $db->rollback(); $objectresp = array( 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) ); From 0da1a64335e995738f0336e72b52a08951eb56b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Feb 2014 20:41:23 +0100 Subject: [PATCH 3/7] Fix: Missing vars and bar id. --- htdocs/core/tpl/contacts.tpl.php | 3 +++ htdocs/projet/tasks/contact.php | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index c2c2ef9a452..875b81cd05e 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -34,6 +34,9 @@ elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } elseif ($module == 'project') { $permission=$user->rights->projet->creer; } +elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } +elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } +elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } elseif (! isset($permission)) { $permission=$user->rights->$module->creer; } // If already defined by caller page $formcompany= new FormCompany($db); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 80ddc0cd178..27559938626 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -283,7 +283,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; + if ($withproject) print ''; // Ligne ajout pour contact interne print ""; @@ -299,7 +299,7 @@ if ($id > 0 || ! empty($ref)) print ''; // On recupere les id des users deja selectionnes $contactsofproject=$projectstatic->getListContactId('internal'); - $form->select_users($user->id,'contactid',0,'',0,'',$contactsofproject); + $form->select_users($user->id,'userid',0,'',0,'',$contactsofproject); print ''; print ''; $formcompany->selectTypeContact($object, '', 'type','internal','rowid'); @@ -317,6 +317,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; + if ($withproject) print ''; $var=!$var; print ""; From a6a26ec31358414352ebd39e692d6d679d5f3784 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Feb 2014 17:25:02 +0100 Subject: [PATCH 4/7] Fixed: Write note into field "note_private" in llx_facture ("note" deprecated) --- htdocs/cashdesk/validation_verif.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index d2b55deccde..ffaa01b7a94 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -207,7 +207,7 @@ switch ($action) $invoice->total_ht=$obj_facturation->prixTotalHt(); $invoice->total_tva=$obj_facturation->montantTva(); $invoice->total_ttc=$obj_facturation->prixTotalTtc(); - $invoice->note=$note; + $invoice->note_private=$note; $invoice->cond_reglement_id=$cond_reglement_id; $invoice->mode_reglement_id=$mode_reglement_id; //print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit; From e3ac9db9ec92b32ecf0286fcf92dc67692c57caf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2014 12:11:39 +0100 Subject: [PATCH 5/7] Fix: Data was encode twice making bad translation for language with special chars. --- htdocs/core/boxes/box_graph_product_distribution.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 521dd33f0e2..725ef300125 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -115,9 +115,9 @@ class box_graph_product_distribution extends ModeleBoxes if ($showpropalnb) $nbofgraph++; if ($showordernb) $nbofgraph++; - $paramtitle=$langs->trans("Products").'/'.$langs->trans("Services"); - if (empty($conf->produit->enabled)) $paramtitle=$langs->trans("Services"); - if (empty($conf->service->enabled)) $paramtitle=$langs->trans("Products"); + $paramtitle=$langs->transnoentitiesnoconv("Products").'/'.$langs->transnoentitiesnoconv("Services"); + if (empty($conf->produit->enabled)) $paramtitle=$langs->transnoentitiesnoconv("Services"); + if (empty($conf->service->enabled)) $paramtitle=$langs->transnoentitiesnoconv("Products"); $socid=empty($user->societe_id)?0:$user->societe_id; $userid=0; // No filter on user creation From db006dcdf833357076f71a9d96770750aa506c9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2014 12:52:00 +0100 Subject: [PATCH 6/7] Fix: Missing lang->load --- htdocs/compta/sociales/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index e96c5389529..a8432c38d52 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -27,12 +27,13 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; +$langs->load("compta"); + // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); - $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); From 255a1f649791bca731c38b6ca203f53226074a02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2014 20:57:43 +0100 Subject: [PATCH 7/7] Fix: String translated twice --- htdocs/core/ajax/ziptown.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index 294458d2352..47cb887c0cc 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011 Laurent Destailleur +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2011-204 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; $sql.= " ORDER BY z.zip, z.town"; - $sql.= $db->plimit(50); // Avoid pb with bad criteria + $sql.= $db->plimit(100); // Avoid pb with bad criteria } else // Use table of third parties { @@ -87,7 +87,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; $sql.= " ORDER BY s.fk_pays, s.zip, s.town"; - $sql.= $db->plimit(50); // Avoid pb with bad criteria + $sql.= $db->plimit(100); // Avoid pb with bad criteria } //print $sql; @@ -97,8 +97,8 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) { while ($row = $db->fetch_array($resql)) { - $country = $row['fk_country']?($langs->trans('Country'.$row['country_code'])!='Country'.$row['country_code']?$langs->trans('Country'.$row['country_code']):$row['country']):''; - $county = $row['fk_county']?($langs->trans($row['county_code'])!=$row['county_code']?$langs->trans($row['county_code']):($row['county']!='-'?$row['county']:'')):''; + $country = $row['fk_country']?($langs->transnoentitiesnoconv('Country'.$row['country_code'])!='Country'.$row['country_code']?$langs->transnoentitiesnoconv('Country'.$row['country_code']):$row['country']):''; + $county = $row['fk_county']?($langs->transnoentitiesnoconv($row['county_code'])!=$row['county_code']?$langs->transnoentitiesnoconv($row['county_code']):($row['county']!='-'?$row['county']:'')):''; $row_array['label'] = $row['zip'].' '.$row['town']; $row_array['label'] .= ($county || $country)?' (':'';