From e572ca69c1fed2e6f19a93c72c3e4c7cbcbd8389 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 16:43:00 +0100 Subject: [PATCH 001/162] Update stripe version api for payment intent --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index fb0ef25f8bd..a0234d3c9a2 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2018-11-08"); // force version API +\Stripe\Stripe::setApiVersion("2018-02-11"); // force version API From e8a6b64b6b2957aa37b0f37cf0e02aba78265d88 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 16:50:05 +0100 Subject: [PATCH 002/162] Update config.php --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index a0234d3c9a2..aa5d5889d94 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2018-02-11"); // force version API +\Stripe\Stripe::setApiVersion("2019-02-11"); // force version API From 665174f9aaaba9af4101465156bf56b11741b565 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 19:55:06 +0100 Subject: [PATCH 003/162] Update config.php --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index aa5d5889d94..3b0e5ba9f6e 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-02-11"); // force version API +\Stripe\Stripe::setApiVersion("2019-02-19"); // force version API From 9da734569dcd6a4d76d2a51ed5842293a361581a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 15 Mar 2019 12:34:21 +0100 Subject: [PATCH 004/162] Update config.php --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 3b0e5ba9f6e..5638a10d332 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-02-19"); // force version API +\Stripe\Stripe::setApiVersion("2019-03-14"); // force version API From aa28079e789df1c306aa3702029fd2761b7a1f27 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 12:42:31 +0100 Subject: [PATCH 005/162] NEW morphy value in member type add value: mor / phy / both(aka null) --- htdocs/adherents/type.php | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 72ea99ff18d..31ce9768de1 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,10 +1,11 @@ +/* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2019 Thibault Foucart * * 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 @@ -57,6 +58,7 @@ if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="d.lastname"; } $label=GETPOST("label", "alpha"); +$morphy=GETPOST("morphy","alpha"); $statut=GETPOST("statut", "int"); $subscription=GETPOST("subscription", "int"); $vote=GETPOST("vote", "int"); @@ -103,6 +105,7 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); + $object->morphy = trim($morphy); $object->statut = (int) $statut; $object->subscription = (int) $subscription; $object->note = trim($comment); @@ -157,6 +160,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->oldcopy = clone $object; $object->label = trim($label); + $object->morphy = trim($morphy); $object->statut = (int) $statut; $object->subscription = (int) $subscription; $object->note = trim($comment); @@ -215,7 +219,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') { //dol_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut, d.morphy"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -256,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; + print ''.$langs->trans("Nature").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("VoteAllowed").''; print ''.$langs->trans("Status").''; @@ -277,6 +282,11 @@ if (! $rowid && $action != 'create' && $action != 'edit') //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' print ''; print ''.dol_escape_htmltag($objp->label).''; + print ''; + if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } + elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } + else print $langs->trans("Physical & Morale"); + print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; print ''; @@ -330,6 +340,14 @@ if ($action == 'create') print ''.$langs->trans("Status").''; print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1); print ''; + + // Morphy + $morphys[""] = $langs->trans("Physical & Morale"); + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Morale"); + print ''.$langs->trans("Nature").''; + print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); + print ""; print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", 1, 1); @@ -411,6 +429,10 @@ if ($rowid > 0) print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased"); } print ''; + + // Morphy + print ''.$langs->trans("Nature").''.$object->getmorphylib().''; + print ''; print ''.$langs->trans("SubscriptionRequired").''; print yn($object->subscription); @@ -751,6 +773,14 @@ if ($rowid > 0) print ''.$langs->trans("Status").''; print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); print ''; + + // Morphy + $morphys[""] = $langs->trans("Physical & Morale"); + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Morale"); + print ''.$langs->trans("Nature").''; + print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); + print ""; print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", $object->subscription, 1); From 2e9badd21db0ac0a096c7e796d6fda2cca29a813 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 12:45:33 +0100 Subject: [PATCH 006/162] Update api_memberstypes.class.php --- htdocs/adherents/class/api_memberstypes.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index abfaf84993d..519a0cecfb3 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -79,6 +79,7 @@ class MembersTypes extends DolibarrApi * * @param string $sortfield Sort field * @param string $sortorder Sort order + * @param string $nature Nature of type phy, mor or both (for only both not mor or phy only) * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')" @@ -86,7 +87,7 @@ class MembersTypes extends DolibarrApi * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $nature = 'all', $limit = 100, $page = 0, $sqlfilters = '') { global $db, $conf; @@ -100,6 +101,15 @@ class MembersTypes extends DolibarrApi $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; + // Nature + if ($nature != 'all') { + if ($nature == 'both') { + $sql.= ' AND t.morphy IS NULL '; + } else { + $sql.= ' AND (t.morphy IS NULL OR t.morphy = "'.$nature.'")'; + } + } + // Add sql filters if ($sqlfilters) { From fa302db84fff94f565c947a109e1ab27122b4bda Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 12:48:18 +0100 Subject: [PATCH 007/162] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 65085caf42a..9c7fcfc5baa 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -1,8 +1,9 @@ +/* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2019 Thibault Foucart * * 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 @@ -64,6 +65,11 @@ class AdherentType extends CommonObject * @var string Adherent type label */ public $label; + + /** + * @var string Adherent type nature + */ + public $morphy; /** * @var int Subsription required (0 or 1) @@ -184,6 +190,7 @@ class AdherentType extends CommonObject $sql.= "SET "; $sql.= "statut = ".$this->statut.","; $sql.= "libelle = '".$this->db->escape($this->label) ."',"; + $sql.= "morphy = '".$this->db->escape($this->morphy) ."',"; $sql.= "subscription = '".$this->db->escape($this->subscription)."',"; $sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "vote = ".(integer) $this->db->escape($this->vote).","; @@ -274,7 +281,7 @@ class AdherentType extends CommonObject */ public function fetch($rowid) { - $sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -290,6 +297,7 @@ class AdherentType extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->label = $obj->label; + $this->morphy = $obj->morphy; $this->statut = $obj->statut; $this->subscription = $obj->subscription; $this->mail_valid = $obj->mail_valid; From 63ad6b779ace4dad5ef242c8cdf72df2877ecc41 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 12:49:26 +0100 Subject: [PATCH 008/162] Update llx_adherent_type.sql --- htdocs/install/mysql/tables/llx_adherent_type.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql index 88867f9d2ad..084d0457941 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type.sql @@ -29,6 +29,7 @@ create table llx_adherent_type tms timestamp, statut smallint NOT NULL DEFAULT 0, libelle varchar(50) NOT NULL, + morphy varchar(3) NOT NULL, subscription varchar(3) NOT NULL DEFAULT 'yes', vote varchar(3) NOT NULL DEFAULT 'yes', note text, From 3723da43ca6c509bcf83d8861360eac27df33871 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 12:50:16 +0100 Subject: [PATCH 009/162] Update 9.0.0-10.0.0.sql --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index f75c618612d..5b16aa18151 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -84,6 +84,7 @@ create table llx_mailing_unsubscribe ALTER TABLE llx_mailing_unsubscribe ADD UNIQUE uk_mailing_unsubscribe(email, entity, unsubscribegroup); ALTER TABLE llx_adherent ADD gender VARCHAR(10); +ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3); ALTER TABLE llx_subscription ADD fk_type integer; -- Add url_id into unique index of bank_url From 7a84cb1fc8e0153d486f5661c7c1f556c3ea013a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 14:03:37 +0100 Subject: [PATCH 010/162] Update type.php --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 31ce9768de1..9a241c027ab 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -58,7 +58,7 @@ if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="d.lastname"; } $label=GETPOST("label", "alpha"); -$morphy=GETPOST("morphy","alpha"); +$morphy=GETPOST("morphy", "alpha"); $statut=GETPOST("statut", "int"); $subscription=GETPOST("subscription", "int"); $vote=GETPOST("vote", "int"); From 22ea6fa0ab56e5bd7ac0ff9084938fac5e06e1f7 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Mar 2019 14:04:13 +0100 Subject: [PATCH 011/162] Update api_memberstypes.class.php --- htdocs/adherents/class/api_memberstypes.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 519a0cecfb3..c80a3c3fe6c 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -101,13 +101,13 @@ class MembersTypes extends DolibarrApi $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; - // Nature + // Nature if ($nature != 'all') { if ($nature == 'both') { $sql.= ' AND t.morphy IS NULL '; } else { - $sql.= ' AND (t.morphy IS NULL OR t.morphy = "'.$nature.'")'; - } + $sql.= ' AND (t.morphy IS NULL OR t.morphy = "'.$nature.'")'; + } } // Add sql filters From 2da9cfbbe45404482dd208c32aa8c349acd7987c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 1 Apr 2019 20:25:37 +0200 Subject: [PATCH 012/162] Update api_memberstypes.class.php --- htdocs/adherents/class/api_memberstypes.class.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index c80a3c3fe6c..1b477fd567c 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -79,7 +79,6 @@ class MembersTypes extends DolibarrApi * * @param string $sortfield Sort field * @param string $sortorder Sort order - * @param string $nature Nature of type phy, mor or both (for only both not mor or phy only) * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')" @@ -87,7 +86,7 @@ class MembersTypes extends DolibarrApi * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $nature = 'all', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { global $db, $conf; @@ -100,15 +99,6 @@ class MembersTypes extends DolibarrApi $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; - - // Nature - if ($nature != 'all') { - if ($nature == 'both') { - $sql.= ' AND t.morphy IS NULL '; - } else { - $sql.= ' AND (t.morphy IS NULL OR t.morphy = "'.$nature.'")'; - } - } // Add sql filters if ($sqlfilters) From abd8dca3eac7f4e56cf845a8a78e4ce42fc2e6be Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 1 Apr 2019 20:26:04 +0200 Subject: [PATCH 013/162] Update api_memberstypes.class.php --- htdocs/adherents/class/api_memberstypes.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 1b477fd567c..abfaf84993d 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -99,7 +99,7 @@ class MembersTypes extends DolibarrApi $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; - + // Add sql filters if ($sqlfilters) { From 3d5006f8fc4ad6d86ec1cb1c01a6f2057c0e059f Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Fri, 12 Apr 2019 09:51:01 +0200 Subject: [PATCH 014/162] FIX Cursor pointer in payment screen for autofill --- htdocs/theme/eldy/style.css.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c1ef12c1b2d..2775bae8470 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3196,6 +3196,10 @@ table.tableforservicepart1:first-of-type tr:first-of-type td { table.tableforservicepart1 tr td { border-top: 0px; } +// Payment Screen : Pointer cursor in the autofill image +table.noborder .AutoFillAmout { + cursor:pointer; +} .paymenttable, .margintable { /*border-top-width: px !important; @@ -3212,6 +3216,8 @@ table.tableforservicepart1 tr td { height: 22px; } + + /* Disable shadows */ .noshadow { -webkit-box-shadow: 0px 0px 0px #DDD !important; From c1ecfae6f245aa47631677bdf78be03cc9d41b42 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 13 Apr 2019 22:46:40 +0200 Subject: [PATCH 015/162] FIX: Update on fiscal year --- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/core/class/fiscalyear.class.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 16c5b508b1c..df2dec9d3b1 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -154,7 +154,7 @@ if ($result) $i++; } } else { - print '' . $langs->trans("None") . ''; + print '' . $langs->trans("None") . ''; } print ''; print ''; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 5c6a5b4cf4d..5593b4a90a4 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -195,7 +195,6 @@ class Fiscalyear extends CommonObject $sql .= ", date_start = '".$this->db->idate($this->date_start)."'"; $sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null"); $sql .= ", statut = '".$this->db->escape($this->statut?$this->statut:0)."'"; - $sql .= ", datec = " . ($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null'); $sql .= ", fk_user_modif = " . $user->id; $sql .= " WHERE rowid = ".$this->id; From 2829bfc84f2677d2c2222ce3f17f0086a9994559 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Sun, 14 Apr 2019 17:11:38 +0100 Subject: [PATCH 016/162] fix:Select chart plan from active countries only --- htdocs/accountancy/admin/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 089c156eb04..62de1c34a63 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -259,7 +259,7 @@ if ($resql) $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON a.fk_country = c.rowid"; - $sql .= " WHERE a.active = 1"; + $sql .= " WHERE a.active = 1 AND c.active = 1"; dol_syslog('accountancy/admin/account.php $sql='.$sql); print $sql; $resqlchart = $db->query($sql); From d4a7c0abc6d84844e6680d2887d8b824b89c54ec Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 15 Apr 2019 10:05:46 +0200 Subject: [PATCH 017/162] FIX : Wrong variable name --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 3e7fb384011..993692a77e5 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -296,7 +296,7 @@ if ($search_firstname) $sql.= natural_search('p.firstname', $search if ($search_societe) $sql.= natural_search('s.nom', $search_societe); if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); -if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); +if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro); if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile); if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); From 93365addd1f684400a925058a23206cec7c38ec6 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 15 Apr 2019 11:38:49 +0200 Subject: [PATCH 018/162] FIX : Total per day shows 00:00 if the total time spent is equal to 12:00 --- htdocs/core/js/timesheet.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index aaec6971e2f..4eae63154d4 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -91,17 +91,11 @@ function parseTime(timeStr, dt) dt = new Date(); } - var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i); + var time = timeStr.match(/(\d+)(?::(\d\d))?/i); if (!time) { return -1; } var hours = parseInt(time[1], 10); - if (hours == 12 && !time[3]) { - hours = 0; - } - else { - hours += (hours < 12 && time[3]) ? 12 : 0; - } dt.setHours(hours); dt.setMinutes(parseInt(time[2], 10) || 0); From 8d6e6e115dd7f7df3738dd858766fff8cc806548 Mon Sep 17 00:00:00 2001 From: Xebax Date: Mon, 15 Apr 2019 12:39:02 +0200 Subject: [PATCH 019/162] NEW REST API: get the list of objects in a category. --- .../categories/class/api_categories.class.php | 68 ++++++++++++++++++- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index c975236f930..9b59e1f001b 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -15,10 +15,15 @@ * along with this program. If not, see . */ - use Luracast\Restler\RestException; +use Luracast\Restler\RestException; - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/adherents/class/api_members.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/api_products.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/api_contacts.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparties.class.php'; /** * API class for categories @@ -335,4 +340,61 @@ class Categories extends DolibarrApi } return $category; } + + /** + * Get the list of objects in a category. + * + * @param int $id ID of category + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param int $onlyids Return only ids of objects (consume less memory) + * + * @return mixed + * + * @url GET {id}/objects + */ + public function getObjects($id, $type, $onlyids = 0) + { + dol_syslog("getObjects($id, $type, $onlyids)", LOG_DEBUG); + + if (! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + if (empty($type)) + { + throw new RestException(500, 'The "type" parameter is required.'); + } + + $result = $this->category->fetch($id); + if (! $result) { + throw new RestException(404, 'category not found'); + } + + if (! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->category->getObjectsInCateg($type, $onlyids); + + if ($result < 0) { + throw new RestException(503, 'Error when retrieving objects list : '.$this->category->error); + } + + $objects = $result; + $cleaned_objects = array(); + if ($type == 'member') { + $objects_api = new Members(); + } elseif ($type == 'customer' || $type == 'supplier') { + $objects_api = new Thirdparties(); + } elseif ($type == 'product') { + $objects_api = new Products(); + } elseif ($type == 'contact') { + $objects_api = new Contacts(); + } + foreach ($objects as $obj) { + $cleaned_objects[] = $objects_api->_cleanObjectDatas($obj); + } + + return $cleaned_objects; + } } From 2bc93b9748604e474ee7d0f0e6421c424f996746 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 16 Apr 2019 16:09:16 +0200 Subject: [PATCH 020/162] NEW public note and private note in contact list sall --- htdocs/contact/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index c8014e900b9..246fd172dc7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -146,6 +146,8 @@ $fieldstosearchall = array( 'p.email'=>'EMail', 's.nom'=>"ThirdParty", 'p.phone'=>"Phone", + 'p.note_public'=>"NotePublic", + 'p.note_private'=>"NotePrivate", ); // Definition of fields for list From bef38c9abe4bd035d3651d3eedefca60878b4665 Mon Sep 17 00:00:00 2001 From: AXeL-dev Date: Wed, 17 Apr 2019 00:33:49 +0100 Subject: [PATCH 021/162] debugbar module class: remove unreached part of code (may generate errors on call) --- htdocs/core/modules/modDebugBar.class.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php index cef0ae2d1ad..8d51a102251 100644 --- a/htdocs/core/modules/modDebugBar.class.php +++ b/htdocs/core/modules/modDebugBar.class.php @@ -1,5 +1,7 @@ + * + * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. @@ -103,19 +105,4 @@ class modDebugBar extends DolibarrModules return $this->_init($sql, $options); } - - /** - * Function called after module configuration. - * - * @return void - */ - public function loadSettings() - { - $this->addPermission("use", "UseDebugBar", "u"); - - $this->enableHooks(array( - 'main', - 'login' - )); - } } From f412ce6a9cdd2a02ea870496ebd61baceaece834 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 17 Apr 2019 10:49:39 +0200 Subject: [PATCH 022/162] fix #11023 --- htdocs/comm/propal/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 01c28fdcd31..355232a65af 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -759,6 +759,7 @@ if (empty($reshook)) $qty = GETPOST('qty' . $predef); $remise_percent = GETPOST('remise_percent' . $predef); + if (empty($remise_percent)) $remise_percent=0; // Extrafields $extrafieldsline = new ExtraFields($db); From cb7f9c2b6f26bc2f40bcced32f97553f8eab2b71 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Wed, 17 Apr 2019 14:28:14 +0200 Subject: [PATCH 023/162] NEW filter by thirdparty on report CA by prod/serv --- htdocs/compta/stats/cabyprodserv.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index cb8a3cc451d..a7998fa9e23 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -51,6 +51,7 @@ if (! $sortfield) $sortfield="ref"; // Category $selected_cat = (int) GETPOST('search_categ', 'int'); +$selected_soc = (int) GETPOST('search_soc', 'int'); $subcat = false; if (GETPOST('subcat', 'alpha') === 'yes') { $subcat = true; @@ -137,6 +138,7 @@ $headerparams['q'] = $q; $tableparams = array(); $tableparams['search_categ'] = $selected_cat; +$tableparams['search_soc'] = $selected_soc; $tableparams['search_type'] = $selected_type; $tableparams['subcat'] = ($subcat === true)?'yes':''; @@ -225,7 +227,9 @@ if ($modecompta == 'CREANCES-DETTES') $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,"; $sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,"; $sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; + if($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)"; + $sql.= ",".MAIN_DB_PREFIX."facturedet as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; if ($selected_cat === -2) // Without any category { @@ -259,6 +263,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= ")"; $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } + if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type"; $sql.= $db->order($sortfield, $sortorder); @@ -313,6 +318,10 @@ if ($modecompta == 'CREANCES-DETTES') print ' '; print $langs->trans("Type"). ': '; $form->select_type_of_lines(isset($selected_type)?$selected_type:-1, 'search_type', 1, 1, 1); + + //select thirdparty + print '
'; + print $langs->trans("ThirdParty") . ': ' . $form->select_thirdparty_list($selected_soc, 'search_soc','',1); print ''; print ''; From 32b703e6c5f04f9aaf6e2defca98c6b1f1d7142c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Apr 2019 09:33:47 +0200 Subject: [PATCH 024/162] Update myobject_list.php --- htdocs/modulebuilder/template/myobject_list.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 8cae415c6e1..0e580d7bc65 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -59,7 +59,12 @@ if (! $res) die("Include of main fails"); require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -dol_include_once('/mymodule/class/myobject.class.php'); + +// load mymodule libraries +require_once 'class/myobject.class.php'; + +// for other modules +//dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page $langs->loadLangs(array("mymodule@mymodule","other")); From 2b6cdd2e336165410a2ea643efc286d5bcfc529b Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 18 Apr 2019 10:01:05 +0200 Subject: [PATCH 025/162] Fix workfolow module launch trigger on order close --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 157088d24db..9aa20f8854e 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -307,7 +307,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $diff_array=array_diff_assoc($qtyordred,$qtyshipped); if (count($diff_array)==0) { //No diff => mean everythings is shipped - $ret=$object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin); + $ret=$object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); if ($ret<0) { $this->error=$object->error; $this->errors=$object->errors; return $ret; From 4912c69d8af6f18a4ad53bde4243589e3ed4ad81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Apr 2019 10:12:00 +0200 Subject: [PATCH 026/162] Update functions2.lib.php --- 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 45fea25224b..89c945d5ef4 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2496,7 +2496,7 @@ function autoOrManual($automaticmanual, $case = 1, $color = 0) /** * Convert links to local wrapper to medias files into a string into a public external URL readable on internet - * + * * @param string $notetoshow Text to convert * @return string String */ @@ -2504,7 +2504,7 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow) { global $dolibarr_main_url_root; // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $notetoshow=preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow); From 5dbf31d97575735ad1b70ad775b7e0ddb892baf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Apr 2019 10:19:14 +0200 Subject: [PATCH 027/162] Update myobject_list.php --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 0e580d7bc65..4035b82328d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -61,7 +61,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // load mymodule libraries -require_once 'class/myobject.class.php'; +require_once __DIR__ . '/class/myobject.class.php'; // for other modules //dol_include_once('/othermodule/class/otherobject.class.php'); From 0855d84ccf4ace8789cda320daa683faf5b0cba6 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 18 Apr 2019 10:40:34 +0200 Subject: [PATCH 028/162] FIX error messages not displayed --- htdocs/compta/facture/card.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cc58f1e6dec..10a8296c144 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1537,14 +1537,16 @@ if (empty($reshook)) $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error++; - $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '
'; + $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date")); + setEventMessages($mesg, null, 'errors'); } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); if (!($_POST['situations'] > 0)) { $error++; - $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '
'; + $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")); + setEventMessages($mesg, null, 'errors'); } if (!$error) { @@ -2270,11 +2272,13 @@ if (empty($reshook)) if (!$object->fetch($id) > 0) dol_print_error($db); if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") { + $all_progress = GETPOST('all_progress', 'int'); foreach ($object->lines as $line) { $percent = $line->get_prev_progress($object->id); - if (GETPOST('all_progress') < $percent) { - $mesg = '
' . $langs->trans("CantBeLessThanMinPercent") . '
'; + if (floatval($all_progress) < floatval($percent)) { + $mesg = $langs->trans("Line") . ' ' . $i . ' '. $line->ref .' : ' . $langs->trans("CantBeLessThanMinPercent"); + setEventMessages($mesg, null, 'warnings'); $result = -1; } else $object->update_percent($line, $_POST['all_progress']); From 3729e32368c47759eb5e0ff46ceddf36354b2704 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 18 Apr 2019 14:13:48 +0200 Subject: [PATCH 029/162] Assets - Debug - Look & field v10 --- htdocs/asset/list.php | 10 ++++++++- htdocs/asset/type.php | 10 ++++++++- htdocs/core/menus/init_menu_auguria.sql | 20 +++++++++-------- htdocs/core/menus/standard/eldy.lib.php | 8 +++---- htdocs/core/modules/modAsset.class.php | 30 ++++++++++++++++--------- htdocs/langs/en_US/assets.lang | 8 ++++++- 6 files changed, 60 insertions(+), 26 deletions(-) diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index dc2ce9dddf6..029b5334d55 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -295,6 +295,14 @@ if ($user->rights->asset->delete) $arrayofmassactions['predelete']='selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->asset->write) +{ + $newcardbutton=''.$langs->trans('NewAsset').''; + $newcardbutton.= ''; + $newcardbutton.= ''; +} + print '
'; if ($optioncss != '') print ''; print ''; @@ -305,7 +313,7 @@ print ''; print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); // Add code for pre mass action (confirmation or email presend form) $topicmail="SendAssetsRef"; diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 9f11889185f..303d05b298b 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -220,6 +220,14 @@ if (! $rowid && $action != 'create' && $action != 'edit') $param = ''; + $newcardbutton=''; + if ($user->rights->asset->configurer) + { + $newcardbutton=''.$langs->trans('NewAssetType').''; + $newcardbutton.= ''; + $newcardbutton.= ''; + } + print ''; if ($optioncss != '') print ''; print ''; @@ -229,7 +237,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; - print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); $moreforfilter = ''; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index fe4f7e3c17a..3a4ec85ec58 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -5,16 +5,16 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; --- +-- -- table llx_menu --- +-- insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|assets', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->accounting->assets', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->assets->read', '', 2, 54, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); @@ -238,8 +238,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 2200__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'MenuVariousPayment', 1, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/card.php?mainmenu=billing&leftmenu=tax_various&action=create', 'New', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); --- Accounting Expert -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accountancy', 9__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); +-- Accounting (Double entries) +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accountancy', 9__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', 0, 'main', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); -- Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__); @@ -299,10 +299,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2715__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2716__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -- Assets -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled', __HANDLER__, 'left', 3000__+MAX_llx_menu__, 'accountancy', 'assets', 10__+MAX_llx_menu__, '/assets/list.php?mainmenu=accountancy&leftmenu=assets', 'MenuAssets', 0, 'assets', '$user->rights->assets->read', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'accountancy', '', 3000__+MAX_llx_menu__, '/assets/card.php?mainmenu=accountancy&leftmenu=assets&action=create', 'MenuNewAsset', 1, 'assets', '$user->rights->assets->write', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 3002__+MAX_llx_menu__, 'accountancy', '', 3000__+MAX_llx_menu__, '/assets/type.php?mainmenu=accountancy&leftmenu=assets&action=create', 'MenuTypeAssets', 1, 'assets', '$user->rights->assets->write', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 3003__+MAX_llx_menu__, 'accountancy', '', 3000__+MAX_llx_menu__, '/assets/list.php?mainmenu=accountancy&leftmenu=assets', 'MenuListAssets', 1, 'assets', '$user->rights->assets->read', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled', __HANDLER__, 'left', 3000__+MAX_llx_menu__, 'accountancy', 'asset', 9__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&leftmenu=asset', 'MenuAssets', 1, 'assets', '$user->rights->asset->read', '', 0, 20, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/card.php?mainmenu=accountancy&leftmenu=asset&action=create', 'MenuNewAsset', 2, 'assets', '$user->rights->asset->write', '', 0, 21, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3003__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&leftmenu=asset', 'MenuListAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 22, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 23, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->configurer', '', 0, 24, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '$user->rights->asset->read', '', 0, 25, __ENTITY__); -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7491556bebd..d5e93ce5119 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -349,7 +349,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $tmpentry = array( 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), - 'comptabilite|accounting', + 'comptabilite|accounting|asset', ), $listofmodulesforexternal ), @@ -1184,7 +1184,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM { $langs->load("companies"); - // Accounting Expert + // Accounting (Double entries) if (! empty($conf->accounting->enabled)) { $langs->load("accountancy"); @@ -1409,11 +1409,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM { $langs->load("assets"); $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset'); - $newmenu->add("/asset/card.php?action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); + $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) { - $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->write); + $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->configurer); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read); } } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index d856ad05091..fea437ec1c0 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -46,8 +46,6 @@ class modAsset extends DolibarrModules // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). $this->numero = 51000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module - // Key text used to identify module (for permissions, menus, etc...) - $this->rights_class = 'asset'; // Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other' // It is used to group modules by family in module setup page @@ -184,30 +182,42 @@ class modAsset extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $this->rights_class = 'asset'; + $r=0; - $r=0; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $r++; + $this->rights[$r][0] = 51001; // Permission id (must not be already used) $this->rights[$r][1] = 'Read assets'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][2] = r; + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][0] = 51002; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/Update assets'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][2] = w; + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][0] = 51003; // Permission id (must not be already used) $this->rights[$r][1] = 'Delete assets'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][2] = d; + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) + $r++; + $this->rights[$r][0] = 51005; // Permission id (must not be already used) + $this->rights[$r][1] = 'Setup types of asset'; // Permission label + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'configurer'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) - // Main menu entries + // Main menu entries $this->menu = array(); // List of menus to add $r=0; diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang index 293d9b205f6..53c0634cef9 100644 --- a/htdocs/langs/en_US/assets.lang +++ b/htdocs/langs/en_US/assets.lang @@ -55,5 +55,11 @@ MenuAssets = Assets MenuNewAsset = New asset MenuTypeAssets = Type assets MenuListAssets = List -MenuNewTypeAssets = New type +MenuNewTypeAssets = New MenuListTypeAssets = List + +# +# Module +# +NewAssetType=New asset type +NewAsset=New asset From 315349a681cea0f7a06dfd63bc65307fd7716435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Apr 2019 18:41:02 +0200 Subject: [PATCH 030/162] replace @public by @var --- .../core/modules/bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/core/modules/barcode/doc/phpbarcode.modules.php | 2 +- .../core/modules/barcode/doc/tcpdfbarcode.modules.php | 2 +- .../modules/barcode/mod_barcode_product_standard.php | 2 +- htdocs/core/modules/bom/mod_bom_advanced.php | 2 +- htdocs/core/modules/bom/mod_bom_standard.php | 2 +- htdocs/core/modules/cheque/mod_chequereceipt_mint.php | 2 +- htdocs/core/modules/cheque/mod_chequereceipt_thyme.php | 2 +- .../core/modules/commande/doc/pdf_einstein.modules.php | 4 ++-- htdocs/core/modules/commande/mod_commande_marbre.php | 2 +- htdocs/core/modules/commande/mod_commande_saphir.php | 2 +- .../core/modules/contract/doc/pdf_strato.modules.php | 2 +- htdocs/core/modules/contract/mod_contract_magre.php | 2 +- htdocs/core/modules/contract/mod_contract_olive.php | 2 +- htdocs/core/modules/contract/mod_contract_serpis.php | 2 +- .../modules/expedition/doc/pdf_espadon.modules.php | 2 +- .../core/modules/expedition/doc/pdf_merou.modules.php | 2 +- .../core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- .../core/modules/expedition/mod_expedition_ribera.php | 2 +- .../core/modules/expedition/mod_expedition_safor.php | 2 +- .../modules/expensereport/mod_expensereport_jade.php | 2 +- .../modules/expensereport/mod_expensereport_sand.php | 2 +- htdocs/core/modules/export/export_csv.modules.php | 2 +- htdocs/core/modules/export/export_excel.modules.php | 2 +- .../core/modules/export/export_excel2007.modules.php | 2 +- .../modules/export/export_excel2007new.modules.php | 2 +- htdocs/core/modules/export/export_tsv.modules.php | 2 +- htdocs/core/modules/facture/mod_facture_mars.php | 2 +- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- htdocs/core/modules/fichinter/mod_arctic.php | 2 +- htdocs/core/modules/fichinter/mod_pacific.php | 2 +- htdocs/core/modules/holiday/mod_holiday_immaculate.php | 2 +- htdocs/core/modules/holiday/mod_holiday_madonna.php | 2 +- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/import/modules_import.php | 2 +- htdocs/core/modules/livraison/mod_livraison_jade.php | 2 +- htdocs/core/modules/livraison/mod_livraison_saphir.php | 2 +- htdocs/core/modules/payment/mod_payment_ant.php | 2 +- htdocs/core/modules/payment/mod_payment_cicada.php | 2 +- .../core/modules/product/mod_codeproduct_elephant.php | 2 +- .../core/modules/product/mod_codeproduct_leopard.php | 2 +- htdocs/core/modules/project/mod_project_simple.php | 2 +- htdocs/core/modules/project/mod_project_universal.php | 2 +- .../project/task/doc/doc_generic_task_odt.modules.php | 2 +- htdocs/core/modules/project/task/mod_task_simple.php | 2 +- .../core/modules/project/task/mod_task_universal.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 10 +++++----- htdocs/core/modules/propale/mod_propale_marbre.php | 2 +- htdocs/core/modules/propale/mod_propale_saphir.php | 2 +- .../core/modules/societe/mod_codeclient_elephant.php | 2 +- htdocs/core/modules/societe/mod_codeclient_leopard.php | 2 +- htdocs/core/modules/societe/mod_codeclient_monkey.php | 2 +- .../core/modules/societe/mod_codecompta_aquarium.php | 2 +- htdocs/core/modules/societe/mod_codecompta_panicum.php | 2 +- .../mod_facture_fournisseur_cactus.php | 2 +- .../supplier_invoice/mod_facture_fournisseur_tulip.php | 2 +- .../supplier_order/mod_commande_fournisseur_muguet.php | 2 +- .../mod_commande_fournisseur_orchidee.php | 2 +- .../supplier_payment/mod_supplier_payment_brodator.php | 2 +- .../supplier_payment/mod_supplier_payment_bronan.php | 2 +- .../supplier_proposal/mod_supplier_proposal_marbre.php | 2 +- .../supplier_proposal/mod_supplier_proposal_saphir.php | 2 +- htdocs/core/modules/ticket/mod_ticket_simple.php | 2 +- htdocs/core/modules/ticket/mod_ticket_universal.php | 2 +- 65 files changed, 70 insertions(+), 70 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index bbd5858192c..1c10871eae1 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -43,7 +43,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index 19744177e40..96cf345ff09 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -34,7 +34,7 @@ class modPhpbarcode extends ModeleBarCode { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index 17793a5dfd4..1b39fe16095 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -33,7 +33,7 @@ class modTcpdfbarcode extends ModeleBarCode { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 516df2ee6ef..b5f0e76ef3f 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -45,7 +45,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index f6492b3c78f..594df7e31de 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -35,7 +35,7 @@ class mod_bom_advanced extends ModeleNumRefboms { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 00a20898712..39af3ecc7e1 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -31,7 +31,7 @@ class mod_bom_standard extends ModeleNumRefboms { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 0183300c4ad..0169ce04a70 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -31,7 +31,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 7ec2a775b96..d65273bd16b 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -32,7 +32,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e076245f3be..9d73384cf3a 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -75,7 +75,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; @@ -379,7 +379,7 @@ class pdf_einstein extends ModelePDFCommandes complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - + $pdf->SetFont('', '', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 620ab210f31..28d488eb6fb 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -31,7 +31,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index fbe741ac2f8..311fd034bbd 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -35,7 +35,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e592e893437..03dae9cbe5e 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -68,7 +68,7 @@ class pdf_strato extends ModelePDFContract /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 97f07b677dd..4a7b73cc145 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -31,7 +31,7 @@ class mod_contract_magre extends ModelNumRefContracts { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index d87e383d109..612c13cf99c 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -54,7 +54,7 @@ class mod_contract_olive extends ModelNumRefContracts /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index e62386fbca7..dd468402585 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -30,7 +30,7 @@ class mod_contract_serpis extends ModelNumRefContracts { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index f84afc7e55c..87f04dca016 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -64,7 +64,7 @@ class pdf_espadon extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index be4a25a1a7d..8696bc21a02 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -65,7 +65,7 @@ class pdf_merou extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 3b3d79adb92..e8de6ffdb73 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -64,7 +64,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index fd2a5b5612c..cc7fb98baec 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -31,7 +31,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 4cfada1740c..08e0268ef7e 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -30,7 +30,7 @@ class mod_expedition_safor extends ModelNumRefExpedition { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index a878fb1325c..176c3a46dcb 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -30,7 +30,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index b0749462d7e..c0a5aa0a031 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -32,7 +32,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 5bdc2f384ac..79ec096b8de 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -46,7 +46,7 @@ class ExportCsv extends ModeleExports /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 28357c0a09a..5b8accdae1a 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -46,7 +46,7 @@ class ExportExcel extends ModeleExports /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 1b6b973632a..46dc8d8fd53 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -47,7 +47,7 @@ class ExportExcel2007 extends ExportExcel /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 10dbb2fa28c..29b165cb890 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -48,7 +48,7 @@ class ExportExcel2007new extends ModeleExports /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index 33d7d860368..f5b85c6987c 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -45,7 +45,7 @@ class ExportTsv extends ModeleExports /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 0933d38306c..752a80669c5 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -32,7 +32,7 @@ class mod_facture_mars extends ModeleNumRefFactures { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index b6f36f69e9d..8c921d982bf 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -35,7 +35,7 @@ class mod_facture_mercure extends ModeleNumRefFactures { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index db7b2febbb2..1902ffc70af 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -34,7 +34,7 @@ class mod_arctic extends ModeleNumRefFicheinter { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 4f66d6940f1..7d636a8b8e0 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -32,7 +32,7 @@ class mod_pacific extends ModeleNumRefFicheinter { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index 9d1fa644c0a..890c6b933c6 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -32,7 +32,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index 187eb19d80d..d214d8d79dd 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -31,7 +31,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index dbb8fadfe12..6eba74b17e4 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -64,7 +64,7 @@ class ImportCsv extends ModeleImports /** * Dolibarr version of driver - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 44134281fb4..e83e22bd8ca 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -64,7 +64,7 @@ class ImportXlsx extends ModeleImports /** * Dolibarr version of driver - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 7595c3c6c52..d901a53865e 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -56,7 +56,7 @@ class ModeleImports /** * Dolibarr version of driver - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 2241d9ba678..531ff26a354 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -36,7 +36,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index 9fcbff04d6f..f05900600c2 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -33,7 +33,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 2f3114bfd09..21ad0d91b9e 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -32,7 +32,7 @@ class mod_payment_ant extends ModeleNumRefPayments { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index a6cfca7e1df..a6f1eee1ef7 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -31,7 +31,7 @@ class mod_payment_cicada extends ModeleNumRefPayments { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index e7e20db532f..9d41cef78cb 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -56,7 +56,7 @@ class mod_codeproduct_elephant extends ModeleProductCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index a7b03eed2f0..a6242dd336c 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -61,7 +61,7 @@ class mod_codeproduct_leopard extends ModeleProductCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 25553fb19c9..faab6523820 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -33,7 +33,7 @@ class mod_project_simple extends ModeleNumRefProjects { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index be8a9c3f362..d9287109d6e 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -32,7 +32,7 @@ class mod_project_universal extends ModeleNumRefProjects { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 4d2e47f0593..f6da1061c89 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -69,7 +69,7 @@ class doc_generic_task_odt extends ModelePDFTask /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 4632fedec4a..7619c9b6834 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -33,7 +33,7 @@ class mod_task_simple extends ModeleNumRefTask { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index a9dc2846ad6..f08067541e8 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -32,7 +32,7 @@ class mod_task_universal extends ModeleNumRefTask { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 62e268874e8..5a71c060a51 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -74,7 +74,7 @@ class pdf_cyan extends ModelePDFPropales /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'development'; @@ -434,7 +434,7 @@ class pdf_cyan extends ModelePDFPropales complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - + $pdf->startTransaction(); $pdf->SetFont('', '', $default_font_size - 1); @@ -549,11 +549,11 @@ class pdf_cyan extends ModelePDFPropales $pdf->startTransaction(); $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); $pdf->rollbackTransaction(true); - + $iniY = $tab_top + $this->tabTitleHeight + 2; $curY = $tab_top + $this->tabTitleHeight + 2; $nexY = $tab_top + $this->tabTitleHeight + 2; - + // Loop on each lines $pageposbeforeprintlines=$pdf->getPage(); $pagenb = $pageposbeforeprintlines; @@ -1460,7 +1460,7 @@ class pdf_cyan extends ModelePDFPropales $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - + if (empty($hidetop)){ $pdf->line($this->marge_gauche, $tab_top+$this->tabTitleHeight, $this->page_largeur-$this->marge_droite, $tab_top+$this->tabTitleHeight); // line prend une position y en 2eme param et 4eme param } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index 0e03574a3d4..4fba93d7a8d 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -33,7 +33,7 @@ class mod_propale_marbre extends ModeleNumRefPropales { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index ddf856d5003..99c82217a87 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -35,7 +35,7 @@ class mod_propale_saphir extends ModeleNumRefPropales { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 4be4ea5d50e..b4e9f5d5258 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -56,7 +56,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php index c7d204a5010..727d2e09299 100644 --- a/htdocs/core/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php @@ -60,7 +60,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 69ee75911a6..f86be2ed96c 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -54,7 +54,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 1472bd982c7..e9c60b699cc 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -45,7 +45,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index 373e20b8eb6..4c5ffcd66c5 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -44,7 +44,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 8302db4ab31..5b6dee443d9 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -35,7 +35,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 8ab95ab3336..6925278c08e 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -38,7 +38,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 6f0cb59ca89..96dc9fbfd99 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -33,7 +33,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 1d1bc920237..6154ba5e1d9 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -34,7 +34,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 2b29a18e2f0..e2407877a7b 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -32,7 +32,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index e071f8d5505..e01c82cb445 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -31,7 +31,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index 21c2a68e629..db9cec8e2c3 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -33,7 +33,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index d3a9de6c72b..343e16df8ed 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -35,7 +35,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index d121748c285..299c9c6a485 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -32,7 +32,7 @@ class mod_ticket_simple extends ModeleNumRefTicket { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index deb7c4481cc..361ecdd0c9d 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -31,7 +31,7 @@ class mod_ticket_universal extends ModeleNumRefTicket { /** * Dolibarr version of the loaded document - * @public string + * @var string */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' From 83cf08f2eb9ef0d7393f7cbd78d96a4f250da146 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 18 Apr 2019 20:37:27 +0200 Subject: [PATCH 031/162] fix php warning --- htdocs/core/lib/sendings.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 1cafb6dc3d4..6dc78611c26 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -51,7 +51,7 @@ function shipping_prepare_head($object) { // delivery link $object->fetchObjectLinked($object->id,$object->element); - if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery + if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery { // Take first one element of array $tmp = reset($object->linkedObjectsIds['delivery']); From 033e9b9f22c0b29820c677938e8257fe43298a93 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 19 Apr 2019 06:48:51 +0200 Subject: [PATCH 032/162] FIX Accounting Customer dispatch with intra/export --- htdocs/accountancy/customer/list.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index c21388a529a..9928a79f9e1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -215,7 +215,7 @@ $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, $sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql.= " co.code as country_code, co.label as country,"; -$sql.= " s.tva_intra"; +$sql.= " s.tva_intra, s.fk_pays as country_sell"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -440,7 +440,7 @@ if ($result) { $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; - $isinEEC = isInEEC($objp->country_code); + $isinEEC = isInEEC($objp, $country_code_in_EEC); if ($objp->type_l == 1) { $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); @@ -458,12 +458,14 @@ if ($result) { if ($objp->country_sell == '1') { $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; - } elseif ($isinEEC === true) { - $objp->code_sell_p = $objp->code_sell_intra; - $objp->aarowid_suggest = $objp->aarowid_intra; } else { - $objp->code_sell_p = $objp->code_sell_export; - $objp->aarowid_suggest = $objp->aarowid_export; + if ($isinEEC == true) { + $objp->code_sell_p = $objp->code_sell_intra; + $objp->aarowid_suggest = $objp->aarowid_intra; + } else { + $objp->code_sell_p = $objp->code_sell_export; + $objp->aarowid_suggest = $objp->aarowid_export; + } } if (! empty($objp->code_sell)) { From 6cfdfe8408b2620bc59ef99427024921c45667c7 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Fri, 19 Apr 2019 10:55:33 +0200 Subject: [PATCH 033/162] NEW : Can update product supplier price ref --- htdocs/product/fournisseurs.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2fcb54d43f0..cc922cb724b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -149,6 +149,8 @@ if (empty($reshook)) if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); $ref_fourn=GETPOST("ref_fourn"); if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); + $ref_fourn_old=GETPOST("ref_fourn_old"); + if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn; $quantity=GETPOST("qty"); $remise_percent=price2num(GETPOST('remise_percent', 'alpha')); $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; @@ -228,7 +230,7 @@ if (empty($reshook)) if (! $error) { - $ret=$object->add_fournisseur($user, $id_fourn, $ref_fourn, $quantity); // This insert record with no value for price. Values are update later with update_buyprice + $ret=$object->add_fournisseur($user, $id_fourn, $ref_fourn_old, $quantity); // This insert record with no value for price. Values are update later with update_buyprice if ($ret == -3) { $error++; @@ -427,7 +429,6 @@ if ($id > 0 || $ref) $supplier->fetch($socid); print $supplier->getNomUrl(1); print ''; - print ''; print ''; print ''; print ''; @@ -454,7 +455,8 @@ if ($id > 0 || $ref) print ''.$langs->trans("SupplierRef").''; if ($rowid) { - print $object->fourn_ref; + print ''; + print ''; } else { From 265671a5f373a68fe418fe27cda7a3b11b97f416 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 12:00:06 +0200 Subject: [PATCH 034/162] Update list.php --- htdocs/accountancy/customer/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9928a79f9e1..84d7a28a680 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -440,7 +440,7 @@ if ($result) { $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; - $isinEEC = isInEEC($objp, $country_code_in_EEC); + $isinEEC = isInEEC($objp); if ($objp->type_l == 1) { $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); From eab474e23a5e3edee04c64c1640b014c55fbbf8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 12:10:40 +0200 Subject: [PATCH 035/162] Update list.php --- htdocs/accountancy/customer/list.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 84d7a28a680..15515716a6d 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -215,7 +215,7 @@ $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, $sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql.= " co.code as country_code, co.label as country,"; -$sql.= " s.tva_intra, s.fk_pays as country_sell"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -421,6 +421,8 @@ if ($result) { $facture_static = new Facture($db); $product_static = new Product($db); + $isSellerInEEC = isInEEC($mysoc); + while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); @@ -440,7 +442,7 @@ if ($result) { $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; - $isinEEC = isInEEC($objp); + $isBuyerInEEC = isInEEC($objp); if ($objp->type_l == 1) { $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); @@ -455,14 +457,14 @@ if ($result) { } if ($objp->code_sell_l == -1) $objp->code_sell_l=''; - if ($objp->country_sell == '1') { + if ($objp->country_code == $mysoc->country_code) { // If buyer in same country than seller $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; } else { - if ($isinEEC == true) { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale $objp->code_sell_p = $objp->code_sell_intra; $objp->aarowid_suggest = $objp->aarowid_intra; - } else { + } else { // Foreign sale $objp->code_sell_p = $objp->code_sell_export; $objp->aarowid_suggest = $objp->aarowid_export; } From 61428b9c00f79d2d6f8c35d1367a65c784675a3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 12:19:45 +0200 Subject: [PATCH 036/162] Fix use standard product country code if country of buyer not defined --- htdocs/accountancy/customer/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 15515716a6d..4b3906d60da 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -457,7 +457,7 @@ if ($result) { } if ($objp->code_sell_l == -1) $objp->code_sell_l=''; - if ($objp->country_code == $mysoc->country_code) { // If buyer in same country than seller + if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; } else { From 87eb5f5c02083c5e17401dba600c856f9dd7fc05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 12:36:32 +0200 Subject: [PATCH 037/162] Fix filter lost --- htdocs/accountancy/admin/productaccount.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 37ec3c4e503..cad59dc2dde 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -279,7 +279,8 @@ if ($result) if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account); if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid); - + if ($accounting_product_mode) $param.='&accounting_product_mode='.urlencode(accounting_product_mode); + print ''; if ($optioncss != '') print ''; print ''; From cb8f9cc1202f2297436e31464990d3e1c1345529 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 12:37:55 +0200 Subject: [PATCH 038/162] Fix link --- htdocs/accountancy/admin/productaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index cad59dc2dde..7250fff9f43 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -279,7 +279,7 @@ if ($result) if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account); if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid); - if ($accounting_product_mode) $param.='&accounting_product_mode='.urlencode(accounting_product_mode); + if ($accounting_product_mode) $param.='&accounting_product_mode='.urlencode($accounting_product_mode); print ''; if ($optioncss != '') print ''; From ecf3bc6402a59d1c333077595a14e297121ab6c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 13:00:10 +0200 Subject: [PATCH 039/162] Fix phpcs --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 45fea25224b..d7dc7724874 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2504,7 +2504,7 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow) { global $dolibarr_main_url_root; // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $notetoshow=preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow); From 6d34a380423d27f3c9b55d7dbd8ffff190505fb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 13:11:50 +0200 Subject: [PATCH 040/162] Update account.php --- htdocs/accountancy/admin/account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 62de1c34a63..9d4f4b68370 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -258,8 +258,8 @@ if ($resql) print ''; + //print '
'.$buttonsave.'
'; + $texte=$langs->trans("ListOfProductsServices"); - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit); print '
'; print ''; @@ -474,8 +477,8 @@ if ($result) if (atleastoneselected) jQuery("#changeaccount").removeAttr(\'disabled\'); else jQuery("#changeaccount").attr(\'disabled\',\'disabled\'); - if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'butAction\'); - else jQuery("#changeaccount").attr(\'class\',\'butActionRefused\'); + if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\'); + else jQuery("#changeaccount").attr(\'class\',\'button\'); } jQuery(".checkforselect, #checkallactions").click(function() { init_savebutton(); @@ -493,9 +496,6 @@ if ($result) }); '; - - print '
'; - print ''; $db->free($result); From 74ba9f57f128e415068857673f2308b27cefbb45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 18:48:00 +0200 Subject: [PATCH 042/162] Fix phpcs --- htdocs/compta/stats/cabyprodserv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index a7998fa9e23..27cf35c1379 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -321,7 +321,7 @@ if ($modecompta == 'CREANCES-DETTES') //select thirdparty print '
'; - print $langs->trans("ThirdParty") . ': ' . $form->select_thirdparty_list($selected_soc, 'search_soc','',1); + print $langs->trans("ThirdParty") . ': ' . $form->select_thirdparty_list($selected_soc, 'search_soc', '', 1); print ''; print '
'; print ''; // Action column - print ''; @@ -1474,10 +1474,10 @@ class FormFile print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; - print_liste_field_titre("Ref", $url, $sortref, "", $param, 'class="left"', $sortfield, $sortorder); - print_liste_field_titre("Documents2", $url, "name", "", $param, 'class="left"', $sortfield, $sortorder); - print_liste_field_titre("Size", $url, "size", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Date", $url, "date", "", $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre("Ref", $url, $sortref, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Documents2", $url, "name", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Size", $url, "size", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Date", $url, "date", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('', '', ''); print ''."\n"; @@ -1557,6 +1557,11 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $object_instance=new Holiday($this->db); } + elseif ($modulepart == 'banque') + { + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $object_instance=new Account($this->db); + } foreach($filearray as $key => $file) { @@ -1569,17 +1574,20 @@ class FormFile // Define relative path used to store the file $relativefile=preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']); - //var_dump($file); $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport'))) + elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport', 'banque'))) { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + else + { + //print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n"; + } if (! $id && ! $ref) continue; $found=0; @@ -1597,13 +1605,13 @@ class FormFile //fetchOneLike looks for objects with wildcards in its reference. //It is useful for those masks who get underscores instead of their actual symbols //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned - //that's why we look only look fetchOneLike when fetch returns 0 + //that's why we look only into fetchOneLike when fetch returns 0 if (!$result = $object_instance->fetch('', $ref)) { $result = $object_instance->fetchOneLike($ref); } } - if ($result > 0) { // Save object into a cache + if ($result > 0) { // Save object loaded into a cache $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance; } if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); } diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 6985c421062..f117bc24daf 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -182,7 +182,7 @@ function various_payment_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index dd96cfdb31f..e00f79b27bc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2701,7 +2701,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping pour les remises de cheques - elseif ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output)) + elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) { @@ -2712,7 +2712,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping for bank - elseif ($modulepart == 'bank' && !empty($conf->bank->dir_output)) + elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { if ($fuser->rights->banque->{$lire}) { diff --git a/htdocs/document.php b/htdocs/document.php index e784949c042..57897786f0d 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -169,6 +169,7 @@ $refname=basename(dirname($original_file)."/"); // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); +// Check security and set return info with full path of file $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 5f43426ae63..f068eed1319 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -332,6 +332,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } if (! empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } if (! empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); } + if (! empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); } $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); } From c0b12ee94a16958cc16dc69e53ca7dcbff66266a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 12:24:21 +0200 Subject: [PATCH 055/162] Typo --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/cron.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 23f10739424..8d2d4b55d19 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -71,7 +71,7 @@ UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties UseSearchToSelectContactTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. DelaiedFullListToSelectCompany=Wait until a key is pressed before loading content of Third Parties combo list.
This may increase performance if you have a large number of third parties, but it is less convenient. DelaiedFullListToSelectContact=Wait until a key is pressed before loading content of Contact combo list.
This may increase performance if you have a large number of contacts, but it is less convenient) -NumberOfKeyToSearch=Nbr of characters to trigger search: %s +NumberOfKeyToSearch=Number of characters to trigger search: %s NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party JavascriptDisabled=JavaScript disabled diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 26e125c820b..4f6b5f6ed65 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -42,7 +42,7 @@ CronModule=Module CronNoJobs=No jobs registered CronPriority=Priority CronLabel=Label -CronNbRun=No. launches +CronNbRun=Number of launches CronMaxRun=Maximum number of launches CronEach=Every JobFinished=Job launched and finished From 24572e2f821147444c4afa63fe619436c904b5ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 12:42:46 +0200 Subject: [PATCH 056/162] Remove warnings --- htdocs/core/lib/geturl.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 9a78e7a3dbf..25f5259d93d 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -34,7 +34,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array()) { //declaring of global variables - global $conf, $langs; + global $conf; $USE_PROXY=empty($conf->global->MAIN_PROXY_USE)?0:$conf->global->MAIN_PROXY_USE; $PROXY_HOST=empty($conf->global->MAIN_PROXY_HOST)?0:$conf->global->MAIN_PROXY_HOST; $PROXY_PORT=empty($conf->global->MAIN_PROXY_PORT)?0:$conf->global->MAIN_PROXY_PORT; @@ -85,6 +85,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = } elseif ($postorget == 'PUT') { + $array_param=null; curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' if (! is_array($param)) parse_str($param, $array_param); else @@ -195,6 +196,7 @@ function getRootURLFromURL($url) { $prefix=''; $tmpurl = $url; + $reg = null; if (preg_match('/^(https?:\/\/)/i', $tmpurl, $reg)) $prefix = $reg[1]; $tmpurl = preg_replace('/^https?:\/\//i', '', $tmpurl); // Remove http(s):// $tmpurl = preg_replace('/\/.*$/i', '', $tmpurl); // Remove part after domain From be726c2376bf733062c05e5878a2d9bab70f8ef4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 12:44:25 +0200 Subject: [PATCH 057/162] Code comment --- htdocs/core/lib/geturl.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 25f5259d93d..c161eb056fe 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -22,10 +22,10 @@ */ /** - * Function get content from an URL (use proxy if proxy defined) + * Function to get a content from an URL (use proxy if proxy defined) * * @param string $url URL to call. - * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'DELETE' + * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE' * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED * @param integer $followlocation 1=Follow location, 0=Do not follow * @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) From 9e91826dea53f16218fa41d0806309d365a28667 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 14:12:58 +0200 Subject: [PATCH 058/162] Can set length of random password --- htdocs/core/lib/security.lib.php | 2 +- htdocs/core/lib/security2.lib.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 8392b857061..0dbbb7f0829 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -109,7 +109,7 @@ function dol_decode($chain, $key = '1') * @param string $chain String to hash * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return string Hash of string - * @getRandomPassword + * @see getRandomPassword() */ function dol_hash($chain, $type = '0') { diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index f98985d0f74..596cdfb8e7e 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -448,14 +448,13 @@ function encodedecode_dbpassconf($level = 0) * @return string New value for password * @see dol_hash() */ -function getRandomPassword($generic = false, $replaceambiguouschars = null) +function getRandomPassword($generic = false, $replaceambiguouschars = null, $length = 32) { global $db,$conf,$langs,$user; $generated_password=''; if ($generic) { - $length = 32; $lowercase = "qwertyuiopasdfghjklzxcvbnm"; $uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP"; $numbers = "1234567890"; From 1ec8c259eb1cc894906419866747d627627ecc6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 14:54:37 +0200 Subject: [PATCH 059/162] Remove useless var --- htdocs/cron/class/cronjob.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index dafe772a0eb..2caba932e40 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -851,7 +851,6 @@ class Cronjob extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result = ''; - $companylink = ''; $label = '' . $langs->trans("CronJob") . ''; $label.= '
'; From a50fc9189b0cbe385f91fc90874f6386173b8c28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 15:45:44 +0200 Subject: [PATCH 060/162] Fix phpcs --- htdocs/core/lib/security2.lib.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 596cdfb8e7e..0e0d4a37946 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -131,8 +131,8 @@ if (! function_exists('dol_loginfunction')) */ function dol_loginfunction($langs, $conf, $mysoc) { - global $dolibarr_main_demo,$db; - global $smartphone,$hookmanager; + global $dolibarr_main_demo, $db; + global $hookmanager; $langs->loadLangs(array("main","other","help","admin")); @@ -207,11 +207,7 @@ if (! function_exists('dol_loginfunction')) // Execute hook getLoginPageOptions (for table) $parameters=array('entity' => GETPOST('entity', 'int')); $reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. - if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { - $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility - } else { - $morelogincontent = $hookmanager->resPrint; - } + $morelogincontent = $hookmanager->resPrint; // Execute hook getLoginPageExtraOptions (eg for js) $parameters=array('entity' => GETPOST('entity', 'int')); @@ -445,7 +441,8 @@ function encodedecode_dbpassconf($level = 0) * * @param boolean $generic true=Create generic password (32 chars/numbers), false=Use the configured password generation module * @param array $replaceambiguouschars Discard ambigous characters. For example array('I'). - * @return string New value for password + * @param int $length Length of random string (Used only if $generic is true) + * @return string New value for password * @see dol_hash() */ function getRandomPassword($generic = false, $replaceambiguouschars = null, $length = 32) From 9930b276ff9a9c565879dccb89c34e46d194080d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Apr 2019 17:29:02 +0200 Subject: [PATCH 061/162] Fix image link --- htdocs/install/check.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 8b1fbba0c1b..55331634aff 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -569,7 +569,7 @@ else if (count($notavailable_choices)) { print '
'; - print ' '.$langs->trans('ShowNotAvailableOptions').'...'; + print '> '.$langs->trans('ShowNotAvailableOptions').'...'; print '
'; print '
'; print ''; - if (! $variantexxx) print ''; print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index ddab337dd26..62271148ff0 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -160,6 +160,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle else $buf = fgets($fp); // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) + $reg=array(); if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) { $qualified=1; @@ -794,8 +795,9 @@ function listOfSessions() { $tmp=explode('_', $file); $idsess=$tmp[1]; - $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs); - $arrayofSessions[$idsess]["login"] = $regs[1]; + $regs=array(); + $loginfound = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs); + if ($loginfound) $arrayofSessions[$idsess]["login"] = $regs[1]; $arrayofSessions[$idsess]["age"] = time()-filectime($fullpath); $arrayofSessions[$idsess]["creation"] = filectime($fullpath); $arrayofSessions[$idsess]["modification"] = filemtime($fullpath); @@ -820,7 +822,6 @@ function purgeSessions($mysessionid) { global $conf; - $arrayofSessions = array(); $sessPath = ini_get("session.save_path")."/"; dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); @@ -868,7 +869,9 @@ function purgeSessions($mysessionid) */ function activateModule($value, $withdeps = 1) { - global $db, $modules, $langs, $conf, $mysoc; + global $db, $langs, $conf, $mysoc; + + $ret=array(); // Check parameters if (empty($value)) { @@ -1689,8 +1692,10 @@ function phpinfo_array() foreach($info_lines as $line) { // new cat? + $title = array(); preg_match("~

(.*)

~", $line, $title) ? $cat = $title[1] : null; - if(preg_match("~]+>([^<]*)]+>([^<]*)~", $line, $val)) + $val = array(); + if (preg_match("~]+>([^<]*)]+>([^<]*)~", $line, $val)) { $info_arr[trim($cat)][trim($val[1])] = $val[2]; } @@ -1709,7 +1714,7 @@ function phpinfo_array() */ function company_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf; $h = 0; $head = array(); diff --git a/htdocs/index.php b/htdocs/index.php index bc918ab76f4..9c78693a68e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -36,7 +36,6 @@ $action=GETPOST('action', 'aZ09'); $hookmanager->initHooks(array('index')); - /* * Actions */ From 8d0825910a017bdf33c429e721faf429e1c8a1a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 10:38:20 +0200 Subject: [PATCH 064/162] Fix warnings --- htdocs/core/lib/pdf.lib.php | 18 +- htdocs/core/menus/standard/eldy.lib.php | 213 ++++++++++-------------- 2 files changed, 99 insertions(+), 132 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2d6e41abe59..134cf7c8e5e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -341,14 +341,14 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali /** * Return a string with full address formated for output on documents * - * @param Translate $outputlangs Output langs object - * @param Societe $sourcecompany Source company object - * @param Societe|string $targetcompany Target company object - * @param Contact|string $targetcontact Target contact object - * @param int $usecontact Use contact instead of company - * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) - * @param Object $object Object we want to build document for - * @return string String with full address + * @param Translate $outputlangs Output langs object + * @param Societe $sourcecompany Source company object + * @param Societe|string|null $targetcompany Target company object + * @param Contact|string|null $targetcontact Target contact object + * @param int $usecontact Use contact instead of company + * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) + * @param Object $object Object we want to build document for + * @return string String with full address */ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null) { @@ -364,7 +364,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t $stringaddress = ''; if (is_object($hookmanager)) { - $parameters = array('sourcecompany'=>&$sourcecompany,'targetcompany'=>&$targetcompany,'targetcontact'=>$targetcontact,'outputlangs'=>$outputlangs,'mode'=>$mode,'usecontact'=>$usecontact); + $parameters = array('sourcecompany'=>&$sourcecompany, 'targetcompany'=>&$targetcompany, 'targetcontact'=>&$targetcontact, 'outputlangs'=>$outputlangs, 'mode'=>$mode, 'usecontact'=>$usecontact); $action=''; $reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $stringaddress.=$hookmanager->resPrint; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d5e93ce5119..02727acf36c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -87,20 +87,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Members + $tmpentry = array( + 'enabled' => (! empty($conf->adherent->enabled) ) , + 'perms' => (! empty($user->rights->adherent->lire) ), + 'module' => 'adherent' + ); $menu_arr[] = array( 'name' => 'Members', 'link' => '/adherents/index.php?mainmenu=members&leftmenu=', 'title' => "MenuMembers", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled' => (! empty($conf->adherent->enabled) ) , - 'perms' => (! empty($user->rights->adherent->lire) ), - 'module' => 'adherent', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "members", 'leftmenu' => '', @@ -115,24 +112,21 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Third parties + $tmpentry = array( + 'enabled'=> ( ( ! empty($conf->societe->enabled) && + ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) + ) + || ! empty($conf->fournisseur->enabled) + ), + 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), + 'module'=>'societe|fournisseur' + ); $menu_arr[] = array( 'name' => 'Companies', 'link' => '/societe/index.php?mainmenu=companies&leftmenu=', 'title' => "ThirdParties", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=> ( ( ! empty($conf->societe->enabled) && - ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) - ) - || ! empty($conf->fournisseur->enabled) - ), - 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), - 'module'=>'societe|fournisseur', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "companies", 'leftmenu' => '', @@ -147,6 +141,15 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Products-Services + $tmpentry = array( + 'enabled'=> (( ! empty($conf->societe->enabled) && + ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) + ) + || ! empty($conf->fournisseur->enabled) + ), + 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), + 'module'=>'product|service' + ); $menu_arr[] = array( 'name' => 'Products', 'link' => '/product/index.php?mainmenu=products&leftmenu=', @@ -154,19 +157,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ? ( array("TMenuProducts" , " | " ,"TMenuServices") ) : (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ), 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=> (( ! empty($conf->societe->enabled) && - ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) - ) - || ! empty($conf->fournisseur->enabled) - ), - 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), - 'module'=>'product|service', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "products", 'leftmenu' => '', @@ -181,20 +172,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // MRP + $tmpentry = array( + 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), + 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), + 'module'=>'bom|mrp' + ); $menu_arr[] = array( 'name' => 'TMenuMRP', 'link' => '/mrp/index.php?mainmenu=mrp&leftmenu=', 'title' => $langs->trans("TMenuMRP"), 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), - 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), - 'module'=>'bom|mrp', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "mrp", 'leftmenu' => '', @@ -209,6 +197,11 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Projects + $tmpentry = array( + 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), + 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), + 'module'=>'projet' + ); $menu_arr[] = array( 'name' => 'Projet', 'link' => '/projet/index.php?mainmenu=project&leftmenu=', @@ -216,15 +209,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects") : "LeadsOrProjects", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), - 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), - 'module'=>'projet', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "project", 'leftmenu' => '', @@ -239,26 +224,23 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Commercial + $tmpentry = array( + 'enabled'=>(! empty($conf->propal->enabled) || + ! empty($conf->commande->enabled) || + ! empty($conf->supplier_order->enabled) || + ! empty($conf->supplier_proposal->enabled) || + ! empty($conf->contrat->enabled) || + ! empty($conf->ficheinter->enabled) + )?1:0, + 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), + 'module'=>'propal|commande|supplier_order|contrat|ficheinter' + ); $menu_arr[] = array( 'name' => 'Commercial', 'link' => '/comm/index.php?mainmenu=commercial&leftmenu=', 'title' => "Commercial", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->propal->enabled) || - ! empty($conf->commande->enabled) || - ! empty($conf->supplier_order->enabled) || - ! empty($conf->supplier_proposal->enabled) || - ! empty($conf->contrat->enabled) || - ! empty($conf->ficheinter->enabled) - )?1:0, - 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), - 'module'=>'propal|commande|supplier_order|contrat|ficheinter', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "commercial", 'leftmenu' => '', @@ -273,28 +255,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Billing - Financial + $tmpentry = array( + 'enabled'=>(! empty($conf->facture->enabled) || + ! empty($conf->don->enabled) || + ! empty($conf->tax->enabled) || + ! empty($conf->salaries->enabled) || + ! empty($conf->supplier_invoice->enabled) || + ! empty($conf->loan->enabled) + )?1:0, + 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire) + || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) + || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), + 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' + ); $menu_arr[] = array( 'name' => 'Compta', 'link' => '/compta/index.php?mainmenu=billing&leftmenu=', 'title' => "MenuFinancial", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->facture->enabled) || - ! empty($conf->don->enabled) || - ! empty($conf->tax->enabled) || - ! empty($conf->salaries->enabled) || - ! empty($conf->supplier_invoice->enabled) || - ! empty($conf->loan->enabled) - )?1:0, - 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire) - || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) - || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), - 'module'=>'facture|supplier_invoice|don|tax|salaries|loan', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "billing", 'leftmenu' => '', @@ -309,20 +288,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Bank + $tmpentry = array( + 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), + 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), + 'module'=>'banque|prelevement' + ); $menu_arr[] = array( 'name' => 'Bank', 'link' => '/compta/bank/list.php?mainmenu=bank&leftmenu=', 'title' => "MenuBankCash", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), - 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), - 'module'=>'banque|prelevement', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "bank", 'leftmenu' => '', @@ -339,20 +315,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Accounting + $tmpentry = array( + 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), + 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), + 'comptabilite|accounting|asset' + ); $menu_arr[] = array( 'name' => 'Accounting', 'link' => '/accountancy/index.php?mainmenu=accountancy&leftmenu=', 'title' => "MenuAccountancy", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), - 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), - 'comptabilite|accounting|asset', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "accountancy", 'leftmenu' => '', @@ -369,20 +342,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // HRM + $tmpentry = array( + 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), + 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), + 'module'=>'hrm|holiday|deplacement|expensereport' + ); $menu_arr[] = array( 'name' => 'HRM', 'link' => '/hrm/index.php?mainmenu=hrm&leftmenu=', 'title' => "HRM", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), - 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), - 'module'=>'hrm|holiday|deplacement|expensereport', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "hrm", 'leftmenu' => '', @@ -399,20 +369,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Tools + $tmpentry = array( + 'enabled'=>1, + 'perms'=>1, + 'module'=>'' + ); $menu_arr[] = array( 'name' => 'Tools', 'link' => '/core/tools.php?mainmenu=tools&leftmenu=', 'title' => "Tools", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType( - $type_user, - $tmpentry = array( - 'enabled'=>1, - 'perms'=>1, - 'module'=>'', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "tools", 'leftmenu' => '', @@ -641,7 +608,7 @@ function print_end_menu_array() */ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) { - global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; + global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc; //var_dump($tabMenu); @@ -1638,7 +1605,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $tmpentry = array( 'enabled'=>(! empty($conf->projet->enabled)), 'perms'=>(! empty($user->rights->projet->lire)), - 'module'=>'projet', + 'module'=>'projet' ); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); From c0c723a20727e5cb9b42b1f0919415b0337b91ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 11:00:28 +0200 Subject: [PATCH 065/162] Work on inventory feature --- .../install/mysql/migration/9.0.0-10.0.0.sql | 4 + .../install/mysql/tables/llx_inventorydet.sql | 5 +- .../inventory/class/inventory.class.php | 90 +++++++++++++++---- 3 files changed, 80 insertions(+), 19 deletions(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index ae8c8c8ce18..6d1c1144ddf 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -289,3 +289,7 @@ DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0'; insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',164); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166); +ALTER TABLE llx_inventorydet DROP COLUMN pmp; +ALTER TABLE llx_inventorydet DROP COLUMN pa; +ALTER TABLE llx_inventorydet DROP COLUMN new_pmp; + diff --git a/htdocs/install/mysql/tables/llx_inventorydet.sql b/htdocs/install/mysql/tables/llx_inventorydet.sql index ce40d03939c..452b61e190e 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet.sql @@ -28,9 +28,6 @@ fk_product integer DEFAULT 0, batch varchar(30) DEFAULT NULL, -- Lot or serial number qty_view double DEFAULT NULL, -- must be filled once regulation is done qty_stock double DEFAULT NULL, -- can be filled during draft edition -qty_regulated double DEFAULT NULL, -- must be filled once regulation is done -pmp double DEFAULT 0, -pa double DEFAULT 0, -new_pmp double DEFAULT 0 +qty_regulated double DEFAULT NULL -- must be filled once regulation is done ) ENGINE=InnoDB; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index b9e4d8bd090..fabaaefb1a1 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2019 Laurent Destailleur * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud @@ -81,8 +81,8 @@ class Inventory extends CommonObject 'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth200'), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300'), - 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToThirparty'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'LinkToProduct'), + 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>1, 'position'=>35), 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502,), @@ -501,20 +501,80 @@ class Inventory extends CommonObject /** * Class InventoryLine */ -class InventoryLine +class InventoryLine extends CommonObjectLine { - /** - * @var int ID - */ - public $id; + /** + * @var string ID to identify managed object + */ + public $element = 'inventoryline'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'inventorydet'; + + /** + * @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var string String with name of icon for inventory + */ + public $picto = 'stock'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'showoncombobox' if field must be shown into the label of combobox + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), + 'fk_inventory' => array('type'=>'integer:Inventory:product/inventory/class/inventory.class.php', 'label'=>'Inventory', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToInventory'), + 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToThirparty'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'LinkToProduct'), + 'batch' => array('type'=>'string', 'label'=>'Batch', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'LinkToProduct'), + 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + 'qty_stock' => array('type'=>'double', 'label'=>'QtyFound', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'Qty we found/want (to define during draft edition)'), + 'qty_view' => array('type'=>'double', 'label'=>'QtyBefore', 'visible'=>1, 'enabled'=>1, 'position'=>33, 'index'=>1, 'help'=>'Qty before (filled once movements are validated)'), + 'qty_regulated' => array('type'=>'double', 'label'=>'QtyDelta', 'visible'=>1, 'enabled'=>1, 'position'=>34, 'index'=>1, 'help'=>'Qty aadded or removed (filled once movements are validated)'), + ); + + /** + * @var int ID + */ + public $rowid; + /** - * @var mixed Sample line property 1 + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK */ - public $prop1; - - /** - * @var mixed Sample line property 2 - */ - public $prop2; + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + //if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } } From 09914f31f9acf465fc6f9ae4ac6dd9510779a053 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 12:14:50 +0200 Subject: [PATCH 066/162] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7083ed1114e..256cdc46105 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1817,7 +1817,7 @@ ChartLoaded=Chart of account loaded SocialNetworkSetup=Setup of module Social Networks EnableFeatureFor=Enable features for %s VATIsUsedIsOff=Note: The option to use sales Tax or VAT has been set to Off in the menu %s - %s, so Sale tax or Vat used will always be 0 for sales. -SwapSenderAndRecipientOnPDF=Swap sender and recipient address on PDF +SwapSenderAndRecipientOnPDF=Swap sender and recipient address position on PDF documents FeatureSupportedOnTextFieldsOnly=Warning, feature supported on text fields only. Also an URL parameter action=create or action=edit must be set OR page name must end with 'new.php' to trigger this feature. EmailCollector=Email collector EmailCollectorDescription=Add a scheduled job and a setup page to scan regularly email boxes (using IMAP protocol) and record emails received into your application, at the right place and/or create some record automatically (like leads). From fe1b8849667c77f3e9963d766ad50f63d8638d1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 12:20:59 +0200 Subject: [PATCH 067/162] Add missing methods --- .../inventory/class/inventory.class.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index fabaaefb1a1..7f535a2eac0 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -577,4 +577,29 @@ class InventoryLine extends CommonObjectLine //if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); return $result; } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } } From a77b46f072d51bcceef3181b7588224775f06c5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 12:52:48 +0200 Subject: [PATCH 068/162] Removed warnings --- .../class/emailcollector.class.php | 17 +++++++---------- .../template/class/myobject.class.php | 16 +++++++++------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 46fe3aed185..6249325261a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -184,7 +184,7 @@ class EmailCollector extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -234,7 +234,7 @@ class EmailCollector extends CommonObject */ public function createFromClone(User $user, $fromid) { - global $langs, $hookmanager, $extrafields; + global $langs, $extrafields; $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -337,8 +337,6 @@ class EmailCollector extends CommonObject $obj_ret = array(); - $socid = $user->societe_id ? $user->societe_id : ''; - $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector as s"; $sql.= ' WHERE s.entity IN ('.getEntity('emailcollector').')'; @@ -358,6 +356,7 @@ class EmailCollector extends CommonObject $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); + $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($result); @@ -415,14 +414,11 @@ class EmailCollector extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $db, $conf, $langs, $hookmanager; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $conf, $langs, $hookmanager; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result = ''; - $companylink = ''; $label = '' . $langs->trans("EmailCollector") . ''; $label.= '
'; @@ -1023,6 +1019,7 @@ class EmailCollector extends CommonObject function createPartArray($structure, $prefix = "") { //print_r($structure); + $part_array=array(); if (count($structure->parts) > 0) { // There some sub parts foreach ($structure->parts as $count => $part) { add_part_to_array($part, $prefix.($count+1), $part_array); @@ -1348,7 +1345,7 @@ class EmailCollector extends CommonObject else { // Nothing can be done for this param - $errorforaction++; + $errorforactions++; $this->error = 'The extract rule to use to load thirdparty has on an unknown source (must be HEADER, SUBJECT or BODY)'; $this->errors[] = $this->error; } @@ -1361,7 +1358,7 @@ class EmailCollector extends CommonObject } else { - $errorforaction++; + $errorforactions++; $this->error = 'Bad syntax for description of action parameters: '.$actionparam; $this->errors[] = $this->error; break; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 3371beb97f8..27cda79aa84 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -202,7 +202,7 @@ class MyObject extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -252,7 +252,7 @@ class MyObject extends CommonObject */ public function createFromClone(User $user, $fromid) { - global $langs, $hookmanager, $extrafields; + global $langs, $extrafields; $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -392,9 +392,11 @@ class MyObject extends CommonObject $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - - while ($obj = $this->db->fetch_object($resql)) + $i = 0; + while ($i < min($limit, $num)) { + $obj = $this->db->fetch_object($resql); + $record = new self($this->db); $record->id = $obj->rowid; @@ -402,6 +404,8 @@ class MyObject extends CommonObject //var_dump($record->id); $records[$record->id] = $record; + + $i++; } $this->db->free($resql); @@ -451,9 +455,7 @@ class MyObject extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $db, $conf, $langs, $hookmanager; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $conf, $langs, $hookmanager; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips From 7c458ee4c05092de218bb4c6b682d1b2975fc252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:02:25 +0200 Subject: [PATCH 069/162] TODO --- htdocs/accountancy/admin/importaccounts.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index c8cf0aa9901..5c9cc16e01f 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -22,6 +22,7 @@ * \file htdocs/accountancy/admin/importaccounts.php * \ingroup Advanced accountancy * \brief Page import accounting account + * @TODO What is this page for ? Remove this ? */ require '../../main.inc.php'; From a8b645c7a3a3e179d6752a9acf7641fcd864211f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:07:46 +0200 Subject: [PATCH 070/162] Fix warnings --- htdocs/accountancy/class/accountingaccount.class.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index f214a3f3570..33f8990bc8d 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -233,16 +233,8 @@ class AccountingAccount extends CommonObject $this->pcg_subtype = trim($this->pcg_subtype); if (isset($this->account_number)) $this->account_number = trim($this->account_number); - if (isset($this->account_parent)) - $this->account_parent = trim($this->account_parent); if (isset($this->label)) $this->label = trim($this->label); - if (isset($this->account_category)) - $this->account_category = trim($this->account_category); - if (isset($this->fk_user_author)) - $this->fk_user_author = trim($this->fk_user_author); - if (isset($this->active)) - $this->active = trim($this->active); if (empty($this->pcg_type) || $this->pcg_type == '-1') { From 7f4b09c4825e5579e3f304bdfbe441b0cbd00a1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:20:44 +0200 Subject: [PATCH 071/162] Fix warnings --- .../mailing/class/advtargetemailing.class.php | 21 ++----------- .../compta/localtax/class/localtax.class.php | 30 ++++++++----------- .../salaries/class/paymentsalary.class.php | 12 +++----- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index b450f5a0872..9d6cccdacf5 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -114,22 +114,17 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element; if (isset($this->type_element)) $this->type_element=trim($this->type_element); if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); - if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); - if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod); - - // Check parameters // Put here code to add control on parameters values // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."advtargetemailing("; - $sql.= "name,"; $sql.= "entity,"; $sql.= "fk_element,"; @@ -138,10 +133,7 @@ class AdvanceTargetingMailing extends CommonObject $sql.= "fk_user_author,"; $sql.= "datec,"; $sql.= "fk_user_mod"; - - $sql.= ") VALUES ("; - $sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").","; $sql.= " ".$conf->entity.","; $sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").","; @@ -149,9 +141,7 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").","; $sql.= " ".$user->id.","; $sql.= " '".$this->db->idate(dol_now())."',"; - $sql.= " ".$user->id; - - + $sql.= " null"; $sql.= ")"; $this->db->begin(); @@ -396,14 +386,10 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element; if (isset($this->type_element)) $this->type_element=trim($this->type_element); if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); - if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); - if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod); - - // Check parameters // Put here code to add a control on parameters values @@ -417,7 +403,6 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").","; $sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").","; $sql.= " fk_user_mod=".$user->id; - $sql.= " WHERE rowid=".$this->id; $this->db->begin(); diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index b0178bd09e1..30d2d0de33c 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -97,9 +97,6 @@ class Localtax extends CommonObject $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); - $this->fk_bank=trim($this->fk_bank); - $this->fk_user_creat=trim($this->fk_user_creat); - $this->fk_user_modif=trim($this->fk_user_modif); // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax("; @@ -121,9 +118,9 @@ class Localtax extends CommonObject $sql.= " '".$this->db->escape($this->amount)."',"; $sql.= " '".$this->db->escape($this->label)."',"; $sql.= " '".$this->db->escape($this->note)."',"; - $sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->db->escape($this->fk_bank)."'").","; - $sql.= " '".$this->db->escape($this->fk_user_creat)."',"; - $sql.= " '".$this->db->escape($this->fk_user_modif)."'"; + $sql.= " ".($this->fk_bank <= 0 ? "NULL" : (int) $this->fk_bank).","; + $sql.= " ".((int) $this->fk_user_creat).","; + $sql.= " ".((int) $this->fk_user_modif); $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -173,9 +170,6 @@ class Localtax extends CommonObject $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); - $this->fk_bank=trim($this->fk_bank); - $this->fk_user_creat=trim($this->fk_user_creat); - $this->fk_user_modif=trim($this->fk_user_modif); $this->db->begin(); @@ -188,9 +182,9 @@ class Localtax extends CommonObject $sql.= " amount=".price2num($this->amount).","; $sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; - $sql.= " fk_bank=".$this->fk_bank.","; - $sql.= " fk_user_creat=".$this->fk_user_creat.","; - $sql.= " fk_user_modif=".$this->fk_user_modif; + $sql.= " fk_bank=".((int) $this->fk_bank).","; + $sql.= " fk_user_creat=".((int) $this->fk_user_creat).","; + $sql.= " fk_user_modif=".((int) $this->fk_user_modif); $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -299,7 +293,6 @@ class Localtax extends CommonObject if ($result < 0) return -1; // End call triggers - $sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax"; $sql.= " WHERE rowid=".$this->id; @@ -324,6 +317,8 @@ class Localtax extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id=0; $this->tms=''; @@ -333,9 +328,9 @@ class Localtax extends CommonObject $this->amount=''; $this->label=''; $this->note=''; - $this->fk_bank=''; - $this->fk_user_creat=''; - $this->fk_user_modif=''; + $this->fk_bank=0; + $this->fk_user_creat=$user->id; + $this->fk_user_modif=$user->id; } @@ -347,7 +342,6 @@ class Localtax extends CommonObject */ public function solde($year = 0) { - $reglee = $this->localtax_sum_reglee($year); $payee = $this->localtax_sum_payee($year); @@ -528,7 +522,7 @@ class Localtax extends CommonObject $sql.= "'".$this->db->idate($this->datev)."'," . $this->amount; if ($this->note) $sql.=", '".$this->db->escape($this->note)."'"; if ($this->label) $sql.=", '".$this->db->escape($this->label)."'"; - $sql.=", '".$user->id."', NULL"; + $sql.=", ".((int) $user->id).", NULL"; $sql.= ")"; dol_syslog(get_class($this)."::addPayment", LOG_DEBUG); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 40cec40ecad..6f3a9de4492 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -115,13 +115,9 @@ class PaymentSalary extends CommonObject $error=0; // Clean parameters - $this->fk_user=trim($this->fk_user); $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); - $this->fk_bank=trim($this->fk_bank); - $this->fk_user_author=trim($this->fk_user_author); - $this->fk_user_modif=trim($this->fk_user_modif); // Check parameters if (empty($this->fk_user) || $this->fk_user < 0) @@ -140,16 +136,16 @@ class PaymentSalary extends CommonObject $sql.= " datep='".$this->db->idate($this->datep)."',"; $sql.= " datev='".$this->db->idate($this->datev)."',"; $sql.= " amount=".price2num($this->amount).","; - $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; + $sql.= " fk_projet=".((int) $this->fk_project).","; $sql.= " fk_typepayment=".$this->fk_typepayment."',"; $sql.= " num_payment='".$this->db->escape($this->num_payment)."',"; $sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " datesp='".$this->db->idate($this->datesp)."',"; $sql.= " dateep='".$this->db->idate($this->dateep)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; - $sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->db->escape($this->fk_bank)."'":"null").","; - $sql.= " fk_user_author=".$this->fk_user_author.","; - $sql.= " fk_user_modif=".$this->fk_user_modif; + $sql.= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : 'null').","; + $sql.= " fk_user_author=".((int) $this->fk_user_author).","; + $sql.= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); $sql.= " WHERE rowid=".$this->id; From 3b04d2fe9b8fddec0de9f223be50008f234ee43a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:21:17 +0200 Subject: [PATCH 072/162] Fix warnings --- htdocs/comm/mailing/class/advtargetemailing.class.php | 1 + htdocs/compta/localtax/class/localtax.class.php | 6 +++--- htdocs/compta/salaries/class/paymentsalary.class.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 9d6cccdacf5..ed04192d0e9 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -403,6 +403,7 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").","; $sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").","; $sql.= " fk_user_mod=".$user->id; + $sql.= " WHERE rowid=".$this->id; $this->db->begin(); diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 30d2d0de33c..247db26715a 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -182,9 +182,9 @@ class Localtax extends CommonObject $sql.= " amount=".price2num($this->amount).","; $sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; - $sql.= " fk_bank=".((int) $this->fk_bank).","; - $sql.= " fk_user_creat=".((int) $this->fk_user_creat).","; - $sql.= " fk_user_modif=".((int) $this->fk_user_modif); + $sql.= " fk_bank=".(int) $this->fk_bank.","; + $sql.= " fk_user_creat=".(int) $this->fk_user_creat.","; + $sql.= " fk_user_modif=".(int) $this->fk_user_modif; $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 6f3a9de4492..1d0bad641fc 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -143,7 +143,7 @@ class PaymentSalary extends CommonObject $sql.= " datesp='".$this->db->idate($this->datesp)."',"; $sql.= " dateep='".$this->db->idate($this->dateep)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; - $sql.= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : 'null').","; + $sql.= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql.= " fk_user_author=".((int) $this->fk_user_author).","; $sql.= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); From 74d0edfc5992e52832d8a16540fcf96b684cc151 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:24:32 +0200 Subject: [PATCH 073/162] Removed not used file --- htdocs/accountancy/admin/importaccounts.php | 188 -------------------- 1 file changed, 188 deletions(-) delete mode 100644 htdocs/accountancy/admin/importaccounts.php diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php deleted file mode 100644 index 5c9cc16e01f..00000000000 --- a/htdocs/accountancy/admin/importaccounts.php +++ /dev/null @@ -1,188 +0,0 @@ - - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2018 Frédéric France - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/accountancy/admin/importaccounts.php - * \ingroup Advanced accountancy - * \brief Page import accounting account - * @TODO What is this page for ? Remove this ? - */ -require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta","bills","accountancy")); - -// Security check -if (! $user->admin) - accessforbidden(); - -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); -$sortfield = GETPOST("sortfield", 'alpha'); -$sortorder = GETPOST("sortorder", 'alpha'); -$page = GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; - - - - -/* - * View - */ - -llxHeader('', $langs->trans("ImportAccount")); - -$to_import = GETPOST("mesCasesCochees"); - -if ($_POST["action"] == 'import') { - print '
' . $langs->trans("Processing") . '...
'; - if (is_array($to_import) && count($to_import) > 0) { - print '
' . count($to_import) . ' ' . $langs->trans("SelectedLines") . '
'; - $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; - - $result = $db->query($sql); - if ($result && ($db->num_rows($result) > 0)) { - - $obj = $db->fetch_object($result); - - $cpt = 0; - foreach ($to_import as $maLigneCochee) { - - $accounting = new AccountingAccount($db); - - $monLabel = (string) GETPOST('label' . $maLigneCochee); - $monParentAccount = (string) GETPOST('AccountParent' . $maLigneCochee); - $monType = (string) GETPOST('pcgType' . $maLigneCochee); - $monSubType = (string) GETPOST('pcgSubType' . $maLigneCochee); - - $accounting->fk_pcg_version = $obj->pcg_version; - $accounting->account_number = $maLigneCochee; - $accounting->label = $monLabel; - $accounting->account_parent = $monParentAccount; - $accounting->pcg_type = $monType; - $accounting->pcg_subtype = $monSubType; - $accounting->active = 1; - - $result = $accounting->create($user); - if ($result > 0) { - setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs'); - } else { - setEventMessages($accounting->error, $accounting->errors, 'errors'); - } - $cpt ++; - } - } else { - setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors'); - } - } else { - print '
' . $langs->trans("AnyLineImport") . '
'; - } - print '
' . $langs->trans("EndProcessing") . '
'; -} - -// list accounting account from product - -$sql = "(SELECT p.rowid as product_id, p.accountancy_code_sell as accounting "; -$sql .= " FROM " . MAIN_DB_PREFIX . "product as p "; -$sql .= " WHERE p.accountancy_code_sell >=0"; -$sql .= " GROUP BY accounting "; -$sql .= ")"; -$sql .= "UNION ALL(SELECT p.rowid as product_id, p.accountancy_code_buy as accounting "; -$sql .= " FROM " . MAIN_DB_PREFIX . "product as p "; -$sql .= " WHERE p.accountancy_code_buy >=0"; -$sql .= " GROUP BY accounting "; -$sql .= ") "; -$sql .= " ORDER BY accounting DESC " . $db->plimit($limit + 1, $offset); - -dol_syslog('accountancy/admin/importaccounts.php:: $sql=' . $sql); -$result = $db->query($sql); -if ($result) { - $num_lines = $db->num_rows($result); - $i = 0; - print_barre_liste($langs->trans("ImportAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - - print '' . "\n"; - print ''; - - print '
'; From 734b1ca7c188d7d390e5d9aa3d4879f94630ae75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2019 22:18:08 +0200 Subject: [PATCH 043/162] Fix phpcs --- htdocs/core/modules/modAsset.class.php | 136 ++----------------------- 1 file changed, 10 insertions(+), 126 deletions(-) diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index fea437ec1c0..71ce8c128e2 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2018 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ class modAsset extends DolibarrModules */ public function __construct($db) { - global $langs,$conf; + global $langs, $conf; $this->db = $db; @@ -145,20 +145,6 @@ class modAsset extends DolibarrModules // Dictionaries $this->dictionaries=array(); - /* Example: - $this->dictionaries=array( - 'langs'=>'mylangfile@assets', - 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor - 'tablib'=>array("Table1","Table2","Table3"), // Label of tables - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields - 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order - 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) - 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) - 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) - 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->assets->enabled,$conf->assets->enabled,$conf->assets->enabled) // Condition to show each dictionary - ); - */ // Boxes/Widgets @@ -188,7 +174,7 @@ class modAsset extends DolibarrModules $r++; $this->rights[$r][0] = 51001; // Permission id (must not be already used) $this->rights[$r][1] = 'Read assets'; // Permission label - $this->rights[$r][2] = r; + $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) @@ -196,7 +182,7 @@ class modAsset extends DolibarrModules $r++; $this->rights[$r][0] = 51002; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/Update assets'; // Permission label - $this->rights[$r][2] = w; + $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) @@ -204,7 +190,7 @@ class modAsset extends DolibarrModules $r++; $this->rights[$r][0] = 51003; // Permission id (must not be already used) $this->rights[$r][1] = 'Delete assets'; // Permission label - $this->rights[$r][2] = d; + $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) @@ -214,112 +200,12 @@ class modAsset extends DolibarrModules $this->rights[$r][1] = 'Setup types of asset'; // Permission label $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'configurer'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) + $this->rights[$r][4] = 'advanced_configurer'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) - - // Main menu entries - $this->menu = array(); // List of menus to add - $r=0; - - // Add here entries to declare new menus - $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - // Exports - //-------- - $r=1; - - // $this->export_code[$r] Unique code identifying the export (all modules combined) - // $this->export_label[$r] Libelle by default if translation of key "ExportXXX" not found (XXX = Code) - // $this->export_permission[$r] List of permission codes required to export - // $this->export_fields_sql[$r] List of exportable fields in SQL codiffication - // $this->export_fields_name[$r] List of exportable fields in translation codiffication - // $this->export_sql[$r] SQL query that offers data for export - - /* - $r++; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='AssetsLines'; - $this->export_permission[$r]=array(array("asset","export")); - $this->export_fields_array[$r]=array( - 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature', - 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country", - 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status", - 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation', - 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'AssetTypeId','ta.label'=>'AssetTypeLabel', - 'ta.accountancy_code_asset'=>'AccountancyCodeAsset','ta.accountancy_code_depreciation_asset'=>'AccountancyCodeDepreciationAsset', - 'ta.accountancy_code_depreciation_expense'=>'AccountancyCodeDepreciationExpense' - ); - $this->export_TypeFields_array[$r]=array( - 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text", - 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text", - 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date', - 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:asset_type:label','ta.label'=>'Text','ta.accountancy_code_asset'=>'Text','ta.accountancy_code_depreciation_asset'=>'Text', - 'ta.accountancy_code_depreciation_expense'=>'Text' - ); - $this->export_entities_array[$r]=array( - 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member', - 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member", - 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member", - 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member', - 'a.datefin'=>'member','ta.rowid'=>'asset_type','ta.label'=>'asset_type','ta.accountancy_code_asset'=>'asset_type','ta.accountancy_code_depreciation_asset'=>'asset_type', - 'ta.accountancy_code_depreciation_expense'=>'asset_type' - ); - // Add extra fields - $keyforselect='asset'; $keyforelement='asset'; $keyforaliasextra='extra'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - // End add axtra fields - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'asset_type as ta, '.MAIN_DB_PREFIX.'asset as a)'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'asset_extrafields as extra ON a.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=' WHERE a.fk_asset_type = ta.rowid AND ta.entity IN ('.getEntity('asset_type').') '; - - // Imports - //-------- - $r=0; - - $now=dol_now(); - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="Assets"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'asset','extra'=>MAIN_DB_PREFIX.'asset_extrafields'); - $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array( - 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password", - "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town", - 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile", - 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate", - 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription' - ); - // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'asset' AND entity = ".$conf->entity; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); - } - } - // End add extra fields - $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'asset'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_regex_array[$r]=array( - 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type', - 'a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', - 'a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$' - ); - $this->import_examplevalues_array[$r]=array( - 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1', - 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1', - 'a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member", - 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d') - ); - */ + + // Menus + //------- + $this->menu = 1; // This module add menu entries. They are coded into menu manager. } /** @@ -332,8 +218,6 @@ class modAsset extends DolibarrModules */ public function init($options = '') { - global $conf; - // Permissions $this->remove($options); From e9b13baac2dfbc70c8a01f308d072da17c4367ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 09:27:15 +0200 Subject: [PATCH 044/162] Update mod_bom_advanced.php The property db does not exist on mod_bom_advanced. --- htdocs/core/modules/bom/mod_bom_advanced.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 594df7e31de..ba5c437f0a0 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand (Resultic) +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2019 Frédéric France * * 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 @@ -57,11 +58,11 @@ class mod_bom_advanced extends ModeleNumRefboms */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= '
'; From 9b9d4ddc4517b7b54bc42870e897ff048ec06949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 09:29:24 +0200 Subject: [PATCH 045/162] Update mod_expedition_ribera.php The property db does not exist on mod_bom_advanced. --- htdocs/core/modules/expedition/mod_expedition_ribera.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index cc7fb98baec..4ffde92649e 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2019 Frédéric France * * 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 @@ -59,11 +60,11 @@ class mod_expedition_ribera extends ModelNumRefExpedition */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; From bed3ed705c7ef5ef305191094d70dc4ad3ed6712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 09:31:53 +0200 Subject: [PATCH 046/162] Update mod_contract_magre.php The property db does not exist on mod_contract_magre. --- htdocs/core/modules/contract/mod_contract_magre.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 4a7b73cc145..1ee6d36803e 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2019 Frédéric France * * 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 @@ -61,11 +62,11 @@ class mod_contract_magre extends ModelNumRefContracts */ public function info() { - global $conf,$langs; + global $conf,$langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; From fbf718f330ce73b384b272a00e4d8ca9034dacd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 09:34:23 +0200 Subject: [PATCH 047/162] Update mod_commande_saphir.php --- .../core/modules/commande/mod_commande_saphir.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 311fd034bbd..8c96c237a0f 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand (Resultic) +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2019 Frédéric France * * 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 @@ -57,11 +58,11 @@ class mod_commande_saphir extends ModeleNumRefCommandes */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; From e5559ac2f9892ecdb6950472ee81d8007f0625ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 09:36:47 +0200 Subject: [PATCH 048/162] Update mod_chequereceipt_thyme.php The property db does not exist on mod_chequereceipt_thyme. --- htdocs/core/modules/cheque/mod_chequereceipt_thyme.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index d65273bd16b..7ff3bc6f6cc 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2019 Frédéric France * * 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 @@ -51,11 +52,11 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte.= ''; From b05a5e49ff0d7bb67dd712a77fb80ffe9789a8ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 11:39:38 +0200 Subject: [PATCH 049/162] Update export_tsv.modules.php --- htdocs/core/modules/export/export_tsv.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index f5b85c6987c..b40da3cd539 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php'; class ExportTsv extends ModeleExports { /** - * @var int ID + * @var string ID */ public $id; From 06a8513575d9daa15fac3f3f847e35b5722ef785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 11:40:59 +0200 Subject: [PATCH 050/162] Update export_excel2007new.modules.php --- htdocs/core/modules/export/export_excel2007new.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 29b165cb890..32b6029a294 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -35,7 +35,7 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx; class ExportExcel2007new extends ModeleExports { /** - * @var int ID + * @var string ID */ public $id; From 73b32f067933f4acb2f5f7b5e36e025c36465372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 11:41:19 +0200 Subject: [PATCH 051/162] Update export_excel2007.modules.php --- htdocs/core/modules/export/export_excel2007.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 46dc8d8fd53..e33849427b1 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; class ExportExcel2007 extends ExportExcel { /** - * @var int ID + * @var string ID */ public $id; From a0ce52bb2388f83ec0c8160146fc734607b6eaae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 11:41:37 +0200 Subject: [PATCH 052/162] Update export_excel.modules.php --- htdocs/core/modules/export/export_excel.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 5b8accdae1a..3eafc454530 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; class ExportExcel extends ModeleExports { /** - * @var int ID + * @var string ID */ public $id; From 53c851de7b1e2df8a65f5c90b824a45405acd3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Apr 2019 11:42:25 +0200 Subject: [PATCH 053/162] Update export_csv.modules.php --- htdocs/core/modules/export/export_csv.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 79ec096b8de..c3c8431962e 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -33,7 +33,7 @@ set_time_limit(0); class ExportCsv extends ModeleExports { /** - * @var int ID + * @var string ID ex: csv, tsv, excel... */ public $id; From 6da42941a84edaa0c018d47efdc7fc3727bdf473 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Apr 2019 19:54:30 +0200 Subject: [PATCH 054/162] NEW Add attached document on bank account visible in automatic ECM. --- .../compta/bank/various_payment/document.php | 2 +- htdocs/core/ajax/ajaxdirpreview.php | 10 ++++--- htdocs/core/class/html.formfile.class.php | 26 ++++++++++++------- htdocs/core/lib/bank.lib.php | 2 +- htdocs/core/lib/files.lib.php | 4 +-- htdocs/document.php | 1 + htdocs/ecm/index_auto.php | 1 + 7 files changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 36e8546a897..02c3b331544 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -57,7 +57,7 @@ if (! $sortfield) $sortfield="name"; $object = new PaymentVarious($db); $object->fetch($id, $ref); -$upload_dir = $conf->banque->dir_output.'/'.dol_sanitizeFileName($object->id); +$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName($object->id); $modulepart='banque'; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 4490d7bff3c..538b398296d 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -179,7 +179,7 @@ if ($type == 'directory') $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); // Right area. If module is defined here, we are in automatic ecm. - $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday'); + $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday', 'banque'); // TODO change for multicompany sharing // Auto area for suppliers invoices @@ -212,12 +212,14 @@ if ($type == 'directory') elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; // Auto area for holiday elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output; + // Auto area for holiday + elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output; // Automatic list if (in_array($module, $automodules)) { $param.='&module='.$module; - if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; + if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.urlencode($search_doc_ref); $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); @@ -335,8 +337,8 @@ if ($useajax || $action == 'delete') $formquestion['section_id']=array('type'=>'hidden','value'=>$section_id,'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later $formquestion['section_dir']=array('type'=>'hidden','value'=>$section_dir,'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later if (! empty($action) && $action == 'file_manager') $formquestion['file_manager']=array('type'=>'hidden','value'=>1,'name'=>'file_manager'); - if (! empty($websitekey)) $formquestion['website']=array('type'=>'hidden','value'=>$websitekey,'name'=>'website'); - if (! empty($pageid) && $pageid > 0) $formquestion['pageid']=array('type'=>'hidden','value'=>$pageid,'name'=>'pageid'); + if (! empty($websitekey)) $formquestion['website'] =array('type'=>'hidden','value'=>$websitekey,'name'=>'website'); + if (! empty($pageid) && $pageid > 0) $formquestion['pageid'] =array('type'=>'hidden','value'=>$pageid,'name'=>'pageid'); print $form->formconfirm($url, $langs->trans("DeleteFile"), $langs->trans("ConfirmDeleteFile"), 'confirm_deletefile', $formquestion, "no", ($useajax?'deletefile':0)); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ccf5c9de6b2..d161f32d92a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1464,7 +1464,7 @@ class FormFile print '
'; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$langs->trans("Name").''; - else print ''; + print ''; print $nom; - if ($variantexxx) print ''.$variantexxx; print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $form = new Form($db); - $formaccounting = new FormAccounting($db); - - while ( $i < min($num_lines, $limit) ) { - $objp = $db->fetch_object($result); - print ''; - - print ''; - - print ''; - - // Colonne choix du compte - print ''; - - print ''; - - print ''; - - // Colonne choix ligne a ventiler - $checked = ('label' == 'O') ? ' checked' : ''; - - print ''; - - print ''; - $i ++; - } - - print ''; - - print '
' . $langs->trans("AccountAccouting") . '' . $langs->trans("label") . '' . $langs->trans("Accountparent") . '' . $langs->trans("Pcgtype") . '' . $langs->trans("Pcgsubtype") . '' . $langs->trans("Import") . '
'; - print $objp->accounting; - print ''; - print ''; - print ''; - print $formaccounting->select_account($accounting->account_parent, 'AccountParent'); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
 
'; - print ''; -} else { - print $db->error(); -} - -// End of page -llxFooter(); -$db->close(); From 633eb1d6c6c3b83f02907ad97926ef81d61a7752 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 13:28:42 +0200 Subject: [PATCH 074/162] Remove warning --- htdocs/core/class/antivir.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index 55bd3a8381d..4be4d175b47 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -94,6 +94,8 @@ class AntiVir // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% $lastline=exec($fullcommand, $output, $return_var); + if (is_null($output)) $output=array(); + //print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit; /* From 72025f6d5d8dd0e52d1fe036da0475827a5ab15b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 15:54:24 +0200 Subject: [PATCH 075/162] Fix CSS --- htdocs/expensereport/card.php | 32 ++++++++----- .../tpl/expensereport_linktofile.tpl.php | 48 +++++++++++++------ htdocs/theme/eldy/global.inc.php | 8 ++++ htdocs/theme/md/style.css.php | 9 ++++ 4 files changed, 72 insertions(+), 25 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 8f6f7c98c56..48535ba8f48 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -145,7 +145,11 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; - if (GETPOST('sendit', 'alpha')) $action=''; + if (GETPOSTISSET('sendit')) // If we just submit a file + { + if ($action == 'updateline') $action='editline'; // To avoid to make the updateline now + else $action=''; // To avoid to make the addline now + } include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -2004,7 +2008,7 @@ else print ''.$langs->trans("AmountExpected").':'.price($object->total_ttc).''; print ''.$langs->trans("RemainderToPay").':'; - print ''.price($resteapayeraffiche).''; + print ''.price($resteapayeraffiche).''; $db->free($resql); } @@ -2209,7 +2213,7 @@ else { print ''; - print 'rowid.'#'.$line->rowid.'">'; + print 'rowid.'">'; print img_edit(); print '   '; print 'rowid.'">'; @@ -2224,14 +2228,18 @@ else if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) { - - // Add line with link to add new file or attach to an existing file - $colspan = 12; + // Add line with link to add new file or attach line to an existing file + $colspan = 10; if (! empty($conf->projet->enabled)) $colspan++; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; print ''; - print ''; + + print ''; + print $numline; + print ''; + + print ''; print ''.$langs->trans("UploadANewFileNow"); print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; @@ -2355,7 +2363,9 @@ else } // Add a line - if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) + if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) + && $action != 'editline' + && $user->rights->expensereport->creer) { $colspan = 11; if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; @@ -2399,10 +2409,10 @@ else jQuery(".trattachnewfilenow").toggle(); jQuery(".truploadnewfilenow").hide(); return false; - });'; - if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) + });'."\n"; + if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')) && $action != 'updateline') { - print 'jQuery(".trattachnewfilenow").toggle();'."\n"; + print 'jQuery(".trattachnewfilenow").show();'."\n"; } print ' }); diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 4ea23418db8..48f21bc3dc2 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -17,35 +17,41 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; print ''; //print ''.$langs->trans("AttachTheNewLineToTheDocument").'
'; - $modulepart='expensereport';$maxheightmini=48; + $modulepart='expensereport'; $maxheightmini=48; $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; + $filei=0; foreach($arrayoffiles as $file) { - print '
'; - $fileinfo = pathinfo($file['name']); + $urlforhref=array(); + $filei++; + + print '
'; + $fileinfo = pathinfo($file['fullname']); if (image_format_supported($file['name']) > 0) { $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case however) than original //print $file['path'].'/'.$minifile.'
'; - $urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity)); + $urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity)); if (empty($urlforhref)) { $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($fileinfo['relativename'].'.'.strtolower($fileinfo['extension'])); print ''; } else { print ''; } - print '
'; + print '
'; print ''; print '
'; print '
'; } else { - $modulepart='expensereport'; - print ''; } + + print ''; + print ''; } else diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 73972698c43..3cec07bce27 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -446,7 +446,15 @@ textarea.centpercent { .cursornotallowed { cursor: not-allowed; } +.backgroundblank { + background-color: #fff; +} +.checkboxattachfilelabel { + font-size: 0.85em; + opacity: 0.7; +} +/* Themes for badges */ .borderrightlight diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index e4e30310e14..8b3b06b2d0d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -659,6 +659,15 @@ textarea.centpercent { .cursornotallowed { cursor: not-allowed; } +.backgroundblank { + background-color: #fff; +} +.checkboxattachfilelabel { + font-size: 0.85em; + opacity: 0.7; +} + +/* Themes for badges */ .badge { display: inline-block; min-width: 10px; From 742de5c77701d8247cf977ecbe3b860f1fae5c97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 16:04:53 +0200 Subject: [PATCH 076/162] Fix pdf of expense report --- .../modules/expensereport/doc/pdf_standard.modules.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 96665e1b819..050722b0b8e 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -326,7 +326,7 @@ class pdf_standard extends ModeleExpenseReport complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - + $tab_top = 95; $pdf->SetFont('', '', $default_font_size - 1); @@ -767,11 +767,10 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell(80, 4, $expense_receiver, 0, 'L'); } - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; - // Show recipient $posy=50; - $posx=10; + $posx=100; + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; // Show recipient frame $pdf->SetTextColor(0, 0, 0); From 3231e54abdd379d554edd6bc0c77eeb66f070531 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 23 Apr 2019 16:19:58 +0200 Subject: [PATCH 077/162] fix actioncomm module for long trigger names --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_actioncomm.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index cee3a17e061..380c64c28fc 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -560,3 +560,5 @@ UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element='mailing' ALTER TABLE llx_advtargetemailing DROP COLUMN fk_mailing; DROP TABLE llx_ticket_logs; + +ALTER TABLE llx_actioncomm MODIFY COLUMN code varchar(50); diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 72321e19db5..231dd3bad1a 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -29,7 +29,7 @@ create table llx_actioncomm datep2 datetime, -- date end fk_action integer, -- type of action (optional link with id in llx_c_actioncomm or null) - code varchar(32) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) + code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) datec datetime, -- date creation tms timestamp, -- date modification From 684e09fdcd39afe92ac4755044fd01a5760bc998 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 22:49:33 +0200 Subject: [PATCH 078/162] NEW Add function isValidVATID() --- htdocs/core/lib/functions2.lib.php | 22 ++++++++++++++++++++++ htdocs/variants/generator.php | 14 +++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 89c945d5ef4..16fb210ee4d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -564,6 +564,28 @@ function isValidUrl($url, $http = 0, $pass = 0, $port = 0, $path = 0, $query = 0 return $ValidUrl; } +/** + * Check if VAT numero is valid (check done on syntax only, no database or remote access) + * + * @param Societe $company VAT number + * @return int 1=Check is OK, 0=Check is KO + */ +function isValidVATID($company) +{ + if ($company->isInEEC()) // Syntax check rules for EEC countries + { + $vatprefix = $company->country_code; + if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; + else $vatprefix = preg_quote($vatprefix, '/'); + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,10}$/', $company->tva_intra)) + { + return 0; + } + } + + return 1; +} + /** * Clean an url string * diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index 3ab809028e9..b2b2b1bdfc6 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -41,6 +41,13 @@ $product = new Product($db); $product->fetch($id); +$error = 0; + + +/* + * Actions + */ + if (!$product->isProduct()) { header('Location: '.dol_buildpath('/product/card.php?id='.$product->id, 2)); exit(); @@ -59,8 +66,8 @@ $combinations = GETPOST('combinations', 'array'); $price_var_percent = (bool) GETPOST('price_var_percent'); $donotremove = true; -if ($_POST) { - +if ($_POST) +{ $donotremove = (bool) GETPOST('donotremove'); //We must check if all those given combinations actually exist @@ -102,7 +109,8 @@ if ($_POST) { $res = 1; - foreach (cartesianArray($adapted_values) as $currcomb) + $cartesianarray = cartesianArray($adapted_values); + foreach ($cartesianarray as $currcomb) { $res = $combination->createProductCombination($product, $currcomb, $sanitized_values, $price_var_percent); if ($res < 0) { From 41a82023e385046afbb9d68ff5eb308040288a7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 24 Apr 2019 08:17:10 +0200 Subject: [PATCH 079/162] FIX missing compatibility with multicompany --- htdocs/core/tpl/card_presend.tpl.php | 2 +- htdocs/user/class/user.class.php | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 58758daab09..54464488f0b 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -171,7 +171,7 @@ if ($action == 'presend') $listeuser=array(); $fuserdest = new User($db); - $result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\'')); + $result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''), 'AND', true); if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) { foreach($fuserdest->users as $uuserdest) { $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id,'email'); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a02b4916c91..8fd87c839c7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3206,15 +3206,38 @@ class User extends CommonObject * @param int $offset page * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) * @param string $filtermode Filter mode (AND or OR) + * @param bool $entityfilter Activate entity filter * @return int <0 if KO, >0 if OK */ - function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter=array(), $filtermode='AND') + function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter=array(), $filtermode='AND', $entityfilter=false) { global $conf; $sql="SELECT t.rowid"; $sql.= ' FROM '.MAIN_DB_PREFIX .$this->table_element.' as t '; - $sql.= " WHERE 1"; + + if ($entityfilter) + { + if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) + { + if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) { + $sql.= " WHERE t.entity IS NOT NULL"; // Show all users + } else { + $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql.= " WHERE ((ug.fk_user = t.rowid"; + $sql.= " AND ug.entity IN (".getEntity('user')."))"; + $sql.= " OR t.entity = 0)"; // Show always superadmin + } + } + else + { + $sql.= " WHERE t.entity IN (".getEntity('user').")"; + } + } + else + { + $sql.= " WHERE 1"; + } // Manage filter $sqlwhere = array(); From 740fddcd429398b54b09455e1762a9312c00b6a6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 24 Apr 2019 08:22:00 +0200 Subject: [PATCH 080/162] FIX missing global $user --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8fd87c839c7..1bfaa24c066 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3211,7 +3211,7 @@ class User extends CommonObject */ function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter=array(), $filtermode='AND', $entityfilter=false) { - global $conf; + global $conf, $user; $sql="SELECT t.rowid"; $sql.= ' FROM '.MAIN_DB_PREFIX .$this->table_element.' as t '; From 6e425d189561a8739231fbb7b91aa828fec8b35f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 24 Apr 2019 08:56:06 +0200 Subject: [PATCH 081/162] add origin of line in fourn orderstoinvoice.php --- htdocs/fourn/commande/orderstoinvoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 4c229518eba..82058d087b5 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -216,7 +216,7 @@ if (($action == 'create' || $action == 'add') && ! $error) { $fk_parent_line = 0; } // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type, -1, false, 0, $lines[$i]->fk_unit); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type, -1, false, 0, $lines[$i]->fk_unit, $line[$i]->id); if ($result > 0) { $lineid = $result; From dccc8b0be3ce0ba39591aa7812ce690e1e9497d5 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Wed, 24 Apr 2019 08:46:26 +0100 Subject: [PATCH 082/162] Fix:Same action in both cases --- htdocs/comm/action/index.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 84719bc8673..48165361d7c 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -614,18 +614,9 @@ if ($resql) // Defined date_start_in_calendar and date_end_in_calendar property // They are date start and end of action but modified to not be outside calendar view. - if ($event->percentage <= 0) - { - $event->date_start_in_calendar=$event->datep; - if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; - else $event->date_end_in_calendar=$event->datep; - } - else - { - $event->date_start_in_calendar=$event->datep; - if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; - else $event->date_end_in_calendar=$event->datep; - } + $event->date_start_in_calendar=$event->datep; + if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; + else $event->date_end_in_calendar=$event->datep; // Define ponctual property if ($event->date_start_in_calendar == $event->date_end_in_calendar) { From e0b71fd2585bde8b4c1bb3b7fdd191f1af190c6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 10:07:34 +0200 Subject: [PATCH 083/162] Fix size of column --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 2d45d94aafd..8bc8d691bbd 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -52,6 +52,9 @@ ALTER TABLE llx_actioncomm ADD COLUMN email_subject varchar(255) after email_msg ALTER TABLE llx_actioncomm ADD COLUMN email_tocc varchar(255) after email_to; ALTER TABLE llx_actioncomm ADD COLUMN email_tobcc varchar(255) after email_tocc; +ALTER TABLE llx_actioncomm MODIFY COLUMN code varchar(50); + + -- For 9.0 ALTER TABLE llx_extrafields ADD COLUMN help text NULL; ALTER TABLE llx_extrafields ADD COLUMN totalizable boolean DEFAULT FALSE after list; From 8025fb1ac1b5577498ae614458276ab0298e2448 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 10:07:58 +0200 Subject: [PATCH 084/162] Fix size of column --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 6d1c1144ddf..232a4709cee 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -29,6 +29,8 @@ -- Missing in 9.0 +ALTER TABLE llx_actioncomm MODIFY COLUMN code varchar(50); + DROP TABLE llx_ticket_logs; CREATE TABLE llx_pos_cash_fence( From f5fb8363d8ec046c6cbf98722c102561670de051 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 10:26:57 +0200 Subject: [PATCH 085/162] FIX #11041 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ca074c87070..32159e7e639 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -59,7 +59,7 @@ class Societe extends CommonObject public $fieldsforcombobox='nom,name_alias'; protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object - protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); + protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); public $picto = 'company'; /** From 8e626ad463f7f5e0e7df98672f04b97121bcde0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 10:51:26 +0200 Subject: [PATCH 086/162] Fic xss --- htdocs/societe/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 1cee0191f6c..4162808e967 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -87,7 +87,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { From f0bb9288bf731130ae560b297ed5db5b011f8d6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 11:23:49 +0200 Subject: [PATCH 087/162] FIX #11013 --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/tpl/notes.tpl.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 52f26d0da1c..b14a5cb4fb5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -235,9 +235,9 @@ class Form } else if (preg_match('/^ckeditor/',$typeofdata)) { - $tmp=explode(':',$typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols + $tmp=explode(':',$typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[5]?$tmp[5]:0), true, true, ($tmp[6]?$tmp[6]:'20'), ($tmp[7]?$tmp[7]:'100')); + $doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[5]?$tmp[5]:0), (isset($tmp[8])?($tmp[8]?true:false):true), true, ($tmp[6]?$tmp[6]:'20'), ($tmp[7]?$tmp[7]:'100')); $ret.=$doleditor->Create(1); } if (empty($notabletag)) $ret.=''; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 39e5c545f1b..1dc9f55a80b 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -71,7 +71,7 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr elseif ($module == 'product') { $permission=$user->rights->produit->creer;} //else dol_print_error('','Bad value '.$module.' for param module'); -if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note. +if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note. else $typeofdata='textarea:12:95%'; print ''."\n"; From f8c381f069ec210644a4d7a6f9dab0be483825e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 12:02:03 +0200 Subject: [PATCH 088/162] Fix label for API 2019-02-19 --- htdocs/public/payment/newpayment.php | 4 ++-- htdocs/stripe/class/stripe.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index ac873ad13b5..1d3f14c3a37 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -484,7 +484,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, - 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt + 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) ), array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) @@ -532,7 +532,7 @@ $charge = \Stripe\Charge::create(array( 'capture' => true, // Charge immediatly 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, 'metadata' => $metadata, - 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt + 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) ), array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 8aad2a1b891..0ebef813429 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -319,7 +319,7 @@ class Stripe extends CommonObject "currency" => $object->multicurrency_code, "customer" => $customer, "allowed_source_types" => ["card"], - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "metadata" => array('dol_type'=>$object->element, 'dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])) ); @@ -557,7 +557,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -567,7 +567,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -594,7 +594,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From 57ce70bbc900fb8b542a52c3a8c6384fbea390e6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 24 Apr 2019 13:08:13 +0200 Subject: [PATCH 089/162] NEW enhancement management of webhooks active / inactive and sync only needed events --- htdocs/stripe/admin/stripe.php | 82 +++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 12 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 5e2c27dd392..1336bed8575 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $servicename='Stripe'; @@ -150,6 +151,8 @@ print ''; dol_fiche_head($head, 'stripeaccount', '', -1); +$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','source.chargeable','customer.deleted'); + print $langs->trans("StripeDesc")."
\n"; print '
'; @@ -158,6 +161,7 @@ print '
'; print ''; print ''; print ''; +print ''; print "\n"; print ''; @@ -177,24 +181,51 @@ if (empty($conf->stripeconnect->enabled)) print ''.$langs->trans("STRIPE_TEST_PUBLISHABLE_KEY").''; + print ''; print ''; + print ''; print ''; + print '
'.$out; + print ''; } else { print ''; print ''; + print ''; print ''; + print ''; print ''; + print '
'.$out; + print ''; } else { From 6d06f128e775606680593f628307c53b29c47d2a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 24 Apr 2019 13:51:41 +0200 Subject: [PATCH 090/162] Update stripe.php --- htdocs/stripe/admin/stripe.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 1336bed8575..f0b9c6361bf 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -199,15 +199,15 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php?test', 2); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); - print '
'.$out; + print '
'.$out; print '
'; } else { print ''; @@ -267,9 +267,9 @@ if ( !empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STR \Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY); $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID); $endpoint->enabled_events = $stripearrayofwebhookevents; -if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { -if ( empty( GETPOST('status','alpha') )) { -$endpoint->disabled = true; +if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { +if ( empty( GETPOST('status', 'alpha') )) { +$endpoint->disabled = true; } else { $endpoint->disabled = false; }} @@ -278,15 +278,15 @@ $endpoint->save(); if ($endpoint->status == 'enabled') { print ''; - print img_picto($langs->trans("Activated"),'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; -} else print img_picto($langs->trans("inactive"),'statut5'); +} else print img_picto($langs->trans("inactive"), 'statut5'); print ''; } else From 99e56f9cfa455574b8c8028bdace07e0f7976229 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 24 Apr 2019 14:53:31 +0200 Subject: [PATCH 091/162] Update stripe.php --- htdocs/stripe/admin/stripe.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index f0b9c6361bf..50d4fbf281b 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -209,7 +209,7 @@ if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { if ( empty( GETPOST('status', 'alpha') )) { $endpoint->disabled = true; } else { -$endpoint->disabled = false; + $endpoint->disabled = false; }} $endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 2); $endpoint->save(); @@ -269,9 +269,9 @@ $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK $endpoint->enabled_events = $stripearrayofwebhookevents; if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { if ( empty( GETPOST('status', 'alpha') )) { -$endpoint->disabled = true; + $endpoint->disabled = true; } else { -$endpoint->disabled = false; + $endpoint->disabled = false; }} $endpoint->url = dol_buildpath('/public/stripe/ipn.php', 2); $endpoint->save(); From 70017da95ac0db4c16ad4041f0bdd5ea5fea28f7 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 24 Apr 2019 14:59:54 +0200 Subject: [PATCH 092/162] testing if customer invoice module is activated doesn't make sense on supplier commande card... --- htdocs/fourn/commande/card.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a6629b9bd25..7b3561a0bf0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2342,14 +2342,11 @@ elseif (! empty($object->id)) } // Create bill - if (! empty($conf->facture->enabled)) + if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled { - if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled + if ($user->rights->fournisseur->facture->creer) { - if ($user->rights->fournisseur->facture->creer) - { - print ''.$langs->trans("CreateBill").''; - } + print ''.$langs->trans("CreateBill").''; } } From c485cc7a89b853f1ef596e712cabc33b4ab5c963 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 24 Apr 2019 15:41:08 +0200 Subject: [PATCH 093/162] Update stripe.php --- htdocs/stripe/admin/stripe.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 50d4fbf281b..54102b99df5 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -206,7 +206,7 @@ if ( !empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STR $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID); $endpoint->enabled_events = $stripearrayofwebhookevents; if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { -if ( empty( GETPOST('status', 'alpha') )) { +if ( empty(GETPOST('status', 'alpha')) ) { $endpoint->disabled = true; } else { $endpoint->disabled = false; @@ -261,14 +261,14 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php', 2); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); - print '
'.$out; + print '
'.$out; print '
'; @@ -222,11 +222,11 @@ if (empty($conf->stripeconnect->enabled)) print ''; From 79c37f2226574b9ee3e5110f415ee443686e2e78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 18:47:11 +0200 Subject: [PATCH 096/162] Fix link for endpoint --- htdocs/core/lib/payments.lib.php | 37 ++++++++++++++++++++------------ htdocs/stripe/admin/stripe.php | 8 +++++-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 70f3e87eaf9..b73d59c6cfd 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -142,23 +142,32 @@ function showOnlinePaymentUrl($type, $ref) /** * Return string with full Url * - * @param int $mode 0=True url, 1=Url formated with colors - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) - * @param string $ref Ref of object - * @param int $amount Amount (required for $type='free' only) - * @param string $freetag Free tag - * @return string Url string + * @param int $mode 0=True url, 1=Url formated with colors + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) + * @param string $ref Ref of object + * @param int $amount Amount (required for $type='free' only) + * @param string $freetag Free tag + * @param string $localorexternal 0=Url for browser, 1=Url for external access + * @return string Url string */ -function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag') +function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag', $localorexternal=0) { - global $conf; + global $conf, $dolibarr_main_url_root; $ref=str_replace(' ', '', $ref); $out=''; + // Define $urlwithroot + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + $urltouse = DOL_MAIN_URL_ROOT; + if ($localorexternal) $urltouse = $urlwithroot; + if ($type == 'free') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'':'').$amount.($mode?'':'').'&tag='.($mode?'':'').$freetag.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?amount='.($mode?'':'').$amount.($mode?'':'').'&tag='.($mode?'':'').$freetag.($mode?'':''); if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; @@ -167,7 +176,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } elseif ($type == 'order') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode?'':''); if ($mode == 1) $out.='order_ref'; if ($mode == 0) $out.=urlencode($ref); $out.=($mode?'':''); @@ -185,7 +194,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } elseif ($type == 'invoice') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'':''); if ($mode == 1) $out.='invoice_ref'; if ($mode == 0) $out.=urlencode($ref); $out.=($mode?'':''); @@ -203,7 +212,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } elseif ($type == 'contractline') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'':''); if ($mode == 1) $out.='contractline_ref'; if ($mode == 0) $out.=urlencode($ref); $out.=($mode?'':''); @@ -221,7 +230,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } elseif ($type == 'member' || $type == 'membersubscription') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'':''); if ($mode == 1) $out.='member_ref'; if ($mode == 0) $out.=urlencode($ref); $out.=($mode?'':''); @@ -239,7 +248,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } if ($type == 'donation') { - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'':''); + $out=$urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode?'':''); if ($mode == 1) $out.='donation_ref'; if ($mode == 0) $out.=urlencode($ref); $out.=($mode?'':''); diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 39a9c1a249d..454dbb23775 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -41,6 +41,10 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); +/* + * Actions + */ + if ($action == 'setvalue' && $user->admin) { $db->begin(); @@ -190,7 +194,7 @@ if (empty($conf->stripeconnect->enabled)) print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; - $url = dol_buildpath('/public/stripe/ipn.php?test', 2); + $url = dol_buildpath('/public/stripe/ipn.php?test', 3); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); print '
'.$out; @@ -225,7 +229,7 @@ if (empty($conf->stripeconnect->enabled)) print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; - $url = dol_buildpath('/public/stripe/ipn.php', 2); + $url = dol_buildpath('/public/stripe/ipn.php', 3); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); print '
'.$out; From 8d2850659516e1a343d26df4d87d8d06aed42bce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 19:25:04 +0200 Subject: [PATCH 097/162] Better code --- htdocs/public/payment/newpayment.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1d3f14c3a37..613505b873c 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1727,26 +1727,28 @@ if (preg_match('/^dopayment/', $action))
'.$langs->trans("AccountParameter").''.$langs->trans("Value").''.$langs->trans("Status").'
'; print ''; print '   '.$langs->trans("Example").': pk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; - print '
'; print ''.$langs->trans("STRIPE_TEST_SECRET_KEY").''; print ''; print '   '.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; - print '
'; - print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; + print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; $url = dol_buildpath('/public/stripe/ipn.php?test', 2); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); - print '
'.$out; - print '
'; +if ( !empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STRIPE_TEST_SECRET_KEY) && !empty($conf->global->STRIPE_TEST_WEBHOOK_ID) ) { +\Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY); +$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID); +$endpoint->enabled_events = $stripearrayofwebhookevents; +if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { +if ( empty( GETPOST('status','alpha') )) { +$endpoint->disabled = true; +} else { +$endpoint->disabled = false; +}} +$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 2); +$endpoint->save(); +if ($endpoint->status == 'enabled') +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +//print $endpoint; +} else print img_picto($langs->trans("inactive"),'statut5'); + print'
'.$langs->trans("StripeConnect").''.$langs->trans("StripeConnect_Mode").'
'; @@ -212,24 +243,51 @@ if (empty($conf->stripeconnect->enabled)) print ''.$langs->trans("STRIPE_LIVE_PUBLISHABLE_KEY").'
'; print ''; print '   '.$langs->trans("Example").': pk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; - print '
'; print ''.$langs->trans("STRIPE_LIVE_SECRET_KEY").''; print ''; print '   '.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; - print '
'; - print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; $url = dol_buildpath('/public/stripe/ipn.php', 2); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); - print '
'.$out; - print '
'; +if ( !empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STRIPE_LIVE_SECRET_KEY) && !empty($conf->global->STRIPE_LIVE_WEBHOOK_ID) ) { +\Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY); +$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID); +$endpoint->enabled_events = $stripearrayofwebhookevents; +if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { +if ( empty( GETPOST('status','alpha') )) { +$endpoint->disabled = true; +} else { +$endpoint->disabled = false; +}} +$endpoint->url = dol_buildpath('/public/stripe/ipn.php', 2); +$endpoint->save(); +if ($endpoint->status == 'enabled') +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +//print $endpoint; +} else print img_picto($langs->trans("inactive"),'statut5'); + print '
'; if ( !empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STRIPE_TEST_SECRET_KEY) && !empty($conf->global->STRIPE_TEST_WEBHOOK_ID) ) { \Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY); $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID); $endpoint->enabled_events = $stripearrayofwebhookevents; -if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { -if ( empty( GETPOST('status','alpha') )) { -$endpoint->disabled = true; +if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { +if ( empty( GETPOST('status', 'alpha') )) { + $endpoint->disabled = true; } else { $endpoint->disabled = false; }} @@ -216,15 +216,15 @@ $endpoint->save(); if ($endpoint->status == 'enabled') { print ''; - print img_picto($langs->trans("Activated"),'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; -} else print img_picto($langs->trans("inactive"),'statut5'); +} else print img_picto($langs->trans("inactive"), 'statut5'); print'
'.$langs->trans("StripeConnect").'
'; if ( !empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STRIPE_LIVE_SECRET_KEY) && !empty($conf->global->STRIPE_LIVE_WEBHOOK_ID) ) { \Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY); $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID); $endpoint->enabled_events = $stripearrayofwebhookevents; if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { -if ( empty( GETPOST('status', 'alpha') )) { +if ( empty(GETPOST('status', 'alpha')) ) { $endpoint->disabled = true; } else { $endpoint->disabled = false; From 0583cf7804ab5261e7e0dc6af5ca1af652c4ae09 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 24 Apr 2019 15:44:57 +0200 Subject: [PATCH 094/162] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9c7fcfc5baa..df7c5c5558c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2019 Thibault Foucart + * Copyright (C) 2018-2019 Thibault Foucart * * 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 From fe3fe60efc805162d093a49a36fba06ef76aa1fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 18:31:11 +0200 Subject: [PATCH 095/162] Cleaner setup page --- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 45 ++++++++++++---------- htdocs/langs/en_US/stripe.lang | 4 +- htdocs/stripe/admin/stripe.php | 14 +++---- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index b32fcf3658a..990368d8738 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -29,21 +29,22 @@ print ''; // Url list print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':

