From 7c7626e445e1845577e2f3925415bbac786ff34e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 10 Dec 2016 13:19:33 +0100 Subject: [PATCH 01/85] allow to change height and width --- htdocs/product/class/product.class.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3df1393628a..56b9fc527a6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -636,6 +636,10 @@ class Product extends CommonObject $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); $this->length_units = trim($this->length_units); + $this->width = price2num($this->width); + $this->width_units = trim($this->width_units); + $this->height = price2num($this->height); + $this->height_units = trim($this->height_units); $this->surface = price2num($this->surface); $this->surface_units = trim($this->surface_units); $this->volume = price2num($this->volume); @@ -750,6 +754,10 @@ class Product extends CommonObject $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); $sql.= ", length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null'); + $sql.= ", width= " . ($this->width!='' ? "'".$this->width."'" : 'null'); + $sql.= ", width_units = " . ($this->width_units!='' ? "'".$this->width_units."'" : 'null'); + $sql.= ", height = " . ($this->height!='' ? "'".$this->height."'" : 'null'); + $sql.= ", height_units = " . ($this->height_units!='' ? "'".$this->height_units."'" : 'null'); $sql.= ", surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null'); $sql.= ", surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null'); $sql.= ", volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null'); @@ -1671,8 +1679,9 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; - $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; + $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas, weight, weight_units,"; + $sql.= " length, length_units, width, width_units, height, height_units,"; + $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,"; $sql.= " fk_price_expression, price_autogen"; @@ -1734,6 +1743,11 @@ class Product extends CommonObject $this->weight_units = $obj->weight_units; $this->length = $obj->length; $this->length_units = $obj->length_units; + $this->width = $obj->width; + $this->width_units = $obj->width_units; + $this->height = $obj->height; + $this->height_units = $obj->height_units; + $this->surface = $obj->surface; $this->surface_units = $obj->surface_units; $this->volume = $obj->volume; From 300c91fd7fc8495a6d6b8b419373938078930b99 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 10 Dec 2016 13:25:33 +0100 Subject: [PATCH 02/85] Update card.php --- htdocs/product/card.php | 64 +++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 122e80b2e69..eca254eb93e 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -283,7 +283,11 @@ if (empty($reshook)) $object->weight_units = GETPOST('weight_units'); $object->length = GETPOST('size'); $object->length_units = GETPOST('size_units'); - $object->surface = GETPOST('surface'); + $object->width = GETPOST('sizewidth'); + $object->width_units = GETPOST('sizewidth_units'); + $object->height = GETPOST('sizeheight'); + $object->height_units = GETPOST('sizeheight_units'); + $object->surface = GETPOST('surface'); $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); @@ -380,6 +384,11 @@ if (empty($reshook)) $object->weight_units = GETPOST('weight_units'); $object->length = GETPOST('size'); $object->length_units = GETPOST('size_units'); + $object->width = GETPOST('sizewidth'); + $object->width_units = GETPOST('sizewidth_units'); + $object->height = GETPOST('sizeheight'); + $object->height_units = GETPOST('sizeheight_units'); + $object->surface = GETPOST('surface'); $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); @@ -1010,12 +1019,23 @@ else print $formproduct->select_measuring_units("weight_units","weight"); print ''; // Length - if (empty($conf->global->PRODUCT_DISABLE_LENGTH)) + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { print ''.$langs->trans("Length").''; print ''; print $formproduct->select_measuring_units("size_units","size"); print ''; + + print ''.$langs->trans("Width").''; + print ''; + print $formproduct->select_measuring_units("sizewidth_units","size"); + print ''; + + print ''.$langs->trans("Height").''; + print ''; + print $formproduct->select_measuring_units("sizeheight_units","size"); + print ''; + } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1324,13 +1344,23 @@ else print ' '; print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); print ''; - if (empty($conf->global->PRODUCT_DISABLE_LENGTH)) + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Length - print ''.$langs->trans("Length").''; - print ' '; - print $formproduct->select_measuring_units("size_units", "size", $object->length_units); - print ''; + // Length + print ''.$langs->trans("Length").''; + print ' '; + print $formproduct->select_measuring_units("size_units", "size", $object->length_units); + print ''; + + print ''.$langs->trans("Width").''; + print ' '; + print $formproduct->select_measuring_units("sizewidth_units","size", $object->width_units); + print ''; + + print ''.$langs->trans("Height").''; + print ' '; + print $formproduct->select_measuring_units("sizeheight_units","size", $object->height_units); + print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1634,7 +1664,7 @@ else print ' '; } print "\n"; - if (empty($conf->global->PRODUCT_DISABLE_LENGTH)) + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Length print ''.$langs->trans("Length").''; @@ -1647,6 +1677,22 @@ else print ' '; } print "\n"; + + print ''.$langs->trans("Width").''; + if ($object->width != '') { + print $object->width." ".measuring_units_string($object->width_units,"size"); + } + else + print ' '; + print "\n"; + + print ''.$langs->trans("Height").''; + if ($object->height != '') { + print $object->height." ".measuring_units_string($object->height_units,"size"); + } + else + print ' '; + print "\n"; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { From b7af0461471fff0f9fe782f73bfd6b0e4e077c01 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 11 Dec 2016 01:53:33 +0100 Subject: [PATCH 03/85] Add automated compute --- htdocs/product/class/product.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 56b9fc527a6..695ab573805 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -640,6 +640,20 @@ class Product extends CommonObject $this->width_units = trim($this->width_units); $this->height = price2num($this->height); $this->height_units = trim($this->height_units); + // Automated compute surface and volume if not filled + if (empty($this->surface) && !empty($this->length) && !empty($this->width) + && $this->length_units == $this->with_units + ) { + $this->surface = $this->length * $this->width; + $this->surface_units = $this->width_units; + if (empty($this->volume) && !empty($this->height) + && $this->length_units == $this->height_units + ) { + $this->volume = $this->surface * $this->height; + $this->volume_units = $this->height_units; + } + } + $this->surface = price2num($this->surface); $this->surface_units = trim($this->surface_units); $this->volume = price2num($this->volume); From eb2ea07c763a7bec83ef01d601e41c41aa66fa65 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:32:39 +0100 Subject: [PATCH 04/85] FIX #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 89dfb083ea0..f2c42c3b14f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 juanjo Menent + * Copyright (C) 2015-2007 Juanjo Menent * Copyright (C) 2015 Abbes Bahfir * Copyright (C) 2015-2016 Ferran Marcet * @@ -788,7 +788,7 @@ if ($resql) $thirdparty->name=$obj->name; $thirdparty->client=$obj->client; $thirdparty->code_client=$obj->code_client; - print $thirdparty->getNomUrl(1,'customer'); + print $thirdparty->getNomUrl(1,'supplier'); print ''; if (! $i) $totalarray['nbfield']++; } From ac58fd91af93883ce6207147e934ce7f7f8f1d1a Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:46:50 +0100 Subject: [PATCH 05/85] FIX #6253 Supplier invoice list filter does not respect "thirdparty" filter --- htdocs/fourn/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f2c42c3b14f..19f3f8ecbd7 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -434,6 +434,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); From bcba4a1a38a37869c55f58dff8c7c66eb2ad8895 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:48:32 +0100 Subject: [PATCH 06/85] FIX #6253 Supplier invoice list filter does not respect "thirdparty" filter --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 19f3f8ecbd7..27c14f2a8d4 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -434,7 +434,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); From 13787881d450f576a27389abe3eb745269578b1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 11:46:13 +0100 Subject: [PATCH 07/85] Fix css --- htdocs/cashdesk/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index 2931ad7638e..97c0e95a982 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -214,6 +214,7 @@ p.titre { .blocksellfinished { min-width: 215px; + margin-top: 8px; } .titre1 { font-weight: bold; From 8d5c85326718652d4ed5cfc4e8435c52a059b2a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 15:12:53 +0100 Subject: [PATCH 08/85] FIX Protection so even if link is output for external user, links is disabled. --- htdocs/societe/class/societe.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index b3205d3fb44..12d7fcd77ef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1915,7 +1915,14 @@ class Societe extends CommonObject } $link.='>'; $linkend=''; - + + global $user; + if (! $user->rights->societe->client->voir && $user->societe_id > 0 && $this->id != $user->societe_id) + { + $link=''; + $linkend=''; + } + if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; From f185a09693859720e85501d9613fcdae52e92dce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 15:23:30 +0100 Subject: [PATCH 09/85] FIX Security access problem with external users on projects/tasks --- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + htdocs/projet/card.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/index.php | 2 +- htdocs/projet/info.php | 2 +- htdocs/projet/list.php | 9 ++++++--- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 5 +++-- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/projet/tasks/note.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/projet/tasks/time.php | 2 +- 18 files changed, 26 insertions(+), 21 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7cb41b1d708..8aa36f0544a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -560,7 +560,7 @@ Permission34=Delete products Permission36=See/manage hidden products Permission38=Export products Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet) -Permission42=Create/modify projects (shared project and projects i'm contact for) +Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks Permission44=Delete projects (shared project and projects i'm contact for) Permission45=Export projects Permission61=Read interventions @@ -663,7 +663,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions Permission254=Create/modify external users only Permission255=Modify other users password Permission256=Delete or disable other users -Permission262=Extend access to all third parties (not only those linked to user). Not effective for external users (always limited to themselves). +Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters). Permission271=Read CA Permission272=Read invoices Permission273=Issue invoices diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6b99049e9ef..0e0b3e40960 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -176,6 +176,7 @@ ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s t ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal. ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. +ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ad1d718fc55..8345ce69846 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -68,7 +68,7 @@ if ($id > 0 || ! empty($ref)) // Security check $socid=GETPOST('socid'); -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $object->id,'projet&project'); // fetch optionals attributes and labels diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 794e9c3af00..492578905d9 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -46,7 +46,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d59dec0dc4a..5bd46389eef 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -42,7 +42,7 @@ $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0); // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user,'projet',$id,'projet&project'); $object = new Project($db); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5673f74aa34..9fc957fa66b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -92,7 +92,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=$object->socid; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $projectid, 'projet&project'); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index b86a961bd69..2b992e05ef6 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -43,7 +43,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); $langs->load("users"); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 752e3615464..20fca4b5abf 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -37,7 +37,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $sortfield = GETPOST("sortfield",'alpha'); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index c2e45560f74..281a2f8c94d 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -34,7 +34,7 @@ $langs->load("projects"); // Security check $socid=0; $id = GETPOST("id",'int'); -if ($user->societe_id) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user,'projet',$id,''); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6e7ccc26dd5..721baca4ced 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -40,7 +40,7 @@ $title = $langs->trans("Projects"); // Security check $socid = (is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if ($socid > 0) { $soc = new Societe($db); @@ -220,7 +220,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; // We'll need this table joined to the select in order to filter by sale -if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; +// For external user, no check is done on company permission because readability is managed by public status of project and assignement. +//if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; +if ($search_sale > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; @@ -271,7 +273,8 @@ if ($search_opp_status) } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; +// For external user, no check is done on company permission because readability is managed by public status of project and assignement. +//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 43df7ce3b3d..57bc235c8d0 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -41,7 +41,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9def807c746..5d5871ec280 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -61,7 +61,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->tab // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -413,7 +413,8 @@ else if ($id > 0 || ! empty($ref)) // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). - $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); + $filteronthirdpartyid = $socid; + $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0); // We load also tasks limited to a particular user $tasksrole=($mode=='mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : ''); //var_dump($tasksarray); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 6689f966c15..23feb647fc8 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -42,7 +42,7 @@ $project_ref=GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result = restrictedArea($user, 'projet', $id, 'projet_task'); if (! $user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index c9a69fc81a4..15c73450be6 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -47,7 +47,7 @@ $project_ref = GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result=restrictedArea($user,'projet',$id,''); if (!$user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 5573441d646..f733ab03a1c 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -75,7 +75,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 5d5cb38dbe5..880b2a25198 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -39,7 +39,7 @@ $project_ref = GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); //$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 6e0648b61e6..15ef42d5c83 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -47,7 +47,7 @@ $planned_workload=((GETPOST('planned_workloadhour')!='' && GETPOST('planned_work // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 96c849d8df9..f6da55731fc 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -43,7 +43,7 @@ $project_ref=GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array From 32a453e8e69b30b027a865cba4e0aad98eac32f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 15:44:20 +0100 Subject: [PATCH 10/85] Fix label combo --- htdocs/projet/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6d20078a785..19943479413 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -704,7 +704,7 @@ elseif ($object->id > 0) print ''.$langs->trans("ThirdParty").''; $filteronlist=''; if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; - $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300'); + $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), '', 0, 0, 'minwidth300'); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); From edb79de54e8e0aaa2956ae3578298f0e3cc98ddf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 18:07:19 +0100 Subject: [PATCH 11/85] FIX javascript error --- htdocs/compta/paiement.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index fa1341dcbc6..5e73c3dd710 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -391,10 +391,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie var form = $("#payment_form"); json["invoice_type"] = $("#invoice_type").val(); - json["amountPayment"] = $("#amountpayment").attr("value"); + json["amountPayment"] = $("#amountpayment").attr("value"); json["amounts"] = _elemToJson(form.find("input.amount")); - json["remains"] = _elemToJson(form.find("input.remain]")); - + json["remains"] = _elemToJson(form.find("input.remain")); if (imgId != null) { json["imgClicked"] = imgId; } From 380b61a0e9b0e8b08094b8843883c1f7a56771d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 21:56:50 +0100 Subject: [PATCH 12/85] FIX Can make a stock transfert on product not on sale/purchase. --- htdocs/product/stock/massstockmove.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index b8ec52efcab..0cebc666c1e 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -372,7 +372,7 @@ else { $limit = $conf->global->PRODUIT_LIMIT_SIZE; } -print $form->select_produits($id_product,'productid',$filtertype,$limit); +print $form->select_produits($id_product,'productid',$filtertype,$limit,0,-1); print ''; // Batch number if ($conf->productbatch->enabled) From 60143146105903d6fb564f1e73f361268e8f2315 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 13 Jan 2017 09:05:10 +0100 Subject: [PATCH 13/85] forgotten translation translation lefted on last 5.RC version --- htdocs/langs/en_US/interventions.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 0de0d487925..9863471448b 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -41,6 +41,7 @@ InterventionDeletedInDolibarr=Intervention %s deleted InterventionsArea=Interventions area DraftFichinter=Draft interventions LastModifiedInterventions=Latest %s modified interventions +FichinterToProcess=Interventions to process ##### Types de contacts ##### TypeContact_fichinter_external_CUSTOMER=Following-up customer contact # Modele numérotation From 3a2f44adaca76269c8883461e554e1c27deb377d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2017 13:43:09 +0100 Subject: [PATCH 14/85] Fix security permissions to edit/delete time spent --- htdocs/projet/tasks/time.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f6da55731fc..aa572966321 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -128,7 +128,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) } } -if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->creer) +if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->lire) { $error=0; @@ -141,7 +141,8 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree if (! $error) { $object->fetch($id, $ref); - + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + $object->timespent_id = $_POST["lineid"]; $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_old_duration = $_POST["old_duration"]; @@ -175,9 +176,10 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree } } -if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->creer) +if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->lire) { $object->fetchTimeSpent($_GET['lineid']); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) $result = $object->delTimeSpent($user); if ($result < 0) @@ -585,6 +587,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $tasktmp = new Task($db); + $childids = $user->getAllChildIds(); + $total = 0; $totalvalue = 0; foreach ($tasks as $task_time) @@ -688,17 +692,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print ''; } - else if ($user->rights->projet->creer) + else if ($user->rights->projet->lire) // Read project and enter time consumed on assigned tasks { - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_edit(); - print ''; - - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_delete(); - print ''; + if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + { + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_edit(); + print ''; + + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_delete(); + print ''; + } } print ''; From 31818e8816337a35561f47e7c3b629bf866739fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2017 15:32:20 +0100 Subject: [PATCH 15/85] Fix missing translation --- htdocs/comm/mailing/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 3660b560f78..74ed28ba268 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -755,7 +755,7 @@ else // MAILING_NO_USING_PHPMAIL may be defined or not. // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). - // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit). + // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit). if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -769,8 +769,8 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); // The feature is forbidden from GUI, we show just message to use from command line. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); @@ -783,8 +783,8 @@ else } else { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); $text=''; if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) From 29f07d3e897a61812d10e1a3bceb428251a492be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2017 16:39:35 +0100 Subject: [PATCH 16/85] The tutorial to add cron is sometimes false. Quick hack for a solution to hide it. --- htdocs/core/lib/cron.lib.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index aade8149ce5..9afd0e7835b 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -110,21 +110,24 @@ function dol_print_cron_urls() print '
'; // Add note - $linuxlike=1; - if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; - if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; - print $langs->trans("Note").': '; - if ($linuxlike) + if (empty($conf->global->CRON_DISABLE_TUTORIAL_CRON)) { - print $langs->trans("CronExplainHowToRunUnix"); - print '
'; - print '
'; + $linuxlike=1; + if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; + if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; + print $langs->trans("Note").': '; + if ($linuxlike) + { + print $langs->trans("CronExplainHowToRunUnix"); + print '
'; + print '
'; + } + else + { + print $langs->trans("CronExplainHowToRunWin"); + } } - else - { - print $langs->trans("CronExplainHowToRunWin"); - } - + return 0; } From 1fd9f5e1fbcb3f7ca1b6c1e501aefa9b88c98995 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2017 13:27:44 +0100 Subject: [PATCH 17/85] Fix: host was twice into message id for smtp driver and swiftmailer was not using dol_getprefix() to build host. --- htdocs/core/class/CMailFile.class.php | 6 ++++-- htdocs/core/class/smtps.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 26f8a4b88f2..44df05a4d6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -365,7 +365,9 @@ class CMailFile { // Use Swift Mailer library // ------------------------------------------ - + + $host = dol_getprefix('email'); + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; // Create the message $this->message = Swift_Message::newInstance(); @@ -373,7 +375,7 @@ class CMailFile // Adding a trackid header to a message $headers = $this->message->getHeaders(); $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER; + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 0517dee30e5..37c0772093f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1190,7 +1190,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host=dol_getprefix('email').'-'.$host; + $host=dol_getprefix('email'); //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; From d5120ae7ccda7bc971cadc6e04d119154f49cf85 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 15 Jan 2017 11:04:32 +0000 Subject: [PATCH 18/85] Fix: Add Missing Translation String When product batch module is disabled, the translation string is missing for dispatch line. --- htdocs/langs/en_US/stocks.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index d5fa618b1e0..79842c7b7c7 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -141,4 +141,5 @@ OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a prod ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted -AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock \ No newline at end of file +AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock +AddStockLocationLine=Decrease quantity then click to add another warehouse for this product From fd4a19855d3fffea2af4202de0863054adb19c6f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 12:09:26 +0100 Subject: [PATCH 19/85] Fix: preview image not show with multicompany product sharing --- htdocs/core/class/html.formfile.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5a55b3a8a9c..d9a5e19843f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -76,7 +76,7 @@ class FormFile global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); - + if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') $useajax=0; if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) @@ -276,7 +276,7 @@ class FormFile if (0 !== $iconPDF) { dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); } - + global $langs, $conf, $user, $hookmanager; global $form, $bc; @@ -288,7 +288,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - + $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements { @@ -506,7 +506,7 @@ class FormFile $addcolumforpicto=($delallowed || $printer || $morepicto); $out.= ''; - + // Model if (! empty($modellist)) { @@ -863,8 +863,8 @@ class FormFile $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension //print $file['path'].'/'.$minifile.'
'; - print ''; - print ''; + print ''; + print ''; print ''; } else print ' '; From c3997194b21ac96016a6700a2d5e1a0101fe1369 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 15:17:32 +0100 Subject: [PATCH 20/85] Fix: avoid foreach error --- htdocs/product/stats/card.php | 61 ++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 3ff47496409..aababfbe40b 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -44,6 +44,7 @@ $ref = GETPOST('ref'); $mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit'); $error = 0; $mesg = ''; +$graphfiles=array(); $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -57,7 +58,7 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','', /* * View */ - + $form = new Form($db); if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') @@ -68,7 +69,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') llxHeader("",$langs->trans("ProductStatistics")); $type = GETPOST('type'); - + $helpurl=''; if ($type == '0') { @@ -88,13 +89,13 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') //$title=$langs->trans("StatisticsOfProductsOrServices"); $title=$langs->trans("Statistics"); } - + print load_fiche_titre($title, $mesg,'title_products.png'); } else { $result = $object->fetch($id,$ref); - + $title = $langs->trans('ProductServiceCard'); $helpurl = ''; $shortlabel = dol_trunc($object->label,16); @@ -111,8 +112,8 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') llxHeader('', $title, $helpurl); } - - + + if ($result && (! empty($id) || ! empty($ref))) { $head=product_prepare_head($object); @@ -122,21 +123,21 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') dol_fiche_head($head, 'stats', $titre, 0, $picto); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - + dol_fiche_end(); } if (GETPOST('id') == 'all') { $h=0; $head = array(); - + $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php?id=all'; $head[$h][1] = $langs->trans("Chart"); $head[$h][2] = 'chart'; $h++; - + $title = $langs->trans("ListProductServiceByPopularity"); if ((string) $type == '1') { $title = $langs->trans("ListServiceByPopularity"); @@ -144,49 +145,49 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if ((string) $type == '0') { $title = $langs->trans("ListProductByPopularity"); } - + $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != ''?'?type='.$type:''); $head[$h][1] = $title; $head[$h][2] = 'popularityprop'; $h++; - - dol_fiche_head($head,'chart',$langs->trans("Statistics")); + + dol_fiche_head($head,'chart',$langs->trans("Statistics")); } - - + + if ($result || GETPOST('id') == 'all') { if (GETPOST('id') == 'all') { // Choice of type of product if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n".'
'."\n"; else print '   /   '; - + if ((string) $type != '1') print 'id).'&type=1'.($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("Services"); if ((string) $type != '1') print ''; - + if (! empty($conf->dol_use_jmobile)) print '
'."\n".'
'."\n"; else print '   /   '; - + if ((string) $type == '0' || (string) $type == '1') print 'id).($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("ProductsAndServices"); if ((string) $type == '0' || (string) $type == '1') print ''; - + if (! empty($conf->dol_use_jmobile)) print '
'; else print '
'; print '
'; } - + // Choice of stats mode (byunit or bynumber) if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n"; @@ -222,25 +223,25 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') } } } - + if($conf->propal->enabled) { $graphfiles['propal']=array('modulepart'=>'productstats_proposals', 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))); } - + if($conf->supplier_proposal->enabled) { $graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers', 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))); } - + if($conf->order->enabled) { $graphfiles['orders']=array('modulepart'=>'productstats_orders', 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))); } - + if($conf->fournisseur->enabled) { $graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers', 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', @@ -251,7 +252,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') $graphfiles['invoices']=array('modulepart'=>'productstats_invoices', 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))); - + $graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers', 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))); @@ -282,10 +283,10 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if ($key == 'proposalssuppliers') $graph_data = $object->get_nb_propalsupplier($socid,$mode,((string) $type != '' ? $type : -1)); if ($key == 'invoicessuppliers') $graph_data = $object->get_nb_achat($socid,$mode,((string) $type != '' ? $type : -1)); if ($key == 'orderssuppliers') $graph_data = $object->get_nb_ordersupplier($socid,$mode,((string) $type != '' ? $type : -1)); - + // TODO Save cachefile $graphfiles[$key]['file'] } - + if (is_array($graph_data)) { $px->SetData($graph_data); @@ -383,7 +384,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') print '

