From 2aa3995b73d808fd4a325000d312e2f95c4ec26b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 21 Aug 2014 06:01:47 +0200 Subject: [PATCH 01/26] Fix :: Sql problem for fresh install on resource table // Ok in migration script --- htdocs/install/mysql/tables/llx_c_type_resource.key.sql | 2 +- htdocs/install/mysql/tables/llx_c_type_resource.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_type_resource.key.sql b/htdocs/install/mysql/tables/llx_c_type_resource.key.sql index 5a76ff0cfa6..dc5c5ee150a 100644 --- a/htdocs/install/mysql/tables/llx_c_type_resource.key.sql +++ b/htdocs/install/mysql/tables/llx_c_type_resource.key.sql @@ -17,5 +17,5 @@ -- ======================================================================== -ALTER TABLE llx_c_type_contact ADD UNIQUE INDEX uk_c_type_contact_id (element, source, code); +ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (label, code); diff --git a/htdocs/install/mysql/tables/llx_c_type_resource.sql b/htdocs/install/mysql/tables/llx_c_type_resource.sql index efb505ba574..8ba088c075e 100644 --- a/htdocs/install/mysql/tables/llx_c_type_resource.sql +++ b/htdocs/install/mysql/tables/llx_c_type_resource.sql @@ -29,6 +29,6 @@ create table llx_c_type_resource ( rowid integer PRIMARY KEY, code varchar(32) NOT NULL, - libelle varchar(64) NOT NULL, + label varchar(64) NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; From c21b3894622c5dab1391be4a80cd70482e4fd75a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Aug 2014 14:17:27 +0200 Subject: [PATCH 02/26] Fix: Pb with focus position with ckeditor --- htdocs/includes/ckeditor/contents.css | 2 +- htdocs/theme/eldy/style.css.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/includes/ckeditor/contents.css b/htdocs/includes/ckeditor/contents.css index 100ed27b5d4..3d9895c2442 100644 --- a/htdocs/includes/ckeditor/contents.css +++ b/htdocs/includes/ckeditor/contents.css @@ -15,7 +15,7 @@ body /* Remove the background color to make it transparent */ background-color: #fff; - margin: 20px; + margin: 8px; } .cke_editable diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 7eeadd6ae1f..f3c86c0897f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -242,6 +242,10 @@ a:hover { text-decoration: underline; color: #000000;} input:focus, textarea:focus, button:focus, select:focus { box-shadow: 0 0 4px #8091BF; } +textarea.cke_source:focus +{ + box-shadow: none; +} input, input.flat, textarea, textarea.flat, form.flat select, select.flat { font-size: px; @@ -2493,6 +2497,10 @@ A.none, A.none:active, A.none:visited, A.none:hover { /* CKEditor */ /* ============================================================================== */ +.cke_editable +{ + margin: 5px !important; +} .cke_editor table, .cke_editor tr, .cke_editor td { border: 0px solid #FF0000 !important; From d485e270b99c0a391308fb925b46934380061083 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Aug 2014 23:19:01 +0200 Subject: [PATCH 03/26] Fix: menu param is not inside allowed list --- htdocs/cashdesk/affContenu.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index ca471e0bdf4..543006baedf 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -55,6 +55,8 @@ print ''; print '
'; $page=GETPOST('menu','alpha'); +if (empty($page)) $page='facturation'; + if (in_array( $page, array( From a353f816e311b340b2b84e85785006fb82449190 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 22 Aug 2014 16:17:45 +0200 Subject: [PATCH 04/26] FIX error sql on update ficheinter --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d7bb50682fe..aa475c04176 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -227,7 +227,7 @@ class Fichinter extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; - $sql.= ", description = '".$this->db->escape($this->description)."'"; + $sql.= "description = '".$this->db->escape($this->description)."'"; $sql.= ", duree = ".$this->duree; $sql.= ", fk_projet = ".$this->fk_project; $sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); From a97241f71682f59ff629c881b0566696becd42b1 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Sat, 23 Aug 2014 17:05:08 +0200 Subject: [PATCH 05/26] Fix unable to delete order line Calling trigger without having globalized $conf causes error and cancels delete operation, this commit adds the missing 2014-08-23 16:52:05 ERR 127.0.0.1 Interfaces::run_triggers was called with wrong parameters action=LINEORDER_SUPPLIER_DELETE object=1 user= langs= conf= --- htdocs/fourn/class/fournisseur.commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f083318948e..0b62fc91526 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1379,6 +1379,7 @@ class CommandeFournisseur extends CommonOrder */ function deleteline($idline, $notrigger=0) { + global $user,$langs,$conf; if ($this->statut == 0) { $this->db->begin(); From b7daef10c6f7c4c1ae3fbf2a86bd6797f932a423 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 26 Aug 2014 04:35:22 +0200 Subject: [PATCH 06/26] Fix llx_c_type_resource when you update from a 3.6-beta --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 919fbee7d4d..0e7a226d0bd 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -293,6 +293,9 @@ create table llx_c_type_resource active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; +-- Fix llx_c_type_resource when you update from a 3.6-beta +ALTER TABLE llx_c_type_resource CHANGE libelle label VARCHAR(64) NOT NULL; + ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (label, code); -- Fix :: account_parent must be an int, not an account number From ca7ff0ecfab48f79c1eaf4b1f106f0f5479fddfb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Aug 2014 09:49:15 +0200 Subject: [PATCH 07/26] Fix: error in strict mode --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c31f8bd3855..2667e328e58 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1236,7 +1236,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu else dol_print_error($db); $db->free($resql); } - if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP=20; $i=1; From 1e28fd354146ab4a7e65dcbbcba92e5b84daa8b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Aug 2014 15:24:32 +0200 Subject: [PATCH 08/26] Fix: syntax error --- build/debian/dolibarr.postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 0f99f53203b..8a6078af377 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -129,7 +129,7 @@ case "$1" in then # Create an empty conf.php with permission to web server setup_empty_conf - else + #else # File already exist. We add params not found. #echo Add new params to overwrite path to use shared libraries/fonts #grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config From 12c67529712d924f16989b92f421ec4d0fe89485 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Aug 2014 23:45:02 +0200 Subject: [PATCH 09/26] Fix: Can upload files on services. --- ChangeLog | 4 ++++ htdocs/product/document.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d6ba26267a6..1cf11ece40a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.1 compared to 3.6.* ***** +For users: +- Fix: Can upload files on services. + ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: - New: Update ckeditor to version 4. diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 3e5417ae9e8..1e8c7b7cd9a 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -141,7 +141,7 @@ if ($object->id) print '
'; $modulepart = 'produit'; - $permission = $user->rights->produit->creer; + $permission = (($object->type == 0 && $user->rights->produit->creer) || ($object->type == 1 && $user->rights->service->creer)); $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } From 4405f17f2280395c83260911b439b808a2b2a437 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Aug 2014 23:47:44 +0200 Subject: [PATCH 10/26] Update changelog --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1cf11ece40a..f92c959db50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. +- Fix: sql errors on updat fichinter +- Fix: debian script syntax error +- Fix: error "menu param is not inside list" into pos module. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: From 0674667932a71965b8ffa25d71a6edffac916109 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 10:44:40 +0200 Subject: [PATCH 11/26] Fix: error with php strict mode --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2667e328e58..ed255b5785f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1206,7 +1206,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu); // We update newmenu for special dynamic menus - if ($user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account + if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account { $sql = "SELECT rowid, label, courant, rappro, courant"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; From 61ae2f3f37fab514d8c355f6d08c565a13f71010 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 27 Aug 2014 11:34:24 +0200 Subject: [PATCH 12/26] fix : missing translation --- htdocs/langs/en_US/products.lang | 3 ++- htdocs/product/class/product.class.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 684ee5ef20a..1e3027acd25 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -80,11 +80,12 @@ ContractStatusClosed=Closed ContractStatusRunning=Running ContractStatusExpired=expired ContractStatusOnHold=Not running -ContractStatusToRun=A mettre en service +ContractStatusToRun=To get running ContractNotRunning=This contract is not running ErrorProductAlreadyExists=A product with reference %s already exists. ErrorProductBadRefOrLabel=Wrong value for reference or label. ErrorProductClone=There was a problem while trying to clone the product or service. +ErrorPriceCantBeLowerThanMinPrice=Error Price Can't Be Lower Than Minimum Price. Suppliers=Suppliers SupplierRef=Supplier's product ref. ShowProduct=Show product diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a32a8aa9127..c3b337c4a16 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1213,7 +1213,7 @@ class Product extends CommonObject if ($newvat == '') $newvat=$this->tva_tx; if (! empty($newminprice) && ($newminprice > $newprice)) { - $this->error='ErrorPricCanBeLowerThanMinPrice'; + $this->error='ErrorPriceCantBeLowerThanMinPrice'; return -1; } From 08c621037c76f0a1656f41ecec8dd5f878a5459a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 27 Aug 2014 11:41:18 +0200 Subject: [PATCH 13/26] fix : missing code for extrafields --- htdocs/fourn/class/fournisseur.commande.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f083318948e..dcd19b080b5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2010-2013 Philippe Grand + * Copyright (C) 2010-2014 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador @@ -191,6 +191,13 @@ class CommandeFournisseur extends CommonOrder $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); + + // Retreive all extrafield + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); if ($this->statut == 0) $this->brouillon = 1; From 34561906fcb34aa3cd88a47ef48855e6bdaa333d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 19:02:13 +0200 Subject: [PATCH 14/26] Fix: strict mode anarchy ;-) check your variable please --- htdocs/core/tpl/document_actions_pre_headers.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index ca6929331ec..b386391cec2 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); } } - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':'')); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':'')); exit; } } From 338fc5f2f862f5f094d64bf0259ed15e8a7f8e0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 11:46:47 +0200 Subject: [PATCH 15/26] Fix: Bad unique key --- htdocs/install/mysql/tables/llx_c_type_resource.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_c_type_resource.key.sql b/htdocs/install/mysql/tables/llx_c_type_resource.key.sql index 5a76ff0cfa6..68f5b74a42a 100644 --- a/htdocs/install/mysql/tables/llx_c_type_resource.key.sql +++ b/htdocs/install/mysql/tables/llx_c_type_resource.key.sql @@ -17,5 +17,5 @@ -- ======================================================================== -ALTER TABLE llx_c_type_contact ADD UNIQUE INDEX uk_c_type_contact_id (element, source, code); +ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (libelle, code); From d3a3e8786ec5b7c2665bb828f74902874c5d290d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 15:07:33 +0200 Subject: [PATCH 16/26] Fix: sql request with pgsql --- htdocs/compta/salaries/index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index c7ee207f853..3567263e802 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -71,8 +71,8 @@ $form = new Form($db); $salstatic = new PaymentSalary($db); $userstatic = new User($db); -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type,"; -$sql.= " s.num_payment, pst.code as payment_code"; +$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,"; +$sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,"; $sql.= " ".MAIN_DB_PREFIX."user as u"; @@ -87,7 +87,7 @@ if ($filtre) { if ($typeid) { $sql .= " AND s.fk_typepayment=".$typeid; } -$sql.= " GROUP BY s.rowid, s.fk_typepayment, s.amount, s.datev, s.label"; +//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); @@ -176,6 +176,7 @@ else } -$db->close(); llxFooter(); + +$db->close(); From 1505ade3db5d8309813a5e9800b7680c076cd944 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 15:14:06 +0200 Subject: [PATCH 17/26] Fix error management: When an error is returned by hooks into dol_move_uploaded_file, message must be returned by function as if it were an error for any other reason. Conflicts: htdocs/core/lib/files.lib.php --- htdocs/core/lib/files.lib.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a6082fa0c29..c90e58f556c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -597,7 +597,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable global $conf, $db, $user, $langs; global $object, $hookmanager; - $error=0; + $reshook=0; $file_name = $dest_file; if (empty($nohook)) @@ -663,8 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans - // les noms de fichiers. + // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans les noms de fichiers. if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) { dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); @@ -677,7 +676,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } - if (empty($reshook)) + if ($reshook < 0) // At least one blocking error returned by one hook + { + $errmsg = join(',', $hookmanager->errors); + if (empty($errmsg)) $errmsg = 'ErrorReturnedBySomeHooks'; // Should not occurs. Added if hook is bugged and does not set ->errors when there is error. + return $errmsg; + } + elseif (empty($reshook)) { // The file functions must be in OS filesystem encoding. $src_file_osencoded=dol_osencode($src_file); @@ -710,8 +715,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable return -3; // Unknown error } } - else - return $reshook; + + return 1; // Success } /** From 0e1f22fe26173cefb9f376f5d9ac3228adae754e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 28 Aug 2014 15:16:14 +0200 Subject: [PATCH 18/26] Fix: Salary payments are not reflected on the reporting sheets --- ChangeLog | 1 + htdocs/compta/resultat/clientfourn.php | 64 ++++++++++++++++++++++++++ htdocs/compta/resultat/index.php | 39 ++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/ChangeLog b/ChangeLog index f92c959db50..dad4cb65c1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For users: - Fix: sql errors on updat fichinter - Fix: debian script syntax error - Fix: error "menu param is not inside list" into pos module. +- Fix: Salary payments are not reflected on the reporting sheets ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index d68aa528122..26589be3c5d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -538,6 +539,69 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } +/* + * Salaries + */ + +print ''.$langs->trans("Salaries").''; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; +$sql.= " WHERE p.entity = ".$conf->entity; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + +$sql.= " GROUP BY u.rowid"; +$sql.= " ORDER BY u.firstname"; + +dol_syslog("get payment salaries sql=".$sql); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht -= $obj->amount; + $total_ttc -= $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + + $var = !$var; + print " "; + + print "".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print " "; + print ''.$langs->trans("None").''; + print ''; + } +} +else +{ + dol_print_error($db); +} +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''.price(-$subtotal_ht).''; +print ''.price(-$subtotal_ttc).''; +print ''; /* * VAT diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index b3a42d85a6b..fdc9b0472f0 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -469,6 +470,44 @@ $parameters["mode"] = $modecompta; $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +/* + * Salaries + */ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " GROUP BY p.label, dm"; + +dol_syslog("get social salaries payments sql=".$sql); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; + + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; + $decaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + /* * Show result array */ From 714da050346bdd0415e5c6b8c9e282d3d27882e9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:34:50 +0200 Subject: [PATCH 19/26] Fix: another strict mode alert --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8806879aa4b..db840afb925 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -270,7 +270,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - $printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false; + $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; From 2c46c20dfb6dac5b65071cf10e71380c0f36630b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:52:20 +0200 Subject: [PATCH 20/26] Fix: php strict mode saga --- htdocs/core/class/html.formfile.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index db840afb925..9299702a1bb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (c) 2010 Juanjo Menent - * Copyright (c) 2013 Charles-Fr BENKE - * Copyright (C) 2013 Cédric Salvador - * Copyright (c) 2014 Marcos García +/* Copyright (C) 2008-2013 Laurent Destailleur + * Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2013 Charles-Fr BENKE + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Marcos García * * 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 @@ -514,11 +514,11 @@ class FormFile $out.= $genbutton; $out.= ''; - if($hookmanager->hooks['formfile']) + if (!empty($hookmanager->hooks['formfile'])) { foreach($hookmanager->hooks['formfile'] as $module) { - if(method_exists($module, 'formBuilddocLineOptions')) $out .= ''; + if (method_exists($module, 'formBuilddocLineOptions')) $out .= ''; } } $out.= ''; From a518a7256ce8729748dc74c40e46722caa846bdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Aug 2014 11:17:38 +0200 Subject: [PATCH 21/26] maj copyright --- build/exe/doliwamp/doliwamp.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 0037e091973..da727786896 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -32,7 +32,7 @@ AppPublisherURL=http://www.nltechno.com AppSupportURL=http://www.dolibarr.org AppUpdatesURL=http://www.dolibarr.org AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares. -AppCopyright=Copyright (C) 2008-2013 Laurent Destailleur, NLTechno +AppCopyright=Copyright (C) 2008-2014 Laurent Destailleur, NLTechno DefaultDirName=c:\dolibarr DefaultGroupName=Dolibarr ;LicenseFile=COPYING From 47339d0e6202762b987f82c9d6f788eaef5405bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Aug 2014 20:25:54 +0200 Subject: [PATCH 22/26] Fix: Missing field tobuy into service export. Fix: Filter on date into export. Fix: Tooltip help. --- htdocs/core/modules/modProduct.class.php | 1 + htdocs/core/modules/modService.class.php | 9 +++++---- htdocs/exports/export.php | 6 ++++-- htdocs/langs/en_US/exports.lang | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 05c934a8ea6..87dbc3e6dde 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -219,6 +219,7 @@ class modProduct extends DolibarrModules 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC", 'pr.tva_tx'=>'VATRate', 'pr.date_price'=>'DateCreation'); + //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", 'pr.price_ttc'=>"product", diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 2b9bb8d44f8..13fe1ed47d5 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -137,13 +137,13 @@ class modService extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("service","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock')); //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); - $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Number')); + $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Number')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); - $this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service"); + $this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service"); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'service')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'service')); // Add extra fields @@ -182,6 +182,7 @@ class modService extends DolibarrModules 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", 'pr.tva_tx'=>'PriceLevelVATRate', 'pr.date_price'=>'DateCreation'); + //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", 'pr.price_ttc'=>"product", diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index d244a209b92..a6d82b10a86 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -840,7 +840,8 @@ if ($step == 4 && $datatoexport) if (isset($objexport->array_export_fields[0][$code])) { $list.=($list?', ':''); - $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/',$array_filtervalue[$code])) $list.=$langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code])?$array_filtervalue[$code]:''); + else $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; } } } @@ -1071,7 +1072,8 @@ if ($step == 5 && $datatoexport) if (isset($objexport->array_export_fields[0][$code])) { $list.=($list?', ':''); - $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/',$array_filtervalue[$code])) $list.=$langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code])?$array_filtervalue[$code]:''); + else $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; } } } diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 79d5bec834f..d396746ccad 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -125,7 +125,7 @@ BankAccountNumber=Account number BankAccountNumberKey=Key SpecialCode=Special code ExportStringFilter=%% allows replacing one or more characters in the text -ExportDateFilter='YYYY' 'YYYYMM' 'YYYYMMDD': filters by one year/month/day
'YYYY+YYYY' 'YYYYMM+YYYYMM' 'YYYYMMDD+YYYYMMDD': filters over a range of years/months/days
'>YYYY' '>YYYYMM' '>YYYYMMDD': filters on the following years/months/days
'<YYYY' '<YYYYMM' '<YYYYMMDD': filters on the previous years/months/days +ExportDateFilter=YYYY, YYYYMM, YYYYMMDD : filters by one year/month/day
YYYY+YYYY, YYYYMM+YYYYMM, YYYYMMDD+YYYYMMDD : filters over a range of years/months/days
> YYYY, > YYYYMM, > YYYYMMDD : filters on all following years/months/days
< YYYY, < YYYYMM, < YYYYMMDD : filters on all previous years/months/days ExportNumericFilter='NNNNN' filters by one value
'NNNNN+NNNNN' filters over a range of values
'>NNNNN' filters by lower values
'>NNNNN' filters by higher values ## filters SelectFilterFields=If you want to filter on some values, just input values here. From f6be7d79303888bda7cb020e6aa61224ebd01423 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Aug 2014 19:58:38 +0200 Subject: [PATCH 23/26] Fix: Pb with pgsql --- htdocs/core/db/pgsql.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 01ff6774fc3..6593b2d896b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -298,6 +298,9 @@ class DoliDBPgsql extends DoliDB $line=str_replace(' LIKE \'',' ILIKE \'',$line); $line=str_replace(' LIKE BINARY \'',' LIKE \'',$line); + // Replace INSERT IGNORE into INSERT + $line=preg_replace('/^INSERT IGNORE/','INSERT',$line); + // Delete using criteria on other table must not declare twice the deleted table // DELETE FROM tabletodelete USING tabletodelete, othertable -> DELETE FROM tabletodelete USING othertable if (preg_match('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i',$line,$reg)) From 5738d6de982dd669a16ca4935c59777ed1616e40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Aug 2014 20:04:53 +0200 Subject: [PATCH 24/26] Fix: sql request not compatible with pgsql --- htdocs/core/ajax/ziptown.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index def98b25ae8..30e0211ece1 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -65,9 +65,10 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_ziptown as z,".MAIN_DB_PREFIX."c_country as c)"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,"; + $sql.= " ".MAIN_DB_PREFIX."c_country as c"; $sql.= " WHERE z.fk_pays = c.rowid"; $sql.= " AND z.active = 1 AND c.active = 1"; if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; @@ -81,8 +82,8 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $sql.= ", c.code as country_code, c.label as country"; $sql.= ", d.code_departement as county_code , d.nom as county"; $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON fk_departement = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON fk_pays = c.rowid'; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; $sql.= " WHERE"; if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; From 0ccd29c6cd6048a12323205fc6eee8e2ec8e2466 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Aug 2014 20:05:16 +0200 Subject: [PATCH 25/26] Doxygen --- htdocs/core/lib/ajax.lib.php | 27 +++++++++++---------- htdocs/fichinter/fiche.php | 46 ++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e68fe78bc87..79ceb73d05a 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -25,8 +25,9 @@ /** - * Get value of an HTML field, do Ajax process and show result. + * Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php). * The HTML field must be an input text with id=search_$htmlname. + * This use the jQuery "autocomplete" function. * * @param string $selected Preselecte value * @param string $htmlname HTML name of input field @@ -34,7 +35,7 @@ * @param string $urloption More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value - * @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done + * @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done) * @return string Script */ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) @@ -182,25 +183,28 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } /** - * Get value of field, do Ajax process and return result + * Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php). + * The Ajax page can also returns several values (json format) to fill several input fields. + * The HTML field must be an input text with id=$htmlname. + * This use the jQuery "autocomplete" function. * - * @param string $htmlname Name of field - * @param string $fields other fields to autocomplete - * @param string $url Chemin du fichier de reponse : /chemin/fichier.php + * @param string $htmlname HTML name of input field + * @param string $fields Other fields to autocomplete + * @param string $url URL for ajax request : /chemin/fichier.php * @param string $option More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value * @return string Script */ -function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,$autoselect=0) +function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0) { $script = ''."\n"; $script.= '