'; print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':
'; -print ''.getOnlinePaymentUrl(1, 'free')."

\n"; +print ''.getOnlinePaymentUrl(1, 'free')."

\n"; if (! empty($conf->commande->enabled)) { - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':
'; - print ''.getOnlinePaymentUrl(1, 'order')."
\n"; + print '
'; + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':
'; + print ''.getOnlinePaymentUrl(1, 'order')."
\n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $langs->load("orders"); - print '
'; + print ''; print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; print ''; print ''; if (GETPOST('generate_order_ref', 'alpha')) { - print '
-> '; + print '
-> '; $url=getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); print $url; print "
\n"; @@ -54,18 +55,19 @@ if (! empty($conf->commande->enabled)) } if (! empty($conf->facture->enabled)) { - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':
'; - print ''.getOnlinePaymentUrl(1, 'invoice')."
\n"; + print '
'; + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':
'; + print ''.getOnlinePaymentUrl(1, 'invoice')."
\n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $langs->load("bills"); - print ''; + print ''; print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; print ''; print ''; if (GETPOST('generate_invoice_ref', 'alpha')) { - print '
-> '; + print '
-> '; $url=getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); print $url; print "
\n"; @@ -76,18 +78,19 @@ if (! empty($conf->facture->enabled)) } if (! empty($conf->contrat->enabled)) { - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':
'; - print ''.getOnlinePaymentUrl(1, 'contractline')."
\n"; + print '
'; + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':
'; + print ''.getOnlinePaymentUrl(1, 'contractline')."
\n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $langs->load("contracts"); - print ''; + print ''; print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; print ''; print ''; if (GETPOST('generate_contract_ref')) { - print '
-> '; + print '
-> '; $url=getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); print $url; print "
\n"; @@ -98,18 +101,19 @@ if (! empty($conf->contrat->enabled)) } if (! empty($conf->adherent->enabled)) { - print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':
'; - print ''.getOnlinePaymentUrl(1, 'membersubscription')."
\n"; + print '
'; + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':
'; + print ''.getOnlinePaymentUrl(1, 'membersubscription')."
\n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $langs->load("members"); - print ''; + print ''; print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; print ''; print ''; if (GETPOST('generate_member_ref')) { - print '
-> '; + print '
-> '; $url=getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); print $url; print "
\n"; @@ -120,18 +124,19 @@ if (! empty($conf->adherent->enabled)) } if (! empty($conf->don->enabled)) { + print '
'; print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':
'; - print ''.getOnlinePaymentUrl(1, 'donation')."
\n"; + print ''.getOnlinePaymentUrl(1, 'donation')."
\n"; if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $langs->load("members"); - print ''; + print ''; print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; print ''; print ''; if (GETPOST('generate_donation_ref')) { - print '
-> '; + print '
-> '; $url=getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha')); print $url; print "
\n"; diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 46de5f4485b..64ce7b15aff 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -62,4 +62,6 @@ CreateCustomerOnStripe=Create customer on Stripe CreateCardOnStripe=Create card on Stripe ShowInStripe=Show in Stripe StripeUserAccountForActions=User account to use for email notification of some Stripe events (Stripe payouts) -StripePayoutList=List of Stripe payouts \ No newline at end of file +StripePayoutList=List of Stripe payouts +ToOfferALinkForTestWebhook=Link to setup Stripe WebHook to call the IPN (test mode) +ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mode) \ No newline at end of file diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 5e2c27dd392..39a9c1a249d 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -187,11 +187,11 @@ if (empty($conf->stripeconnect->enabled)) print '
'; print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; - print ''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php?test', 2); - $out.= ''; + $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); print '
'.$out; print '
'; print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; - print ''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; - $url = dol_buildpath('/public/stripe/ipn.php', 2); - $out.= ''; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; + $url = dol_buildpath('/public/stripe/ipn.php', 2); + $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); print '
'.$out; print '
- + +
+ +
+
- + '."\n"; - - - '."\n"; + // Code to ask the credit card. This use the default "API version". No way to force API version when using JS code. + print '