'."\n"; } } - + if (GETPOST('id') == 'all') { dol_fiche_end(); From f9ed1592e15a39909827ae31d14e37853314426a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 16:07:04 +0100 Subject: [PATCH 21/85] Fix: search problem if name contains accents --- htdocs/admin/modules.php | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 113d12570cb..f3aeb780f76 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -193,7 +193,7 @@ foreach ($modulesdir as $dir) } ksort($arrayofnatures); } - + // Define array $categ with categ with at least one qualified module if ($modulequalified > 0) { @@ -315,13 +315,13 @@ if ($mode != 'marketplace') print ''; print ''; print ''; - + $moreforfilter = ''; $moreforfilter.='
'; $moreforfilter.= $langs->trans('Keyword') . ': '; $moreforfilter.= '
'; $moreforfilter.='
'; - $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1); + $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1); $moreforfilter.= '
'; if (! empty($conf->global->MAIN_FEATURES_LEVEL)) { @@ -342,7 +342,7 @@ if ($mode != 'marketplace') $moreforfilter.=' '; $moreforfilter.=''; $moreforfilter.= '
'; - + if (! empty($moreforfilter)) { //print '
'; @@ -351,11 +351,11 @@ if ($mode != 'marketplace') $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; //print '
'; - } - + } + print '


'; - - + + // Show list of modules print ''."\n"; @@ -370,7 +370,7 @@ if ($mode != 'marketplace') $modName = $filename[$key]; $objMod = $modules[$key]; $dirofmodule = $dirmod[$key]; - + $special = $objMod->special; //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; @@ -383,9 +383,9 @@ if ($mode != 'marketplace') dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); continue; } - + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - + // Check filters $modulename=$objMod->getName(); $moduledesc=$objMod->getDesc(); @@ -396,7 +396,7 @@ if ($mode != 'marketplace') if ($search_keyword) { $qualified=0; - if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) @@ -415,7 +415,7 @@ if ($mode != 'marketplace') { //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); $publisher=dol_escape_htmltag($objMod->getPublisher()); - if ($reg[1] && $reg[1] != $publisher) continue; + if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue; if (! $reg[1] && ! empty($publisher)) continue; } if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue; @@ -496,7 +496,7 @@ if ($mode != 'marketplace') $text=''; if ($objMod->getDescLong()) $text.=$objMod->getDesc().'
'.$objMod->getDescLong().'
'; else $text.=$objMod->getDesc().'
'; - + $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') { @@ -522,7 +522,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddDictionaries").': '; if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) { @@ -534,7 +534,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddBoxes").': '; if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { @@ -553,14 +553,14 @@ if ($mode != 'marketplace') $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSubstitutions").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSheduledJobs").': '; if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) { @@ -572,14 +572,14 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddTriggers").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddHooks").': '; if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { @@ -603,14 +603,14 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddMenus").': '; if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu)) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddExportProfiles").': '; if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) { @@ -622,7 +622,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddImportProfiles").': '; if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) { @@ -634,25 +634,25 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); - + print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); - // Picto warning + // Picto warning $version=$objMod->getVersion(0); $versiontrans=$objMod->getVersion(1); if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"'); if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"'); if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"'); - + // Picto external if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"'); - - + + print ''; - + // Version print ''; // Center diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index acfdeba7d8e..5ca0fc61cf2 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -225,7 +225,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 9ca8a79bb15..d925573b859 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -113,7 +113,7 @@ if (trim($search_name) != '') if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 34c989587af..65d7fd5223e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -238,7 +238,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 00b6343bf97..7928e0f8e3d 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -266,7 +266,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f8faa5fa753..90647b7c65a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -371,7 +371,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index fd403e90e21..ad05d000f8c 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -372,7 +372,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index a41978064f6..2400992b250 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -639,7 +639,7 @@ if (empty($action)) if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= $db->order($sortfield,$sortorder); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 97184909290..0e17a48b356 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -120,7 +120,7 @@ if ($fourn_id > 0) $sql .= " AND ppf.fk_soc = ".$fourn_id; } // Count total nb of records without orderby and limit -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index aea84394c1c..3fc56e99204 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -86,7 +86,7 @@ if ($filtre) { $sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index eb3292cd332..93f6e6915f9 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -157,7 +157,7 @@ if (! empty($enddate)) $sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_syslog(__FILE__, LOG_DEBUG); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 847cd5289dc..9a95797736d 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -124,7 +124,7 @@ $sql.= " u.login, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index df0cddd8aaf..49af8c73123 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -126,7 +126,7 @@ class ProductApi extends DolibarrApi // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -212,7 +212,7 @@ class ProductApi extends DolibarrApi // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 48693cd0ac7..4f1f97cef8a 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -304,7 +304,7 @@ else $sql.=$hookmanager->resPrint; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index d3c3784c00c..eb0f49cb77f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1668,7 +1668,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int')); // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -1748,7 +1748,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // List of all prices by customers // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 3505247862b..8e6775e2e6e 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -456,7 +456,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 848bc519946..2910103e380 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -259,7 +259,7 @@ $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 1295eb970a0..68077621771 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -318,7 +318,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 41169e0d77c..e1da8444319 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -308,7 +308,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index b9c991c7fa5..196a1386b5d 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -143,7 +143,7 @@ class ContactApi extends DolibarrApi $sql .= " AND sc.fk_user = " . $search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 8b0302f9c11..96a2ebac321 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -190,7 +190,7 @@ class ThirdpartyApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 8982d2db32d..301ca845286 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -439,7 +439,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index db2592f225c..e8dc595c6c3 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -379,7 +379,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ); // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -469,7 +469,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index a8e38098775..401eef99a35 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -285,7 +285,7 @@ if ($search_user > 0) $sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', sp.ref DESC'; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); From 54a974cb5c164f58dc37cf57c1444f4a64381504 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2017 21:03:44 +0100 Subject: [PATCH 23/85] Fix position of dropdown tooltip --- htdocs/main.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 92df8f48f05..8aba2e428f2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1935,11 +1935,11 @@ if (! function_exists("llxFooter")) var scrollBottom = $(window).scrollTop() + $(window).height(); //console.log(scrollBottom); diffoutsidebottom = (posbottom - scrollBottom); - console.log("diffoutsidebottom (positive = outside) = "+diffoutsidebottom); + console.log("heigthofcontent="+heigthofcontent+", diffoutsidebottom (posbottom="+posbottom+" - scrollBottom="+scrollBottom+") = "+diffoutsidebottom); if (diffoutsidebottom > 0) { - pix = "-"+diffoutsidebottom+"px"; - console.log(pix); + pix = "-"+(diffoutsidebottom+8)+"px"; + console.log("We reposition top by "+pix); $(this).parent().parent().find(\'dd\').css("top", pix); } // $(".dropdown dd ul").slideToggle(\'fast\'); From 7bccaff28abc8192df74434518974dca4daf6c1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2017 23:32:14 +0100 Subject: [PATCH 24/85] Fix remove warnings --- htdocs/core/modules/modFournisseur.class.php | 12 ++--- htdocs/core/modules/modSociete.class.php | 8 +-- htdocs/theme/eldy/style.css.php | 52 +++++++++++++++++--- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 017ffd1d121..269d4d04a17 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -371,7 +371,7 @@ class modFournisseur extends DolibarrModules // End add extra fields line $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; @@ -381,7 +381,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture_fourn'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; @@ -435,7 +435,7 @@ class modFournisseur extends DolibarrModules // End add extra fields object $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; @@ -444,7 +444,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; // Order $r++; @@ -541,7 +541,7 @@ class modFournisseur extends DolibarrModules // End add extra fields line $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; @@ -553,7 +553,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index af4da616ce9..d10e9747d91 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -281,9 +281,9 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; $this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')'; - if(!$user->rights->societe->client->voir) { + if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; - if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) { + if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { $subordinatesids = $user->getAllChildIds(); $this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; } @@ -318,9 +318,9 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')'; - if(!$user->rights->societe->client->voir) { + if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; - if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) { + if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { $subordinatesids = $user->getAllChildIds(); $this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a785afa9cfd..52dad786951 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -261,10 +261,22 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla background-color: #FFF; } -input:focus, textarea:focus, button:focus, select:focus { - box-shadow: 0 0 4px #8091BF; - /* TODO Remove shadow on focus. Use instead border-bottom: 1px solid #aaa !important; To disable with select2 too. */ +textarea:focus, button:focus { + /* v6 box-shadow: 0 0 4px #8091BF; */ + border: 1px solid #aaa !important; } +input:focus, select:focus { + /* box-shadow: 0 0 4px #8091BF; */ + border-bottom: 1px solid #666; +} +input.select2-input { + border-bottom: none ! important; +} +.select2-choice { + border: none; + border-bottom: 1px solid #aaa !important; +} + textarea.cke_source:focus { box-shadow: none; @@ -273,16 +285,32 @@ textarea.cke_source:focus input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { font-size: px; font-family: ; + border: 1px solid #C0C0C0; + /* v6 border: none; + border-bottom: 1px solid #C0C0C0; + outline: none !important;*/ margin: 0px 0px 0px 0px; } -input, textarea, select { +input, select { + /* v6 border-bottom: solid 1px rgba(0,0,0,.2);*/ border-radius: 2px; - border:solid 1px rgba(0,0,0,.3); + border: solid 1px rgba(0,0,0,.3); border-top:solid 1px rgba(0,0,0,.3); border-bottom:solid 1px rgba(0,0,0,.2); - /* box-shadow: 1px 1px 1px rgba(0,0,0,.2) inset;*/ + + padding:4px; + margin-left:0px; + margin-bottom:1px; + margin-top:1px; + } +textarea { + border-radius: 2px; + border: solid 1px rgba(0,0,0,.3); + border-top:solid 1px rgba(0,0,0,.3); + border-bottom:solid 1px rgba(0,0,0,.2); + padding:4px; margin-left:0px; margin-bottom:1px; @@ -4028,7 +4056,14 @@ div.dataTables_length select { background: #FFFFFF !important; } -.select2-choice, +.select2-choice +{ + border: 1px solid #aaa; + /* v6 border-top: none !important; + border-left: none !important; + border-right: none !important; + border-bottom: 1px solid #aaa;*/ +} .select2-drop.select2-drop-above.select2-drop-active, .select2-container-active .select2-choice, .select2-container-active .select2-choices, @@ -4037,6 +4072,7 @@ div.dataTables_length select { .select2-container-multi.select2-container-active .select2-choices { border: 1px solid #aaa; + /* v6 */ } .select2-disabled { @@ -4057,7 +4093,7 @@ a span.select2-chosen line-height: 24px; } .select2-choices .select2-search-choice { - border: 1px solid #aaa !important; + /* border: 1px solid #aaa !important; */ } .select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit { From 0fe844aa00b3a9a3ee10977d55b23ce2d1541f03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 00:01:06 +0100 Subject: [PATCH 25/85] FIX usage of tag {y} in numbering modules --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index a09b962ee26..bb34806965a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1056,13 +1056,13 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m { $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date)+$yearoffset, $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y",$date)+$yearoffset, $numFinal); - $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1)+$yearoffset, $numFinal); + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1)+$yearoffset, $numFinal); } else // we want yyyy to be current year { $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal); - $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1), $numFinal); + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1), $numFinal); } $numFinal = preg_replace('/\{mm\}/i', date("m",$date), $numFinal); $numFinal = preg_replace('/\{dd\}/i', date("d",$date), $numFinal); From d95ac3bbdd3b4b0f3a3d34ed507033cae2a16cb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 00:16:20 +0100 Subject: [PATCH 26/85] Fix warning --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index d10e9747d91..6cf0a6c0278 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -313,7 +313,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'socpeople as c'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object'; - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; From 6903acfe1c92d03065f4b229d26898fc6237a0ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 00:22:12 +0100 Subject: [PATCH 27/85] Include php 7.1 in tests --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 718356e8075..4f32a1dea43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ php: - '5.5' - '5.6' - '7.0' +- '7.1' - nightly addons: @@ -50,6 +51,7 @@ env: matrix: fast_finish: true allow_failures: + - php: 7.1 - php: nightly # FIXME #- env: DB=postgresql @@ -96,7 +98,7 @@ install: if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then composer -n require phpunit/phpunit ^4 fi - if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then composer -n require phpunit/phpunit ^5 fi echo @@ -136,7 +138,7 @@ before_script: echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini echo echo "Enabling Memcached for PHP <= 5.4" - # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly! + # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly! echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini fi phpenv rehash @@ -208,7 +210,7 @@ before_script: echo "Setting up Apache + FPM" # enable php-fpm cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then # Copy the included pool cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf fi From 94a180a7755640ffc94fd41f9970cd4c870ffa96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 00:53:59 +0100 Subject: [PATCH 28/85] Fix POO best practice --- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/societe/class/companybankaccount.class.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 73dd2d4f199..0e9b25c39a8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -662,7 +662,7 @@ class Account extends CommonObject * * @param User $user Object user making action * @param int $notrigger 1=Disable triggers - * @return int <0 si ko, >0 si ok + * @return int <0 if KO, >0 if OK */ function update(User $user = null, $notrigger = 0) { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index e5d5eb5cc8f..46927e7bc64 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -102,10 +102,11 @@ class CompanyBankAccount extends Account /** * Update bank account * - * @param User $user Object user - * @return int <=0 if KO, >0 if OK + * @param User $user Object user + * @param int $notrigger 1=Disable triggers + * @return int <=0 if KO, >0 if OK */ - function update(User $user = null) + function update(User $user = null, $notrigger=0) { global $conf; From a07a77e323a269c1871500b18810129615221471 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 01:11:38 +0100 Subject: [PATCH 29/85] Not yet ready for php 7.1 --- .travis.yml | 2 +- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/project/doc/pdf_baleine.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 4 ++-- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f32a1dea43..a9e47ccb9c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ php: - '5.5' - '5.6' - '7.0' -- '7.1' +#- '7.1' - nightly addons: diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index a3ff1af0726..3f3b072de34 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -483,7 +483,7 @@ class pdf_einstein extends ModelePDFCommandes $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; // Add line diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 6b9b2bf5dd0..53179a64cc0 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -585,7 +585,7 @@ class pdf_crabe extends ModelePDFFactures $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 5c95bc56fe7..334846ab69b 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -223,7 +223,7 @@ class pdf_baleine extends ModelePDFProjects $progress=$object->lines[$i]->progress.'%'; $datestart=dol_print_date($object->lines[$i]->date_start,'day'); $dateend=dol_print_date($object->lines[$i]->date_end,'day'); - $planned_workload=convertSecondToTime($object->lines[$i]->planned_workload,'allhourmin'); + $planned_workload=convertSecondToTime((int) $object->lines[$i]->planned_workload,'allhourmin'); $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index fc2e7a0e5d6..566127c803d 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -582,7 +582,7 @@ class pdf_azur extends ModelePDFPropales $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index d6d904ecb35..96cec5e5ba3 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -170,7 +170,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $object->fetch_thirdparty(); - $deja_regle = ""; + $deja_regle = 0; $amount_credit_notes_included = 0; $amount_deposits_included = 0; //$amount_credit_notes_included = $object->getSumCreditNotesUsed(); @@ -466,7 +466,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index e73e7f0f1c6..b3f99886f25 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -489,7 +489,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; From 6bfd534a36ebc274f2b0d2ee520c8571bdfd1068 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 01:21:33 +0100 Subject: [PATCH 30/85] NEW PHP 7.1 compatibility --- htdocs/core/class/commonobject.class.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index db3be3bc4ac..22718e534cc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3020,9 +3020,16 @@ abstract class CommonObject foreach ($this->lines as $line) { - - $totalOrdered+=$line->qty_asked; // defined for shipment only - $totalToShip+=$line->qty_shipped; // defined for shipment only + if (isset($line->qty_asked)) + { + if (empty($totalOrdered)) $totalOrdered=0; // Avoid warning because $totalOrdered is '' + $totalOrdered+=$line->qty_asked; // defined for shipment only + } + if (isset($line->qty_shipped)) + { + if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' + $totalToShip+=$line->qty_shipped; // defined for shipment only + } // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments @@ -3037,8 +3044,11 @@ abstract class CommonObject if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; + if (empty($totalWeight)) $totalWeight=0; // Avoid warning because $totalWeight is '' + if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is '' + //var_dump($line->volume_units); - if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { $trueWeightUnit=pow(10, $weightUnit); $totalWeight += $weight * $qty * $trueWeightUnit; @@ -3047,7 +3057,7 @@ abstract class CommonObject { $totalWeight += $weight * $qty; // This may be wrong if we mix different units } - if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; $trueVolumeUnit=pow(10, $volumeUnit); From 10a10f459cbd88b4f57e357ba8b57cc9e9148876 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 01:23:43 +0100 Subject: [PATCH 31/85] Update ChangeLog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 798f3ef91f4..33390ca90c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,6 +151,8 @@ Dolibarr better: no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. +Dolibarr 5.0 was frozen before PHP 7.1 was released. It is compatible with PHP 5.3 to 7.0 but not with PHP 7.1 (Dolibarr 6.0 will be). + ***** ChangeLog for 4.0.3 to 4.0.2 ***** FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 From 6a79a80320524bcbb818a3d203f0507afca32c9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 08:50:17 +0100 Subject: [PATCH 32/85] Reenable php 7.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a9e47ccb9c6..4f32a1dea43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ php: - '5.5' - '5.6' - '7.0' -#- '7.1' +- '7.1' - nightly addons: From a05132d26ef79f5581c6e3a179d89b6b335a93f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 00:53:59 +0100 Subject: [PATCH 33/85] Fix PHP 7.1 error --- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/core/lib/bank.lib.php | 3 ++- htdocs/societe/class/companybankaccount.class.php | 7 ++++--- htdocs/societe/class/societe.class.php | 3 +-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 73dd2d4f199..0e9b25c39a8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -662,7 +662,7 @@ class Account extends CommonObject * * @param User $user Object user making action * @param int $notrigger 1=Disable triggers - * @return int <0 si ko, >0 si ok + * @return int <0 if KO, >0 if OK */ function update(User $user = null, $notrigger = 0) { diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 74078740080..1df180452c3 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -197,9 +197,10 @@ function checkBanForAccount($account) $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789"); // Separation du rib en 3 groupes de 7 + 1 groupe de 2. // Multiplication de chaque groupe par les coef du tableau +var_dump($rib); for ($i = 0, $s = 0; $i < 3; $i++) { $code = substr($rib, 7 * $i, 7); - $s += (0 + $code) * $coef[$i]; + $s += (0 + (int) $code) * $coef[$i]; } // Soustraction du modulo 97 de $s a 97 pour obtenir la cle $cle_rib = 97 - ($s % 97); diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index e5d5eb5cc8f..46927e7bc64 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -102,10 +102,11 @@ class CompanyBankAccount extends Account /** * Update bank account * - * @param User $user Object user - * @return int <=0 if KO, >0 if OK + * @param User $user Object user + * @param int $notrigger 1=Disable triggers + * @return int <=0 if KO, >0 if OK */ - function update(User $user = null) + function update(User $user = null, $notrigger=0) { global $conf; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fd3445375a9..9248a07469c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1909,10 +1909,9 @@ class Societe extends CommonObject if (! empty($conf->accounting->enabled) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; - if (! empty($this->logo)) + if (! empty($this->logo) && class_exists('Form')) { $label.= '
'; - //if (! is_object($form)) $form = new Form($db); $label.= Form::showphoto('societe', $this, 80, 0, 0, 'photowithmargin', 'mini'); $label.= '
'; } From 36bd63c1a7b7292924e78aa6cb77ea060162a4c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 01:21:33 +0100 Subject: [PATCH 34/85] NEW PHP 7.1 compatibility --- htdocs/core/class/commonobject.class.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fd15bdd5886..b75bc9e3d05 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3017,9 +3017,16 @@ abstract class CommonObject foreach ($this->lines as $line) { - - $totalOrdered+=$line->qty_asked; // defined for shipment only - $totalToShip+=$line->qty_shipped; // defined for shipment only + if (isset($line->qty_asked)) + { + if (empty($totalOrdered)) $totalOrdered=0; // Avoid warning because $totalOrdered is '' + $totalOrdered+=$line->qty_asked; // defined for shipment only + } + if (isset($line->qty_shipped)) + { + if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' + $totalToShip+=$line->qty_shipped; // defined for shipment only + } // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments @@ -3034,8 +3041,11 @@ abstract class CommonObject if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; + if (empty($totalWeight)) $totalWeight=0; // Avoid warning because $totalWeight is '' + if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is '' + //var_dump($line->volume_units); - if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { $trueWeightUnit=pow(10, $weightUnit); $totalWeight += $weight * $qty * $trueWeightUnit; @@ -3044,7 +3054,7 @@ abstract class CommonObject { $totalWeight += $weight * $qty; // This may be wrong if we mix different units } - if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; $trueVolumeUnit=pow(10, $volumeUnit); From f43b3ebda463a59a184779081f81e350470ebacb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 09:30:00 +0100 Subject: [PATCH 35/85] Fix holiday class --- htdocs/holiday/class/holiday.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 78bc1582a65..c51c99ff1ff 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -127,7 +127,8 @@ class Holiday extends CommonObject // Check parameters if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; } if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; } - + if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; } + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; $sql.= "fk_user,"; @@ -150,7 +151,7 @@ class Holiday extends CommonObject $sql.= " ".$this->halfday.","; $sql.= " '1',"; $sql.= " '".$this->fk_validator."',"; - $sql.= " '".$this->fk_type."',"; + $sql.= " ".$this->fk_type.","; $sql.= " ".$user->id.","; $sql.= " ".$conf->entity; $sql.= ")"; From ac80d4057d955b49984d8d70aa36f13fa85919c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 09:30:28 +0100 Subject: [PATCH 36/85] Fix several running time errors --- htdocs/core/lib/date.lib.php | 4 ++-- htdocs/core/lib/price.lib.php | 1 + htdocs/holiday/class/holiday.class.php | 14 ++++++++------ test/phpunit/MarginsLibTest.php | 1 - 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index a0d61144582..cd897071551 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -175,7 +175,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt $sTime=''; $sDay=0; - $sWeek=''; + $sWeek=0; if ($iSecond >= $lengthOfDay) { @@ -218,7 +218,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt } if ($format == 'allhourmin') { - return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))); + return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))); } if ($format == 'allhour') { diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index e94c0c7dcfe..2fe652f6ac9 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -80,6 +80,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result=array(); // Clean parameters + if (empty($info_bits)) $info_bits=0; if (empty($txtva)) $txtva=0; if (empty($seller) || ! is_object($seller)) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 78bc1582a65..10534082b9e 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -127,7 +127,8 @@ class Holiday extends CommonObject // Check parameters if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; } if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; } - + if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; } + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; $sql.= "fk_user,"; @@ -150,7 +151,7 @@ class Holiday extends CommonObject $sql.= " ".$this->halfday.","; $sql.= " '1',"; $sql.= " '".$this->fk_validator."',"; - $sql.= " '".$this->fk_type."',"; + $sql.= " ".$this->fk_type.","; $sql.= " ".$user->id.","; $sql.= " ".$conf->entity; $sql.= ")"; @@ -281,7 +282,7 @@ class Holiday extends CommonObject $sql = "SELECT"; $sql.= " cp.rowid,"; - + $sql.= " cp.fk_user,"; $sql.= " cp.date_create,"; $sql.= " cp.description,"; @@ -868,7 +869,7 @@ class Holiday extends CommonObject { $sql = "SELECT value"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; - $sql.= " WHERE name = '".$name."'"; + $sql.= " WHERE name = '".$this->db->escape($name)."'"; dol_syslog(get_class($this).'::getConfCP name='.$name.' createifnotfound='.$createifnotfound, LOG_DEBUG); $result = $this->db->query($sql); @@ -882,7 +883,7 @@ class Holiday extends CommonObject if ($createifnotfound) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)"; - $sql.= " VALUES('".$name."', '".$createifnotfound."')"; + $sql.= " VALUES('".$this->db->escape($name)."', '".$this->db->escape($createifnotfound)."')"; $result = $this->db->query($sql); if ($result) { @@ -947,7 +948,7 @@ class Holiday extends CommonObject $nbUser = count($users); $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; - $sql.= " value = '".$newdateforlastupdate."'"; + $sql.= " value = '".$this->db->escape($newdateforlastupdate)."'"; $sql.= " WHERE name = 'lastUpdate'"; $result = $this->db->query($sql); @@ -1634,6 +1635,7 @@ class Holiday extends CommonObject $this->date_fin=dol_now()+(24*3600); $this->fk_validator=1; $this->halfday=0; + $this->fk_type=1; } } diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 7c2e8f68ef6..e6f130d2e3b 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -138,7 +138,6 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(20,$result[2]); $result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8); - var_dump($result); print __METHOD__." result[0]=".$result[0]."\n"; $this->assertEquals(8,$result[0]); print __METHOD__." result[1]=".$result[1]."\n"; From f36dea5be7bcd993ca0a94eb30750d6ce87470dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 09:30:00 +0100 Subject: [PATCH 37/85] Fix holiday class Conflicts: htdocs/holiday/class/holiday.class.php --- htdocs/holiday/class/holiday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 10534082b9e..e69fd312f45 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -127,7 +127,7 @@ class Holiday extends CommonObject // Check parameters if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; } if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; } - if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; } + if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; } // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; From d2b766f9f45c5353436893ab4761f984a73e77a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 10:15:57 +0100 Subject: [PATCH 38/85] Fix PHP 7.1 --- .travis.yml | 2 +- ChangeLog | 3 ++- htdocs/user/card.php | 6 +++--- htdocs/user/class/user.class.php | 2 +- test/phpunit/WebservicesUserTest.php | 8 ++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index a9e47ccb9c6..4f32a1dea43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ php: - '5.5' - '5.6' - '7.0' -#- '7.1' +- '7.1' - nightly addons: diff --git a/ChangeLog b/ChangeLog index 33390ca90c0..87e7f4ba18b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,7 +151,8 @@ Dolibarr better: no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. -Dolibarr 5.0 was frozen before PHP 7.1 was released. It is compatible with PHP 5.3 to 7.0 but not with PHP 7.1 (Dolibarr 6.0 will be). +Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough +feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. ***** ChangeLog for 4.0.3 to 4.0.2 ***** diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8b5ab723bd3..e7614f06f9d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1090,9 +1090,9 @@ if (($action == 'create') || ($action == 'adduserldap')) // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '
"; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5f44e675ece..ee76525a6ae 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -330,7 +330,7 @@ class User extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 9be97167104..78d3d311fe0 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -154,7 +154,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase // Test URL $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'admin'); + $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'admin'); print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); @@ -177,11 +177,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase } print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + $this->assertEquals('OK', $result['result']['result_code'], 'Test on ref admin'); // Test URL $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'refthatdoesnotexists'); + $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'refthatdoesnotexists'); print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); @@ -200,7 +200,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase } print __METHOD__." result=".$result."\n"; - $this->assertEquals('NOT_FOUND',$result['result']['result_code']); + $this->assertEquals('NOT_FOUND', $result['result']['result_code'], 'Test on ref that does not exists'); return $result; } From 1b1bab94ca27c7f49eff4b13a57cd75e80a40109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 10:43:22 +0100 Subject: [PATCH 39/85] More complete commit for #6114 --- htdocs/core/modules/modProduct.class.php | 6 +- htdocs/product/card.php | 104 +++++++++-------------- htdocs/product/class/product.class.php | 13 +-- 3 files changed, 48 insertions(+), 75 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 330349b0842..195b59ed85d 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -151,7 +151,7 @@ class modProduct extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("produit","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'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.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); @@ -159,13 +159,13 @@ class modProduct extends DolibarrModules if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); - $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'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); + $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'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'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'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); - $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); + $this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 19e79408e4e..5a7158cd190 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -284,10 +284,8 @@ if (empty($reshook)) $object->length = GETPOST('size'); $object->length_units = GETPOST('size_units'); $object->width = GETPOST('sizewidth'); - $object->width_units = GETPOST('sizewidth_units'); $object->height = GETPOST('sizeheight'); - $object->height_units = GETPOST('sizeheight_units'); - $object->surface = GETPOST('surface'); + $object->surface = GETPOST('surface'); $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); @@ -385,9 +383,7 @@ if (empty($reshook)) $object->length = GETPOST('size'); $object->length_units = GETPOST('size_units'); $object->width = GETPOST('sizewidth'); - $object->width_units = GETPOST('sizewidth_units'); $object->height = GETPOST('sizeheight'); - $object->height_units = GETPOST('sizeheight_units'); $object->surface = GETPOST('surface'); $object->surface_units = GETPOST('surface_units'); @@ -1021,21 +1017,12 @@ else // Length if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - print ''; - - print ''; - - print ''; - } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1346,21 +1333,13 @@ else print ''; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Length - print ''; - - print ''; - - print ''; + // Length + print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1370,11 +1349,14 @@ else print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units); print ''; } - // Volume - print ''; + if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) + { + // Volume + print ''; + } } // Units if($conf->global->PRODUCT_USE_UNITS) @@ -1668,32 +1650,19 @@ else if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Length - print '\n"; - - print '\n"; - - print '\n"; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1709,17 +1678,20 @@ else } print "\n"; } - // Volume - print '\n"; } - else - { - print ' '; - } - print "\n"; } // Unit diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f7e3881108a..27fb4a4c11c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -640,15 +640,16 @@ class Product extends CommonObject $this->width_units = trim($this->width_units); $this->height = price2num($this->height); $this->height_units = trim($this->height_units); + // set unit not defined + if (! $this->width_units && $this->length_units) $this->width_units = $this->length_units; // Not used yet + if (! $this->height_units && $this->length_units) $this->height_units = $this->length_units; // Not used yet // Automated compute surface and volume if not filled - if (empty($this->surface) && !empty($this->length) && !empty($this->width) - && $this->length_units == $this->with_units - ) { + if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) + { $this->surface = $this->length * $this->width; $this->surface_units = $this->width_units; - if (empty($this->volume) && !empty($this->height) - && $this->length_units == $this->height_units - ) { + if (empty($this->volume) && !empty($this->height) && $this->length_units == $this->height_units) + { $this->volume = $this->surface * $this->height; $this->volume_units = $this->height_units; } From fafe71ec52ec29fd3496ba1c554330b57f2eed4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 10:55:33 +0100 Subject: [PATCH 40/85] Fix autocalculation of surface and volume. --- htdocs/product/class/product.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 27fb4a4c11c..1999a6f9c4a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -641,18 +641,18 @@ class Product extends CommonObject $this->height = price2num($this->height); $this->height_units = trim($this->height_units); // set unit not defined - if (! $this->width_units && $this->length_units) $this->width_units = $this->length_units; // Not used yet - if (! $this->height_units && $this->length_units) $this->height_units = $this->length_units; // Not used yet + if ($this->length_units) $this->width_units = $this->length_units; // Not used yet + if ($this->length_units) $this->height_units = $this->length_units; // Not used yet // Automated compute surface and volume if not filled if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) { $this->surface = $this->length * $this->width; - $this->surface_units = $this->width_units; - if (empty($this->volume) && !empty($this->height) && $this->length_units == $this->height_units) - { - $this->volume = $this->surface * $this->height; - $this->volume_units = $this->height_units; - } + $this->surface_units = $this->length_units + $this->width_units; + } + if (empty($this->volume) && !empty($this->surface_units) && !empty($this->height) && $this->length_units == $this->height_units) + { + $this->volume = $this->surface * $this->height; + $this->volume_units = $this->surface_units + $this->height_units; } $this->surface = price2num($this->surface); From 983f707553132edb0dddc2c0e3633c7324f143e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 11:35:25 +0100 Subject: [PATCH 41/85] Add comment --- htdocs/api/class/api_login.class.php | 2 +- test/soapui/Dolibarr-soapui-project.xml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 305bc7cafe6..439308fcaea 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -34,7 +34,7 @@ class Login /** * Login * - * Log user with username and password + * Log user with username and password. Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass) * * @param string $login Username * @param string $password User password diff --git a/test/soapui/Dolibarr-soapui-project.xml b/test/soapui/Dolibarr-soapui-project.xml index b5de27fbf31..4556cebeca2 100755 --- a/test/soapui/Dolibarr-soapui-project.xml +++ b/test/soapui/Dolibarr-soapui-project.xml @@ -1889,7 +1889,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/webservices/server_user.php<xml-fragment/>UTF-8http://localhostdolibarr/webservices/server_user.php +]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/webservices/server_user.phphttp://pchome-ld.hd.free.fr:801/dolibarr_5.0/htdocs/webservices/server_user.php<xml-fragment/>UTF-8http://pchome-ld.hd.free.fr:801/dolibarr_5.0/htdocs/webservices/server_user.php @@ -1901,8 +1901,7 @@ admin - 1 - + admin From 4f949bea29f7dcb86caf3bddbaf900902123b20a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 11:46:30 +0100 Subject: [PATCH 42/85] FIX #6273 --- htdocs/contrat/class/contrat.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 202a3dc2a0d..958f14f8911 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -693,8 +693,8 @@ class Contrat extends CommonObject // fetch optionals attributes and labels $line->fetch_optionals($line->id,$extralabelsline); - $this->lines[] = $line; - $this->lines_id_index_mapper[$line->id] = key($this->lines); + $this->lines[$i] = $line; + $this->lines_id_index_mapper[$line->id] = $i; //dol_syslog("1 ".$line->desc); //dol_syslog("2 ".$line->product_desc); From c01baf1223275a7d71b2bd1d0f2a4dfb398624fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 12:16:49 +0100 Subject: [PATCH 43/85] FIX #6255 --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 5bc09419666..1354d2c06eb 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1272,7 +1272,7 @@ class BonPrelevement extends CommonObject * section Debiteur (sepa Debiteurs bloc lines) */ - $tmp_invoices = array(); + /*$tmp_invoices = array(); $sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1"; $resql=$this->db->query($sql); @@ -1280,9 +1280,7 @@ class BonPrelevement extends CommonObject while ($objfac = $this->db->fetch_object($resql)) { $tmp_invoices[] = $objfac->fac; } - } - - $ListOfFactures = implode($tmp_invoices); + }*/ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; @@ -1310,7 +1308,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); $this->total = $this->total + $obj->somme; $i++; } From 43cb9c30b26e58769bccfda515aeed20502886f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 12:21:37 +0100 Subject: [PATCH 44/85] Fix var_dump --- htdocs/compta/prelevement/class/bonprelevement.class.php | 6 +++--- htdocs/compta/prelevement/create.php | 1 + htdocs/core/lib/bank.lib.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 1354d2c06eb..9373527e20c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -813,7 +813,7 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } } - + if (! $error) { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -834,7 +834,7 @@ class BonPrelevement extends CommonObject { $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$soc->id); - + if ($bac->verif() >= 1) //if (true) { @@ -867,7 +867,7 @@ class BonPrelevement extends CommonObject } $ok=0; - + // Withdraw invoices in factures_prev array $out=count($factures_prev)." invoices will be withdrawn."; //print $out."\n"; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 8be897990ed..bcc6cc9450e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -60,6 +60,7 @@ if ($action == 'modify') } if ($action == 'create') { + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); $result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET); diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 1df180452c3..47d3539e3ba 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -197,7 +197,7 @@ function checkBanForAccount($account) $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789"); // Separation du rib en 3 groupes de 7 + 1 groupe de 2. // Multiplication de chaque groupe par les coef du tableau -var_dump($rib); + for ($i = 0, $s = 0; $i < 3; $i++) { $code = substr($rib, 7 * $i, 7); $s += (0 + (int) $code) * $coef[$i]; From c1d6ad90b33043f49e76bd329b711dfe3b73c50a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 12:35:19 +0100 Subject: [PATCH 45/85] FIX #6255 --- htdocs/compta/prelevement/create.php | 2 +- htdocs/societe/rib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index bcc6cc9450e..8a6f4bb7ecc 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -60,7 +60,6 @@ if ($action == 'modify') } if ($action == 'create') { - // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); $result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET); @@ -73,6 +72,7 @@ if ($action == 'create') $mesg=''; $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed"); setEventMessages($mesg, null, 'errors'); + $mesg.='
'."\n"; foreach($bprev->invoice_in_error as $key => $val) { $mesg.=$val."
\n"; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 8a6a9b87209..4d3e32e326f 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -376,7 +376,7 @@ if ($socid && $action != 'edit' && $action != "create") $content = $account->code_guichet; } elseif ($val == 'BankAccountNumber') { $content = $account->number; - if (! empty($account->label)) { + if (! empty($account->label) && $account->number) { if (! checkBanForAccount($account)) { $content.= ' '.img_picto($langs->trans("ValueIsNotValid"),'warning'); } else { @@ -482,7 +482,7 @@ if ($socid && $action != 'edit' && $action != "create") $string .= $rib->iban.' ';*/ } } - if (! empty($rib->label)) { + if (! empty($rib->label) && $rib->number) { if (! checkBanForAccount($rib)) { $string.= ' '.img_picto($langs->trans("ValueIsNotValid"),'warning'); } else { From 7ebb5f7d92aca7a72996e242c53eb6bd17ecd7ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 13:06:26 +0100 Subject: [PATCH 46/85] FIX #6270 --- htdocs/core/actions_sendmails.inc.php | 37 +++++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 9ec3bfcb3b7..28799231fdd 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -337,24 +337,27 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } // Initialisation of datas - $object->socid = $sendtosocid; // To link to a company - $object->sendtoid = $sendtoid; // To link to a contact/address - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; // Long text - $object->actionmsg2 = $actionmsg2; // Short text - $object->trackid = $trackid; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Call of triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $errors=$interface->errors; + if (is_object($object)) + { + $object->socid = $sendtosocid; // To link to a company + $object->sendtoid = $sendtoid; // To link to a contact/address + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->trackid = $trackid; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Call of triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $errors=$interface->errors; + } + // End call of triggers } - // End call of triggers - + if ($error) { dol_print_error($db); From e701ea0b2fa3e35c0e5f9565046d2fb77df20f4d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 16 Jan 2017 14:06:34 +0100 Subject: [PATCH 47/85] Add dictionnary mail for contract --- htdocs/admin/dict.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2ca1337736e..6d8787b1677 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -557,6 +557,7 @@ if ($id == 25) if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder'); if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); + if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); $parameters=array('elementList'=>$elementList); $reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks From c0a8752ef4fa9ffe1710046eaa463c3b912fd16a Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 16 Jan 2017 14:17:38 +0100 Subject: [PATCH 48/85] Update card.php --- htdocs/contrat/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3128a7612f5..daae2aa8c36 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2111,13 +2111,13 @@ else dol_print_error($db, $object->error, $object->errors); exit(); } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); + $fileparams = dol_most_recent_file($conf->contrat->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); $file = $fileparams['fullname']; } print '
'; print '
'; - print load_fiche_titre($langs->trans('SendOrderByMail')); + print load_fiche_titre($langs->trans('SendContractByMail')); dol_fiche_head(''); @@ -2145,9 +2145,9 @@ else $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; if (empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__'); + $formmail->withtopic = $outputlangs->trans('SendContractRef', '__CONTRACTREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendContractRef', '__CONTRACTREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2155,7 +2155,7 @@ else $formmail->withcancel = 1; // Tableau des substitutions $formmail->setSubstitFromObject($object); - $formmail->substit ['__ORDERREF__'] = $object->ref; + $formmail->substit ['__CONTRACTREF__'] = $object->ref; $custcontact = ''; $contactarr = array(); @@ -2165,7 +2165,7 @@ else { foreach ($contactarr as $contact) { - if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label + if ($contact['libelle'] == $langs->trans('TypeContact_contract_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); @@ -2179,9 +2179,9 @@ else // Tableau des parametres complementaires $formmail->param['action'] = 'send'; - $formmail->param['models'] = 'order_send'; + $formmail->param['models'] = 'contract_send'; $formmail->param['models_id']=GETPOST('modelmailselected','int'); - $formmail->param['orderid'] = $object->id; + $formmail->param['contractid'] = $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; // Init list of files From 2525a6e3a4c07838a5a3f8898f83c2f45ba0f773 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 16 Jan 2017 17:24:50 +0100 Subject: [PATCH 49/85] update code for next php versions --- .../commande/doc/pdf_einstein.modules.php | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 3f3b072de34..f58d7ab496d 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -40,23 +40,47 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_einstein extends ModelePDFCommandes { - var $db; - var $name; - var $description; - var $type; + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var array() Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.3 = array(5, 3) + */ + public $phpmin = array(5, 2); + + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; - var $phpmin = array(4,3,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; + public $page_largeur; + public $page_hauteur; + public $format; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; - var $page_largeur; - var $page_hauteur; - var $format; - var $marge_gauche; - var $marge_droite; - var $marge_haute; - var $marge_basse; - - var $emetteur; // Objet societe qui emet + public $emetteur; // Objet societe qui emet /** @@ -64,7 +88,7 @@ class pdf_einstein extends ModelePDFCommandes * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf,$langs,$mysoc; From e0cbcadd98a0759e5c4d6bf9a71c2bb0b2253a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Jan 2017 21:16:05 +0100 Subject: [PATCH 50/85] In case Model for document generation is not defined, the criteria to select the model is now: 1. Model for the object 2. Custom default module 3. Hardcoded default module --- htdocs/adherents/class/adherent.class.php | 22 +++++++++---------- htdocs/comm/propal/class/propal.class.php | 16 ++++++-------- htdocs/commande/class/commande.class.php | 16 ++++++-------- htdocs/compta/facture/class/facture.class.php | 20 +++++++---------- htdocs/contrat/class/contrat.class.php | 18 +++++++-------- htdocs/expedition/class/expedition.class.php | 16 ++++++-------- .../class/expensereport.class.php | 22 +++++++++---------- .../class/fournisseur.commande.class.php | 18 +++++++-------- htdocs/livraison/class/livraison.class.php | 16 ++++++-------- htdocs/projet/class/project.class.php | 16 ++++++-------- htdocs/projet/class/task.class.php | 16 ++++++-------- .../class/supplier_proposal.class.php | 18 +++++++-------- 12 files changed, 94 insertions(+), 120 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 945ed849f57..22510aed411 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1818,18 +1818,16 @@ class Adherent extends CommonObject $langs->load("orders"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->ADHERENT_ADDON_PDF)) - { - $modele = $conf->global->ADHERENT_ADDON_PDF; - } - else - { - $modele = 'standard'; - } - } + if (! dol_strlen($modele)) { + + $modele = 'standard'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) { + $modele = $conf->global->ADHERENT_ADDON_PDF; + } + } $modelpath = "core/modules/member/doc/"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f10d82fdbfa..cf42fe3c33f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3434,17 +3434,15 @@ class Propal extends CommonObject $langs->load("propale"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROPALE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'azur'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->PROPALE_ADDON_PDF)) { $modele = $conf->global->PROPALE_ADDON_PDF; } - else - { - $modele = 'azur'; - } } $modelpath = "core/modules/propale/doc/"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1f75e6caf74..1cd706c1863 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3641,17 +3641,15 @@ class Commande extends CommonOrder $langs->load("orders"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMMANDE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'einstein'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->COMMANDE_ADDON_PDF)) { $modele = $conf->global->COMMANDE_ADDON_PDF; } - else - { - $modele = 'einstein'; - } } $modelpath = "core/modules/commande/doc/"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 67f58ac9875..aef95d1b0a9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3967,24 +3967,20 @@ class Facture extends CommonInvoice $langs->load("bills"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->FACTURE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'crabe'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->FACTURE_ADDON_PDF)) { $modele = $conf->global->FACTURE_ADDON_PDF; } - else - { - $modele = 'crabe'; - } } $modelpath = "core/modules/facture/doc/"; - $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); - - return $result; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } /** diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 202a3dc2a0d..a8ad3390db3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2199,21 +2199,19 @@ class Contrat extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf,$langs; $langs->load("contracts"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->CONTRACT_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'strato'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->CONTRACT_ADDON_PDF)) { $modele = $conf->global->CONTRACT_ADDON_PDF; } - else - { - $modele = 'strato'; - } } $modelpath = "core/modules/contract/doc/"; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 971a2189854..99d81852734 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2162,17 +2162,15 @@ class Expedition extends CommonObject $langs->load("sendings"); - // Sets the model on the model name to use - if (! dol_strlen($modele)) - { - if (! empty($conf->global->EXPEDITION_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'rouget'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->EXPEDITION_ADDON_PDF)) { $modele = $conf->global->EXPEDITION_ADDON_PDF; } - else - { - $modele = 'rouget'; - } } $modelpath = "core/modules/expedition/doc/"; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0a858cda257..d21e04cc37f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1573,18 +1573,16 @@ class ExpenseReport extends CommonObject $langs->load("trips"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->EXPENSEREPORT_ADDON_PDF)) - { - $modele = $conf->global->EXPENSEREPORT_ADDON_PDF; - } - else - { - $modele = 'standard'; - } - } + if (! dol_strlen($modele)) { + + $modele = 'standard'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->EXPENSEREPORT_ADDON_PDF)) { + $modele = $conf->global->EXPENSEREPORT_ADDON_PDF; + } + } $modelpath = "core/modules/expensereport/doc/"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 15939384670..a4eda5ec81e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2686,21 +2686,19 @@ class CommandeFournisseur extends CommonOrder */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf, $user, $langs; + global $conf, $langs; $langs->load("suppliers"); - // Sets the model on the model name to use - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'muscadet'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } - else - { - $modele = 'muscadet'; - } } $modelpath = "core/modules/supplier_order/pdf/"; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 15421a8a367..3a18abf2cbb 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -1009,17 +1009,15 @@ class Livraison extends CommonObject $langs->load("deliveries"); - // Positionne modele sur le nom du modele de bon de livraison a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->LIVRAISON_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'typhon'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->LIVRAISON_ADDON_PDF)) { $modele = $conf->global->LIVRAISON_ADDON_PDF; } - else - { - $modele = 'typhon'; - } } $modelpath = "core/modules/livraison/doc/"; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 460e698e432..65c4e6bc94c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1569,17 +1569,15 @@ class Project extends CommonObject $langs->load("projects"); - // Positionne modele sur le nom du modele de projet a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROJECT_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'baleine'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->PROJECT_ADDON_PDF)) { $modele = $conf->global->PROJECT_ADDON_PDF; } - else - { - $modele='baleine'; - } } $modelpath = "core/modules/project/doc/"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ec180704563..fe50be6e521 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1619,17 +1619,15 @@ class Task extends CommonObject $langs->load("projects"); - // Positionne modele sur le nom du modele de projet a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'nodefault'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) { $modele = $conf->global->PROJECT_TASK_ADDON_PDF; } - else - { - $modele='nodefault'; - } } $modelpath = "core/modules/project/task/doc/"; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 53e7bf8ad34..5d2d5aad783 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2510,21 +2510,19 @@ class SupplierProposal extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf, $langs; $langs->load("supplier_proposal"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'aurore'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF)) { $modele = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF; } - else - { - $modele = 'aurore'; - } } $modelpath = "core/modules/supplier_proposal/doc/"; From 0f6cb52376663f5104aa4ed821336375a4fb0074 Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Mon, 16 Jan 2017 17:40:13 -0300 Subject: [PATCH 51/85] Improve code style Replace var for public and private. --- htdocs/core/class/html.formother.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 4ac3eb99c50..9cb402cfc89 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -37,8 +37,8 @@ */ class FormOther { - var $db; - var $error; + private $db; + public $error; /** From 8225b060186bb7809e3fa7689c58610750896bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Jan 2017 21:59:02 +0100 Subject: [PATCH 52/85] NEW Removed commande_pdf_create, contract_pdf_create,expedition_pdf_create, facture_pdf_create, delivery_order_pdf_create, task_pdf_create, project_pdf_create, propale_pdf_create, supplier_invoice_pdf_create, supplier_order_pdf_create, supplier_proposal_pdf_create deprecated functions --- .../modules/commande/modules_commande.php | 24 +----- .../modules/contract/modules_contract.php | 21 ----- .../modules/expedition/modules_expedition.php | 21 ----- .../core/modules/facture/modules_facture.php | 23 ------ .../modules/livraison/modules_livraison.php | 21 ----- .../core/modules/project/modules_project.php | 23 ------ .../modules/project/task/modules_task.php | 24 ------ .../core/modules/propale/modules_propale.php | 23 ------ .../modules/societe/modules_societe.class.php | 77 ------------------- .../modules_facturefournisseur.php | 19 ----- .../modules_commandefournisseur.php | 23 ------ .../modules_supplier_proposal.php | 23 ------ 12 files changed, 1 insertion(+), 321 deletions(-) diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 45623575ba4..aa6da728f56 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -146,26 +146,4 @@ abstract class ModeleNumRefCommandes if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } -} - - -/** - * Create a document onto disk accordign to template module. - * - * @param DoliDB $db Database handler - * @param Commande $object Object order - * @param string $modele Force le modele a utiliser ('' to not force) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Commande class - * @see Commande::generateDocument() - */ -function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} +} \ No newline at end of file diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 1efeaef3466..47a882b7b56 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -143,24 +143,3 @@ class ModelNumRefContracts return $langs->trans("NotAvailable"); } } - -/** - * Create a contract document on disk using template defined into CONTRACT_ADDON_PDF - * - * @param DoliDB $db objet base de donnee - * @param Contrat $object Object contract - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Contrat class - * @see Contrat::generateDocument() - */ -function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 335491c0f9d..f46fa33c5f1 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -141,24 +141,3 @@ abstract class ModelNumRefExpedition return $langs->trans("NotAvailable"); } } - -/** - * Create a document onto disk according to template module. - * - * @param DoliDB $db Objet base de donnee - * @param Expedition $object Object expedition - * @param string $modele Force le modele a utiliser ('' to not force) - * @param Translate $outputlangs Objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 1 if OK -1 if KO - * @deprecated Use the new function generateDocument of Expedition class - * @see Expedition::generateDocument() - */ -function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 23d55d0aa96..b5d9a2397cc 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -142,26 +142,3 @@ abstract class ModeleNumRefFactures return $langs->trans("NotAvailable"); } } - - -/** - * Create a document onto disk according to template module. - * - * @param DoliDB $db Database handler - * @param Facture $object Object invoice - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int <0 if KO, >0 if OK - * @deprecated Use the new function generateDocument of Facture class - * @see Facture::generateDocument() - */ -function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index c3c762cbed1..a433f42930d 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -144,24 +144,3 @@ abstract class ModeleNumRefDeliveryOrder return $langs->trans("NotAvailable"); } } - - - -/** - * Create object on disk - * - * @param DoliDB $db objet base de donnee - * @param Livraison $object object delivery - * @param string $modele force le modele a utiliser ('' to not force) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Livraison class - * @see Livraison::generateDocument() - */ -function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='') -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs); -} - diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index acc1c2738f4..5f7ef3d5756 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -139,26 +139,3 @@ abstract class ModeleNumRefProjects return $langs->trans("NotAvailable"); } } - - -/** - * Create an intervention document on disk using template defined into PROJECT_ADDON_PDF - * - * @param DoliDB $db objet base de donnee - * @param Project $object Object fichinter - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Project class - * @see Project::generateDocument() - */ -function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index bea4d342e29..7d14ae12a3e 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -139,27 +139,3 @@ abstract class ModeleNumRefTask return $langs->trans("NotAvailable"); } } - - -/** - * Create an intervention document on disk using template defined into PROJECT_TASK_ADDON_PDF - * - * @param DoliDB $db objet base de donnee - * @param Task $object Object fichinter - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param HookManager $hookmanager Hook manager instance - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Task class - * @see Task::generateDocument() - */ -function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); -} - diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 6c0be15f0df..c2d52923e4f 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -143,26 +143,3 @@ abstract class ModeleNumRefPropales return $langs->trans("NotAvailable"); } } - - -/** - * Create a document onto disk according to template module. - * - * @param DoliDB $db Database handler - * @param Propal $object Object proposal - * @param string $modele Force model to use ('' to not force) - * @param Translate $outputlangs Object langs to use for output - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Propal class - * @see Propal::generateDocument() - */ -function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 63208b1369c..0ed5eace2e2 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -384,80 +384,3 @@ function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $ return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } - - -/** - * Create a document for third party - * - * @param DoliDB $db Database handler - * @param Societe $object Object of third party to use - * @param string $message Message - * @param string $modele Force model to use ('' to not force). model can be a model name or a template file. - * @param Translate $outputlangs Object lang to use for translation - * @return int <0 if KO, >0 if OK - */ -/*function thirdparty_doc_create($db, $object, $message, $modele, $outputlangs) -{ - global $conf,$langs,$user; - $langs->load("bills"); - $error=0; - - $dir = DOL_DOCUMENT_ROOT . "/core/modules/societe/doc"; - $srctemplatepath=''; - - // Positionne modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMPANY_ADDON_PDF)) - { - $modele = $conf->global->COMPANY_ADDON_PDF; - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); - return 0; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template - $file = "doc_".$modele.".modules.php"; - if (file_exists($dir.'/'.$file)) - { - $classname = "doc_".$modele; - require_once $dir.'/'.$file; - - $obj = new $classname($db); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"thirdparty_doc_create Error: ".$obj->error); - return -1; - } - - } - else - { - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.'/'.$file)); - return -1; - } -} -*/ - diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index aebc7aa008a..7762d8ce6a5 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -135,22 +135,3 @@ abstract class ModeleNumRefSuppliersInvoices return $langs->trans("NotAvailable"); } } - -/** - * Create a document onto disk according to template model. - * - * @param DoliDB $db Database handler - * @param Object $object Object supplier invoice - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs Object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * - */ -function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index bd34ca86b20..4bd262d67fb 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -137,26 +137,3 @@ abstract class ModeleNumRefSuppliersOrders return $langs->trans("NotAvailable"); } } - - -/** - * Create a document onto disk according to template model. - * - * @param DoliDB $db Database handler - * @param CommandeFournisseur $object Object supplier order - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs Object lang to use for traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of CommandeFournisseur class - * @see CommandeFournisseur::generateDocument() - */ -function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index 715dc294d91..b324a1b03a8 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -143,26 +143,3 @@ abstract class ModeleNumRefSupplierProposal return $langs->trans("NotAvailable"); } } - - -/** - * Create a document onto disk according to template module. - * - * @param DoliDB $db Database handler - * @param SupplierProposal $object Object supplier_proposal - * @param string $modele Force model to use ('' to not force) - * @param Translate $outputlangs Object langs to use for output - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of SupplierProposal class - * @see SupplierProposal::generateDocument() - */ -function supplier_proposal_pdf_create(DoliDB $db, SupplierProposal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) -{ - dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); -} - From 819dc44533503046179eba1ab95e5742164bb0dd Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 17 Jan 2017 10:01:59 +0100 Subject: [PATCH 53/85] Fix: Show correct bank account order --- htdocs/societe/rib.php | 74 ++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 8a6a9b87209..8d28f144c78 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2017 Ferran Marcet * * 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 @@ -94,13 +95,13 @@ if (empty($reshook)) if (! GETPOST('label')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if (! GETPOST('bank')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if ($account->needIBAN() == 1) @@ -108,13 +109,13 @@ if (empty($reshook)) if (! GETPOST('iban')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if (! GETPOST('bic')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } } @@ -809,41 +810,42 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print '
'; print ''; - // BBAN - if ($account->useDetailedBBAN() == 1) - { - print ''; - print ''; - print ''; + // Show fields of bank account + foreach ($account->getFieldsToShow(1) as $val) { - print ''; - print ''; + $require=false; + if ($val == 'BankCode') { + $name = 'code_banque'; + $size = 8; + $content = $account->code_banque; + } elseif ($val == 'DeskCode') { + $name = 'code_guichet'; + $size = 8; + $content = $account->code_guichet; + } elseif ($val == 'BankAccountNumber') { + $name = 'number'; + $size = 18; + $content = $account->number; + } elseif ($val == 'BankAccountNumberKey') { + $name = 'cle_rib'; + $size = 3; + $content = $account->cle_rib; + } elseif ($val == 'IBAN') { + $name = 'iban'; + $size = 30; + $content = $account->iban; + if ($account->needIBAN()) $require=true; + } elseif ($val == 'BIC') { + $name = 'bic'; + $size = 12; + $content = $account->bic; + if ($account->needIBAN()) $require=true; + } + + print ''.$langs->trans($val).''; + print ''; print ''; } - if ($account->useDetailedBBAN() == 2) - { - print ''; - print ''; - print ''; - } - - print ''; - print ''; - print ''; - - if ($account->useDetailedBBAN() == 1) - { - print ''; - print ''; - print ''; - } - - // IBAN - print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("IBAN").''; - print ''; - - print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("BIC").''; - print ''; print '
'; print $versiontrans; From d14e4dbabaac5bbaa47a4d1ef99091abc87ba650 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2017 20:49:20 +0100 Subject: [PATCH 22/85] Fix pagination when MAIN_DISABLE_FULL_SCANLIST is on --- dev/skeletons/skeleton_list.php | 2 +- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/bookkeeping/listbyyear.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/list.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- htdocs/adherents/type.php | 2 +- htdocs/admin/tools/listevents.php | 11 ++++++++++- htdocs/categories/class/api_categories.class.php | 2 +- .../class/api_deprecated_category.class.php | 4 ++-- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/action/rapport/index.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/propal/list.php | 2 +- .../commande/class/api_deprecated_commande.class.php | 2 +- htdocs/commande/customer.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/bankentries.php | 2 +- htdocs/compta/bank/index.php | 2 +- .../facture/class/api_deprecated_invoice.class.php | 2 +- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/contrat/services.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/cron/list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/facture/paiement.php | 2 +- htdocs/fourn/product/list.php | 2 +- htdocs/loan/index.php | 2 +- htdocs/margin/checkMargins.php | 2 +- htdocs/opensurvey/list.php | 2 +- htdocs/product/class/api_deprecated_product.class.php | 4 ++-- htdocs/product/list.php | 2 +- htdocs/product/price.php | 4 ++-- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/societe/class/api_deprecated_contact.class.php | 2 +- .../societe/class/api_deprecated_thirdparty.class.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/societe/price.php | 4 ++-- htdocs/supplier_proposal/list.php | 2 +- 61 files changed, 76 insertions(+), 67 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 0ca4d6f8589..77485c6d638 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -247,7 +247,7 @@ $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 47dcce5031b..e82522df26f 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -172,7 +172,7 @@ if (strlen(trim($search_pcgsubtype))) { $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index c5a1bffc694..817905f7b56 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -90,7 +90,7 @@ $sql .= " WHERE f.entity = " . $conf->entity; $sql.=$db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 69d0fdc7f94..cae9295229b 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -248,7 +248,7 @@ if (strlen(trim($search_desc))) { } $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 5e2894eb11f..15345a99b72 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -143,7 +143,7 @@ else { // List - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index c884c0ae3a8..56cae24cf76 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -293,7 +293,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index ca6a3657774..61753d1c39d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -162,7 +162,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index b607d055a7a..f716339bdc8 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -158,7 +158,7 @@ if (! empty($search_code_journal)) { * Mode List */ -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7882c3b9320..0e3f96a7457 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -200,7 +200,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index dbb34299104..45dac88f62d 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -220,7 +220,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 8c47627f2f7..049e1d44687 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -178,7 +178,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 396095eee5a..693984432ae 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -208,7 +208,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index d4428dbcb1a..f289e0f71f9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -182,7 +182,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2f19ff0bc75..93cdd4d48ac 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -217,7 +217,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 579c6cdf344..c3499bb000a 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -250,7 +250,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records with no order and no limits -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 078eb1e0e6f..d8116c79e94 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -110,7 +110,7 @@ if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cab52dceccc..5a76ccb59ce 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -407,7 +407,7 @@ if ($rowid > 0) $sql.=" AND datefin < '".$db->idate($now)."'"; } // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index d3691e85df9..c44932655ed 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -174,6 +174,15 @@ if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); } if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); } $sql.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +/*if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +}*/ + $sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; $result = $db->query($sql); @@ -195,7 +204,7 @@ if ($result) $center=''.$langs->trans("Purge").''; } - print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup'); + print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup'); if ($action == 'purge') { diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 4904bbea3b7..1f37623544b 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -209,7 +209,7 @@ class Categories extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 62f92b71bea..6f2f16bb222 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -124,7 +124,7 @@ class CategoryApi extends DolibarrApi $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -205,7 +205,7 @@ class CategoryApi extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c01e62ae3b5..0a08b6e55f1 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -245,7 +245,7 @@ if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AN if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index fdc94005cdb..97f255abe14 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -85,7 +85,7 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= " GROUP BY year, month, df"; $sql.= " ORDER BY year DESC, month DESC, df DESC"; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ab7ee3c7c8a..e104db4dcda 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -412,7 +412,7 @@ if ($object->fetch($id) >= 0) $sql .= $db->order($sortfield,$sortorder); // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 647ed8a7b4b..040e78b7f1a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -333,7 +333,7 @@ $sql.= $db->order($sortfield,$sortorder); $sql.=', p.ref DESC'; // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index 4595bdbb287..aa1584c4fed 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -139,7 +139,7 @@ class CommandeApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 8190367a06a..5f9a5a570ff 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -97,7 +97,7 @@ $sql.= " GROUP BY s.nom"; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6e304a019d0..662a727c88b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -560,7 +560,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 5cae7aff723..f13b650eff2 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -502,7 +502,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; $nbtotalofpages = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 82283547d99..29877302104 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -175,7 +175,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index 7dd8a7ee6bc..b638a46b920 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -138,7 +138,7 @@ class InvoiceApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 17627964362..584d3915430 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1575,7 +1575,7 @@ else $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,12,false))."'"; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d2c20099edc..8807023784d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -402,7 +402,7 @@ $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.','; $sql.= ' f.rowid DESC '; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index e7cd70c1e30..ae9bc315877 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -112,7 +112,7 @@ else if ($year > 0) } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 46c54d32a47..4cb63b7d905 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -186,7 +186,7 @@ else } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 33e5110153b..04010fd3ad2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -365,7 +365,7 @@ else } // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 8a8ff68097a..849a466e18d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -288,7 +288,7 @@ if ($result) $totalnboflines = $db->num_rows($result); } -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 4fc2f9f53c3..42ff4b04e83 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -236,7 +236,7 @@ if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " A if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; $sql .= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2ce0bd1a524..72762db4f84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3184,7 +3184,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', * @param string $sortorder Order to sort ('' by default) * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction() * @param int $num Number of records found by select with limit+1 - * @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to not show number. + * @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown. * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param string $morehtml More html to show @@ -3193,7 +3193,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', * @param int $hideselectlimit Force to hide select limit * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=-1, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) { global $conf,$langs; @@ -3223,7 +3223,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print ''; if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle" id="pictotitle"', $pictoisfullpath); print '
'.$titre; - if (!empty($titre) && $savtotalnboflines >= 0) print ' ('.$totalnboflines.')'; + if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') print ' ('.$totalnboflines.')'; print '
' . fieldLabel( 'Categories', 'usercats' ) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, 'parent', null, null, 1 ); - print $form->multiselectarray( 'usercats', $cate_arbo, GETPOST( 'usercats', 'array' ), null, null, null, + print '
' . fieldLabel('Categories', 'usercats') . ''; + $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%' ); print "
'.$langs->trans("Length").''; - print ''; + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print ' x '; + print ' x '; + print ''; print $formproduct->select_measuring_units("size_units","size"); print '
'.$langs->trans("Width").''; - print ''; - print $formproduct->select_measuring_units("sizewidth_units","size"); - print '
'.$langs->trans("Height").''; - print ''; - print $formproduct->select_measuring_units("sizeheight_units","size"); - print '
'.$langs->trans("Length").''; - print ' '; - print $formproduct->select_measuring_units("size_units", "size", $object->length_units); - print '
'.$langs->trans("Width").''; - print ' '; - print $formproduct->select_measuring_units("sizewidth_units","size", $object->width_units); - print '
'.$langs->trans("Height").''; - print ' '; - print $formproduct->select_measuring_units("sizeheight_units","size", $object->height_units); - print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print 'x'; + print 'x'; + print ' '; + print $formproduct->select_measuring_units("size_units", "size", $object->length_units); + print '
'.$langs->trans("Volume").''; - print ' '; - print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); - print '
'.$langs->trans("Volume").''; + print ' '; + print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); + print '
'.$langs->trans("Length").''; - if ($object->length != '') + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + if ($object->length != '' || $object->width != '' || $object->height != '') { - print $object->length." ".measuring_units_string($object->length_units,"size"); + print $object->length; + if ($object->width) print " x ".$object->width; + if ($object->height) print " x ".$object->height; + print ' '.measuring_units_string($object->length_units,"size"); } else { print ' '; } print "
'.$langs->trans("Width").''; - if ($object->width != '') { - print $object->width." ".measuring_units_string($object->width_units,"size"); - } - else - print ' '; - print "
'.$langs->trans("Height").''; - if ($object->height != '') { - print $object->height." ".measuring_units_string($object->height_units,"size"); - } - else - print ' '; - print "
'.$langs->trans("Volume").''; - if ($object->volume != '') + if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - print $object->volume." ".measuring_units_string($object->volume_units,"volume"); + // Volume + print '
'.$langs->trans("Volume").''; + if ($object->volume != '') + { + print $object->volume." ".measuring_units_string($object->volume_units,"volume"); + } + else + { + print ' '; + } + print "
'.$langs->trans("Bank").'
'.$langs->trans("BankCode").'
'.$langs->trans("DeskCode").'
'.$langs->trans("BankCode").'
'.$langs->trans("BankAccountNumber").'
'.$langs->trans("BankAccountNumberKey").'
'.$langs->trans("BankAccountDomiciliation").''; print '