From 8a786758b7d9fb7e3abb50044f8da0a9605ff37c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 4 Apr 2019 11:45:54 +0200 Subject: [PATCH 01/38] NEW browser mobil app support --- htdocs/main.inc.php | 13 ++++ .../theme/common/appli_dolibarr_256x256.png | Bin 0 -> 4008 bytes htdocs/theme/eldy/manifest.json.php | 57 ++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 htdocs/theme/common/appli_dolibarr_256x256.png create mode 100644 htdocs/theme/eldy/manifest.json.php diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 74069429043..25a64966b79 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1234,6 +1234,19 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; + // Mobile appli like icon + $manifest=dol_buildpath('/theme/'.$conf->theme.'/manifest.json.php', 1, 1); + if(!empty($manifest)){ + print ''."\n"; + } + + if(!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) { + // TODO: use auto theme color switch + print '' . "\n"; + } + + + // Auto refresh page if (GETPOST('autorefresh', 'int') > 0) print ''; diff --git a/htdocs/theme/common/appli_dolibarr_256x256.png b/htdocs/theme/common/appli_dolibarr_256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..970f841001bbd165a955f094f6505a75fe7b5fb6 GIT binary patch literal 4008 zcmYk92{hDS8^`aA8OzMr*C9-0mu#sJ1|v(BtXU%aHpsptHKc^>dm)9iShAC7?1U5% z*(S2r*t7Fa@Bjav^Pcm&zx&*KzUQ8M?sJ##C;FFe@@e2E(XMj>sSs!8zo-#J14CZ>FyMennE3sTh75Q}gY2&)2f z>M0GJq1pBAE<{m5A<>-{Se^;7%%VJi(Q%Cnmp7eoPxUGTP#G z6>sA(#C>KX9pE@1p$Ul#zYDUd_}`k}-f8j)~7prZz805WYsA_Ncs zNDQI-sYVa`r$H)%sloror1Ml5ILL()elT8zLMY2f%%{Q9!)zlUSUMQEiv}AiSZV-- zxc(0GkAfn?_%Q++uyejS*g)*B?w^@a{*pqO>&@n(hRrDh&kM%ti(RbGX0(b{%&~>u zd8?RhJ;8vlof#+^b-$41c{x^(t(?v09t;~I3}Yp>%4&W*QuMB8bH)cXj1EuQdCFLt z9+Rk+$T8IuN@;&!x1@%((=%(_O9I2>M!__Bw{(tpHWS|7vez$fYR+%!fYcy0 z+nsH?G@UFyo{!%hf*egQ1f5WD840U+U+@mDbdTksV&>DPhFK!J(PdS5_E z&JA9%$=d}Z9@Y6)XPpQQiIAOUgEHO}79Rt%*B@$Y-ZxFy&sbBBAlptWEA&wr4_-L* zX zi|TulIqp`SVN$z(em)NdRoV#+Rk}MBS=}?w@WG=WE{rCW(&@)Bs8ZMEM#6%pj8l{M$)( z&ZV%+2r3eemCSywvvm;0`n2BVgdcnr5R5q{AJ_PHpDVd6AqmMlfHVq;hb=5Q$%ef@ zS0Nga2*L7u`q=O68}!p{4s|=TcWKnvReccYS4sr5#P zho|@PAR*vReVDGAt~tgm{4K0al#-GkqZbBk;HSKd32j;O3epN+`GvSvAHz&O(zrYl z;NhEO8NKk1_fta6+@Jc4A+fkTvYUIF+134!Q26dLRak)Pojt(M%X4a-TxH>qGP%DL z9Mw(@(c)`pt@rxowymG29&zwo?J%E)26ul)SOZ?vPM^M)GIuR+5V0ZjqWJjF85k(V zv02OY2@S_{njT}K3%W?mYj#F9A)j zqpRcgH!K=cvrb5d;C^lP!nFB2IMCB73UbplNyZ<6x$DW|9 zRobmBX*cZ~h{=w-^8!K(>cX?1FKLK3?RfXlxi$8t%A;@b0U8HwSusQZl8N-tD&lHJ z`(VC0mB2}Y^s6MxxEM4KB^i7OF>Zd#-S(`3TiUocgNUr|q$(ZEz&=4s2)H*o{;HA) zoqrM*GMoGvJFF*NaElR*<-p?t=VOmY0!SY4!>gT)MO$-z*~qUdjM&oX=R5left+UN zSU8EFn<1)4x3ZD2@r3HJwO=%2PrmoH&79C!wBdtc#4YvG*_XGCIkD4BI#BHH=_tfP zXCO(pJ$^3dzxwZ#-tfCDb-A@G;iQ_tnFl${|SXA$_ozR_<0#t zPo4zfn~*A;1R+&F`IYB+Lv{k^{ahS%qI`e^uL(R)I0@o?HvQ7TfSfEA`2|JF|7NtH z?Fh0QepL;ibj4rVMTB>jk395>9(32DCDhOfg`SCwgxUUnfzHe`YlcxJ3~B@zpVPs3 zD_s?fZo1Q zoFNEI1k#v=6FSi>zYJuhSmSD6r~w(_Q;{#hBWIS{m*t!$#zV7Ah?ra<9nS(pkj5l&(9ZK8TUl1zj{QRh-bY5Q0<3S1uoARmqVT@Z=v{EQp z+sJV0asiLe`IpyO3HIbjJ4c5%FY)=l=S2`s7Rh}4$_jEZ9>KE#CAd@J;Ai)=V#nvc z<dp!?SG*`xzqQnRrvOZS6oLnF>L-yg#6p)eOxb=t*aUl@ilRYXOsQ!6yvvTJ#5 z93NN>$QnNv(agN@1zW^ejt~%sqxgRAkGFKU`I)F%P~|A&=mhvTZ60qwZG6)8s^?pa zbI{L>p}}YxXd<0hq3`U#XsbO9Yr@9neajaRH9lZ<(vgXs=deuqoTt0sCX8}U9w zVeAH`Tg;TCgIvw?OrS?+%S;5$&$Li!$%v_zSf0ag4k9bM$lLG5LJh17{^XpZ(n@g4 z((aeYKB2zlwvGSdRLS30R=~jy!=O`jG=}wjuFS>tYsIJ9A56{JV5$KEqD6f(XRfq( zb80-7S-jff*tbbJ(?Ckh<9;4bTA7XF>|7+;A-VE$+fo&`HomTAG}YJ@vvVJDwgr)= zaHPbQk)W?ABW-VDguATsbs<%RKJME~RCXWDhDNeDStQ&`z@tv{0d*TaT}%QhK7m&M z5la6d%J5C9OoMKe@p#<|s&51Xw)5D(_D`tHzCO06vJ|J~R&9UbH$0NZ|8s@+XOYWO z%X-~am40%zy~2DR7UVJ$E+3M5bvIj0cOAcJSCrdb5LrD_B>6R4qU1E?RbU-Y$h+Qn zc>1cy@a=#|-+9s@ATtZTTYF8(81E%3eR;K1Eb-n!j^1$<#ex=HG`)UkZ6gW;b!XVD zW7v!ygx)W58!| zihJY>@lRtR*|3R5#a@!hh&Z(PcEo1ado12TWBo`b2|_gOl6({Dyp>@}|GVOY5rlE$ zB>XzVo4{euo)EuQn}*iz)}Uw4k38g*DTYVSbOHz19=Q%(4ZwzEW5am|qISTXb%ZM7;Oqe8qi!H7-rBfmH6Y<$*tPhl7MAo#elI5UT=auf1 z<@DSmBw-V2zncCv{D*hURIbR8|8{r&?rd;^xULihKH|2F+fA()=2tFSinPxl458si zB>xzX@fFI-9BSElRxOJ1#-aMEvq2%83^}5*StSchwAi^3-cR=GGo!K9^%`ly zF{p~$SC~$0n>bb0?C2P#(6ERs*Rchz;qa9l>IN}{mX0=3S$&x62kyi6rd=Ad;e9?0&t{*;dI9kQ2%AdyMIN0<61Nj1sEzo zbfYF7F#bCVg)%8biKRg0Rp>JSy&Vcf01-y@FK_-OJw9+#8!pvMvAB1EN!SA}-vI+V Q3RVMc4Sigxnr*~?0Ios=rvLx| literal 0 HcmV?d00001 diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php new file mode 100644 index 00000000000..ef5459cf600 --- /dev/null +++ b/htdocs/theme/eldy/manifest.json.php @@ -0,0 +1,57 @@ + + * Copyright (C) 2006 Rodolphe Quiedeville + * Copyright (C) 2007-2017 Regis Houssin + * Copyright (C) 2011 Philippe Grand + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 FI8TNESS 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/theme/eldy/manifest.json.php + * \brief File for The Web App + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require_once __DIR__.'/../../main.inc.php'; + +$appli=constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; + +?> +{ + "name": "", + "icons": [ + { + "src": "", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} From 788e7a40a8f784e221b1f2f3204408af6a9f8977 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 4 Apr 2019 11:47:07 +0200 Subject: [PATCH 02/38] remove space --- htdocs/main.inc.php | 2 -- htdocs/theme/eldy/manifest.json.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 25a64966b79..9b12f892ea9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1245,8 +1245,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print '' . "\n"; } - - // Auto refresh page if (GETPOST('autorefresh', 'int') > 0) print ''; diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index ef5459cf600..afaa3a4258c 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -54,4 +54,4 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP "theme_color": "#ffffff", "background_color": "#ffffff", "display": "standalone" -} +} \ No newline at end of file From d993d80a130f72efdcb4d067645951b9966a3bb9 Mon Sep 17 00:00:00 2001 From: ATM John BOTELLA Date: Sat, 18 May 2019 16:27:57 +0200 Subject: [PATCH 03/38] FIX url --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index da077045cdc..e386a4ad2cf 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1227,7 +1227,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Favicon - $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1); + $favicon = DOL_MAIN_URL_ROOT . '/theme/'.$conf->theme.'/img/favicon.ico'; if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (empty($conf->dol_use_jmobile)) print ''."\n"; // Not required into an Android webview //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; @@ -1235,7 +1235,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; // Mobile appli like icon - $manifest=dol_buildpath('/theme/'.$conf->theme.'/manifest.json.php', 1, 1); + $manifest = DOL_MAIN_URL_ROOT . '/theme/'.$conf->theme.'/manifest.json.php'; if(!empty($manifest)){ print ''."\n"; } From b6615eab36be93a520550536803cd3feaa1a335e Mon Sep 17 00:00:00 2001 From: ATM John BOTELLA Date: Sat, 18 May 2019 23:47:22 +0200 Subject: [PATCH 04/38] FIX travis --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 51b4c0580e0..49ca337f800 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1947,7 +1947,7 @@ if (preg_match('/^dopayment/', $action)) { print info_admin($langs->trans("ErrorModuleSetupNotComplete", "stripe"), 0, 0, 'error'); } - else + else { print ''."\n"; From c6ab092af18efd3e75a72ccf082a48630cc08e48 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Jun 2019 09:12:53 +0200 Subject: [PATCH 05/38] add capacity value for product --- htdocs/install/mysql/tables/llx_product.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index fb6e4cf5f1a..953a087f189 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -69,6 +69,8 @@ create table llx_product accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. + capacity float DEFAULT NULL, + capcity_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From f7134340e8946fcc32ff14674a4431d95b1b3cfb Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 13:22:01 +0200 Subject: [PATCH 06/38] Update llx_product.sql --- htdocs/install/mysql/tables/llx_product.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 953a087f189..1603ee52eff 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -70,7 +70,7 @@ create table llx_product accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. capacity float DEFAULT NULL, - capcity_units tinyint DEFAULT NULL, + capacity_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From f5f6882583398a27c45861c86794d552a3c703b4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 13:42:50 +0200 Subject: [PATCH 07/38] Update product.class.php --- htdocs/product/class/product.class.php | 158 ++++++++++++++++++------- 1 file changed, 114 insertions(+), 44 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index de0d28cee83..7d323ebadcf 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -59,7 +59,10 @@ class Product extends CommonObject */ public $fk_element='fk_product'; - protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables=array('supplier_proposaldet', 'propaldet', 'commandedet', 'facturedet', 'contratdet', 'facture_fourn_det', 'commande_fournisseurdet'); /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -254,6 +257,8 @@ class Product extends CommonObject public $url; //! Unites de mesure + public $capacity; + public $capacity_units; public $weight; public $weight_units; public $length; @@ -269,13 +274,26 @@ class Product extends CommonObject public $accountancy_code_buy; /** - * Main barcode - * barcode value + * Main Barcode value * * @var string */ public $barcode; + /** + * Main Barcode type ID + * + * @var int + */ + public $barcode_type; + + /** + * Main Barcode type code + * + * @var string + */ + public $barcode_type_code; + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @@ -291,7 +309,7 @@ class Product extends CommonObject public $multilangs=array(); - //! Taille de l'image + //! Size of image public $imgWidth; public $imgHeight; @@ -345,16 +363,7 @@ class Product extends CommonObject public $fields = array( - 'rowid' => array( - 'type'=>'integer', - 'label'=>'TechnicalID', - 'enabled'=>1, - 'visible'=>-2, - 'notnull'=>1, - 'index'=>1, - 'position'=>1, - 'comment'=>'Id', - ), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), @@ -799,6 +808,8 @@ class Product extends CommonObject $this->label = trim($this->label); $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); + $this->capacity = price2num($this->capacity); + $this->capacity_units = trim($this->capacity_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -945,6 +956,8 @@ class Product extends CommonObject $sql.= ", tobuy = " . (int) $this->status_buy; $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); + $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacityt_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); @@ -2101,6 +2114,8 @@ class Product extends CommonObject $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1); $this->canvas = $obj->canvas; + $this->capacity = $obj->capacity; + $this->capacity_units = $obj->capacity_units; $this->weight = $obj->weight; $this->weight_units = $obj->weight_units; $this->length = $obj->length; @@ -3246,6 +3261,57 @@ class Product extends CommonObject return $this->_get_stats($sql, $mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return nb of units or orders in which product is included + * + * @param int $socid Limit count on a particular third party id + * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities + * @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only + * @param int $year Year (0=last 12 month) + * @param string $morefilter More sql filters + * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 + */ + public function get_nb_contract($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '') + { + // phpcs:enable + global $conf, $user; + + $sql = "SELECT sum(d.qty), date_format(c.date_contrat, '%Y%m')"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT c.rowid)"; + } + $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; + } + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql.= " WHERE c.rowid = d.fk_contrat"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; + } + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + } + $sql.= " AND c.fk_soc = s.rowid"; + $sql.= " AND c.entity IN (".getEntity('contract').")"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + } + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; + } + $sql.=$morefilter; + $sql.= " GROUP BY date_format(c.date_contrat,'%Y%m')"; + $sql.= " ORDER BY date_format(c.date_contrat,'%Y%m') DESC"; + + return $this->_get_stats($sql, $mode, $year); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Link a product/service to a parent product/service @@ -3662,7 +3728,7 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits - * Define value of this->res + * Define value of this->res * * @param array $prod Products array * @param string $compl_path Directory path of parents to add before @@ -3676,7 +3742,7 @@ class Product extends CommonObject // phpcs:enable global $conf,$langs; - $product = new Product($this->db); + $tmpproduct = null; //var_dump($prod); foreach($prod as $id_product => $desc_pere) // $id_product is 0 (first call starting with root top) or an id of a sub_product { @@ -3692,23 +3758,26 @@ class Product extends CommonObject } //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; - $this->fetch($id); // Load product - $this->load_stock('nobatch,novirtual'); // Load stock to get true this->stock_reel + if (is_null($tmpproduct)) $tmpproduct = new Product($this->db); // So we initialize tmpproduct only once for all loop. + $tmpproduct->fetch($id); // Load product to get ->ref + $tmpproduct->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel + //$this->fetch($id); // Load product to get ->ref + //$this->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel $this->res[]= array( - 'id'=>$id, // Id product - 'id_parent'=>$id_parent, - 'ref'=>$this->ref, // Ref product - 'nb'=>$nb, // Nb of units that compose parent product - 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product - 'stock'=>$this->stock_reel, // Stock - 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert - 'label'=>$label, - 'fullpath'=>$compl_path.$label, // Label - 'type'=>$type, // Nb of units that compose parent product - 'desiredstock'=>$this->desiredstock, - 'level'=>$level, - 'incdec'=>$incdec, - 'entity'=>$this->entity + 'id'=>$id, // Id product + 'id_parent'=>$id_parent, + 'ref'=>$tmpproduct->ref, // Ref product + 'nb'=>$nb, // Nb of units that compose parent product + 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product + 'stock'=>$tmpproduct->stock_reel, // Stock + 'stock_alert'=>$tmpproduct->seuil_stock_alerte, // Stock alert + 'label'=>$label, + 'fullpath'=>$compl_path.$label, // Label + 'type'=>$type, // Nb of units that compose parent product + 'desiredstock'=>$tmpproduct->desiredstock, + 'level'=>$level, + 'incdec'=>$incdec, + 'entity'=>$tmpproduct->entity ); // Recursive call if there is childs to child @@ -4030,14 +4099,11 @@ class Product extends CommonObject } $linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose.= ' class="classfortooltip"'; - - /* - $hookmanager->initHooks(array('productdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ + $linkclose.= ' class="nowraponall classfortooltip"'; + } + else + { + $linkclose = ' class="nowraponall"'; } if ($option == 'supplier' || $option == 'category') { @@ -4066,9 +4132,11 @@ class Product extends CommonObject $result.=$linkstart; if ($withpicto) { - if ($this->type == Product::TYPE_PRODUCT) { $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_PRODUCT) { + $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } - if ($this->type == Product::TYPE_SERVICE) { $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_SERVICE) { + $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } } $result.= $newref; @@ -4078,8 +4146,10 @@ class Product extends CommonObject $hookmanager->initHooks(array('productdao')); $parameters=array('id'=>$this->id, 'getnomurl'=>$result); $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) { $result = $hookmanager->resPrint; - } else { $result .= $hookmanager->resPrint; + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; } return $result; From c9e481d6f7b60a3a28edbea0b63ed3a1876782d5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 14:09:59 +0200 Subject: [PATCH 08/38] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7d323ebadcf..8cebf3a2ce4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacityt_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From 2d77bfd873df6cc3b382f2dd0c8f2d2830c81a26 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Aug 2019 14:50:25 +0200 Subject: [PATCH 09/38] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8cebf3a2ce4..bdc4fa9be51 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2050,7 +2050,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units,"; + $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, capacity, capacity_units, weight, weight_units,"; $sql.= " length, length_units, width, width_units, height, height_units,"; $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; From d22c2960b7878e4eee53fc6242d6b6c0bca0abc5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 6 Aug 2019 00:14:19 +0200 Subject: [PATCH 10/38] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bdc4fa9be51..09038866e45 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -258,7 +258,7 @@ class Product extends CommonObject //! Unites de mesure public $capacity; - public $capacity_units; + public $capacity_units; public $weight; public $weight_units; public $length; @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From 1b4788c6d0d33a9fa6890f0c4a1a39b8cd74e4d3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 24 Aug 2019 14:21:41 +0200 Subject: [PATCH 11/38] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 09038866e45..6b1877d0b51 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3288,7 +3288,8 @@ class Product extends CommonObject if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql.= " WHERE c.rowid = d.fk_contrat"; + $sql.= " WHERE c.entity IN (".getEntity('contract').")"; + $sql.= " AND c.rowid = d.fk_contrat"; if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; } else { @@ -3298,7 +3299,6 @@ class Product extends CommonObject $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('contract').")"; if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } From e55c7bc378295bd6db964434bb6e8b604484f814 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 6 Sep 2019 11:22:22 +0200 Subject: [PATCH 12/38] Update llx_facture.sql --- htdocs/install/mysql/tables/llx_facture.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 742c63d0a6e..3c678699a7e 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -41,6 +41,7 @@ create table llx_facture date_pointoftax date DEFAULT NULL, -- date point of tax (for GB) date_valid date, -- date validation tms timestamp, -- date creation/modification + date_cloture datetime, -- date de cloture paye smallint DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL, remise_percent real DEFAULT 0, -- remise relative @@ -62,7 +63,8 @@ create table llx_facture fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change fk_user_valid integer, -- user validating - + fk_user_cloture integer, -- user closing + module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...) pos_source varchar(32), -- name of POS station when invoice is generated by a POS module fk_fac_rec_source integer, -- facture rec source From ead8d29ed32ecd8cc65ad90254e912a2dc8cf097 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 6 Sep 2019 11:32:46 +0200 Subject: [PATCH 13/38] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 64de0364139..065104164c9 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -47,7 +47,8 @@ ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_obje ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final; ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty; ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit; - +ALTER TABLE llx_facture ADD COLUMN date_cloture datetime DEFAULT NULL after date_valid; +ALTER TABLE llx_facture ADD COLUMN fk_user_cloture integer DEFAULT NULL after fk_user_valid; ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL; @@ -105,4 +106,4 @@ create table llx_c_hrm_public_holiday )ENGINE=innodb; - \ No newline at end of file + From fc75d72290578cb488ba1480b75c1ed51122dbba Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 6 Sep 2019 11:35:52 +0200 Subject: [PATCH 14/38] Update list.php --- htdocs/compta/facture/list.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ad9e2295d6d..54f0fdb6d08 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -180,6 +180,7 @@ $arrayfields=array( 'rtp'=>array('label'=>"Rest", 'checked'=>0), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); @@ -381,7 +382,7 @@ $sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_publ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; -$sql.= ' f.datec as date_creation, f.tms as date_update,'; +$sql.= ' f.datec as date_creation, f.tms as date_update, f.date_cloture as date_cloture,'; if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) { $sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,'; @@ -495,7 +496,7 @@ if (! $sall) $sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; - $sql.= ' f.datec, f.tms,'; + $sql.= ' f.datec, f.tms, f.date_cloture,'; $sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql.= ' typent.code,'; $sql.= ' state.code_departement, state.nom,'; @@ -864,6 +865,12 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['f.date_cloture']['checked'])) + { + print ''; + print ''; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -930,6 +937,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (! empty($arrayfields['f.date_cloture']['checked'])) print_liste_field_titre($arrayfields['f.date_cloture']['label'], $_SERVER["PHP_SELF"], "f.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type,dynamount_payed", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -1260,6 +1268,14 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } + // Date cloture + if (! empty($arrayfields['f.date_cloture']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (! $i) $totalarray['nbfield']++; + } // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { From 5d81b0271d6a6eedae203ddaaefcf6c598aaa16c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 6 Sep 2019 11:40:26 +0200 Subject: [PATCH 15/38] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 131f0ee90fd..73323235448 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2136,6 +2136,8 @@ class Facture extends CommonInvoice if ($this->paye != 1) { $this->db->begin(); + + $now=dol_now(); dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG); @@ -2144,6 +2146,8 @@ class Facture extends CommonInvoice if (! $close_code) $sql.= ', paye=1'; if ($close_code) $sql.= ", close_code='".$this->db->escape($close_code)."'"; if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'"; + $sql.= ', fk_user_cloture = '.$user->id; + $sql.= ", date_cloture = '".$this->db->idate($now)."'"; $sql.= ' WHERE rowid = '.$this->id; $resql = $this->db->query($sql); @@ -2196,6 +2200,8 @@ class Facture extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null'; + $sql.= ' date_cloture as datecloture,'; + $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG); @@ -3521,7 +3527,8 @@ class Facture extends CommonInvoice public function info($id) { $sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,'; - $sql.= ' fk_user_author, fk_user_valid'; + $sql.= ' date_cloture as datecloture,'; + $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as c'; $sql.= ' WHERE c.rowid = '.$id; @@ -3536,7 +3543,7 @@ class Facture extends CommonInvoice { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; + $this->user_creation = $cuser; } if ($obj->fk_user_valid) { @@ -3544,9 +3551,17 @@ class Facture extends CommonInvoice $vuser->fetch($obj->fk_user_valid); $this->user_validation = $vuser; } + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); // Should be in log table + $this->date_validation = $this->db->jdate($obj->datev); + $this->date_cloture = $this->db->jdate($obj->datecloture); } $this->db->free($result); } From 1e8663b1c891b2b85ffebd10534309aca68540d1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 10 Sep 2019 18:48:55 +0000 Subject: [PATCH 16/38] Fixing style errors. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ceae785c6e8..6dbb54b1203 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -957,7 +957,7 @@ class Product extends CommonObject $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); From d0b06a1eab372dba798fe559f2166c8d8ff8e274 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 29 Sep 2019 15:39:59 +0200 Subject: [PATCH 17/38] Update llx_facture.sql --- htdocs/install/mysql/tables/llx_facture.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 3c678699a7e..aa714c06500 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -41,7 +41,7 @@ create table llx_facture date_pointoftax date DEFAULT NULL, -- date point of tax (for GB) date_valid date, -- date validation tms timestamp, -- date creation/modification - date_cloture datetime, -- date de cloture + date_closing datetime, -- date de cloture paye smallint DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL, remise_percent real DEFAULT 0, -- remise relative @@ -63,7 +63,7 @@ create table llx_facture fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change fk_user_valid integer, -- user validating - fk_user_cloture integer, -- user closing + fk_user_closing integer, -- user closing module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...) pos_source varchar(32), -- name of POS station when invoice is generated by a POS module From f132f2f947c77b709d757629a3841e7cb4c0f16b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 29 Sep 2019 15:40:26 +0200 Subject: [PATCH 18/38] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index d888602030c..ea959cd7a74 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -80,8 +80,8 @@ ALTER TABLE llx_extrafields ADD COLUMN printable boolean DEFAULT FALSE; ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final; ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty; ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit; -ALTER TABLE llx_facture ADD COLUMN date_cloture datetime DEFAULT NULL after date_valid; -ALTER TABLE llx_facture ADD COLUMN fk_user_cloture integer DEFAULT NULL after fk_user_valid; +ALTER TABLE llx_facture ADD COLUMN date_cosing datetime DEFAULT NULL after date_valid; +ALTER TABLE llx_facture ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid; ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL; From 5a096972c0e28875cd17a29f1d577d83543020d2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 29 Sep 2019 15:42:39 +0200 Subject: [PATCH 19/38] Update list.php --- htdocs/compta/facture/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 54f0fdb6d08..caba275dc33 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -180,7 +180,7 @@ $arrayfields=array( 'rtp'=>array('label'=>"Rest", 'checked'=>0), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'f.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), + 'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); @@ -382,7 +382,7 @@ $sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_publ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; -$sql.= ' f.datec as date_creation, f.tms as date_update, f.date_cloture as date_cloture,'; +$sql.= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) { $sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,'; @@ -496,7 +496,7 @@ if (! $sall) $sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; - $sql.= ' f.datec, f.tms, f.date_cloture,'; + $sql.= ' f.datec, f.tms, f.date_closing,'; $sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql.= ' typent.code,'; $sql.= ' state.code_departement, state.nom,'; @@ -865,7 +865,7 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['f.date_cloture']['checked'])) + if (! empty($arrayfields['f.date_closing']['checked'])) { print ''; print ''; @@ -937,7 +937,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.date_cloture']['checked'])) print_liste_field_titre($arrayfields['f.date_cloture']['label'], $_SERVER["PHP_SELF"], "f.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (! empty($arrayfields['f.date_closing']['checked'])) print_liste_field_titre($arrayfields['f.date_closing']['label'], $_SERVER["PHP_SELF"], "f.date_closing", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type,dynamount_payed", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -1268,11 +1268,11 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Date cloture - if (! empty($arrayfields['f.date_cloture']['checked'])) + // Date closing + if (! empty($arrayfields['f.date_closing']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; } From 2e8b99606ef36a5ef6d4b8137f69eb4c771fee7a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 29 Sep 2019 15:45:41 +0200 Subject: [PATCH 20/38] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 73323235448..823f7cf7e50 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2146,8 +2146,8 @@ class Facture extends CommonInvoice if (! $close_code) $sql.= ', paye=1'; if ($close_code) $sql.= ", close_code='".$this->db->escape($close_code)."'"; if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'"; - $sql.= ', fk_user_cloture = '.$user->id; - $sql.= ", date_cloture = '".$this->db->idate($now)."'"; + $sql.= ', fk_user_closing = '.$user->id; + $sql.= ", date_closing = '".$this->db->idate($now)."'"; $sql.= ' WHERE rowid = '.$this->id; $resql = $this->db->query($sql); @@ -2200,7 +2200,7 @@ class Facture extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null'; - $sql.= ' date_cloture as datecloture,'; + $sql.= ' date_closing as dateclosing,'; $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; $sql.= ' WHERE rowid = '.$this->id; @@ -3527,8 +3527,8 @@ class Facture extends CommonInvoice public function info($id) { $sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,'; - $sql.= ' date_cloture as datecloture,'; - $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; + $sql.= ' date_closing as dateclosing,'; + $sql.= ' fk_user_author, fk_user_valid, fk_user_closing'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as c'; $sql.= ' WHERE c.rowid = '.$id; @@ -3551,17 +3551,17 @@ class Facture extends CommonInvoice $vuser->fetch($obj->fk_user_valid); $this->user_validation = $vuser; } - if ($obj->fk_user_cloture) + if ($obj->fk_user_closing) { $cluser = new User($this->db); - $cluser->fetch($obj->fk_user_cloture); - $this->user_cloture = $cluser; + $cluser->fetch($obj->fk_user_closing); + $this->user_closing = $cluser; } $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); $this->date_validation = $this->db->jdate($obj->datev); - $this->date_cloture = $this->db->jdate($obj->datecloture); + $this->date_closing = $this->db->jdate($obj->dateclosing); } $this->db->free($result); } From 4177c72ae0768ff2bcafff65949b089279e9dda0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 29 Sep 2019 15:46:28 +0200 Subject: [PATCH 21/38] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 823f7cf7e50..9fd49351586 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2201,7 +2201,7 @@ class Facture extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null'; $sql.= ' date_closing as dateclosing,'; - $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; + $sql.= ' fk_user_author, fk_user_valid, fk_user_closing'; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG); From 564e22009dfa12d6ec998b69a2ab3fc7e07f7299 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Sep 2019 18:22:37 +0200 Subject: [PATCH 22/38] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9fd49351586..7b17929e616 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2199,7 +2199,7 @@ class Facture extends CommonInvoice $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; - $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null'; + $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null,'; $sql.= ' date_closing as dateclosing,'; $sql.= ' fk_user_author, fk_user_valid, fk_user_closing'; $sql.= ' WHERE rowid = '.$this->id; From 2da5a506a90e52ed647e4545f5755ee139f1fdbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Sep 2019 18:25:03 +0200 Subject: [PATCH 23/38] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7b17929e616..281a04019db 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2200,8 +2200,8 @@ class Facture extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null,'; - $sql.= ' date_closing as dateclosing,'; - $sql.= ' fk_user_author, fk_user_valid, fk_user_closing'; + $sql.= ' date_closing=null,'; + $sql.= ' fk_user_closing=null'; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG); From eb203413280dcd0faf495a3062db322d72be1f63 Mon Sep 17 00:00:00 2001 From: fuhraih <55843623+fuhraih@users.noreply.github.com> Date: Tue, 8 Oct 2019 15:42:59 +0200 Subject: [PATCH 24/38] Update companies.lang --- htdocs/langs/en_US/companies.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index a4ab22d47c5..31b0634f579 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -438,5 +438,6 @@ PaymentTypeCustomer=Payment Type - Customer PaymentTermsCustomer=Payment Terms - Customer PaymentTypeSupplier=Payment Type - Vendor PaymentTermsSupplier=Payment Term - Vendor +PaymentTypeBoth=Payment Type - Customer and Vendor MulticurrencyUsed=Use Multicurrency -MulticurrencyCurrency=Currency \ No newline at end of file +MulticurrencyCurrency=Currency From 8aee2fa534f313043c1d8d23d48e829878cb7206 Mon Sep 17 00:00:00 2001 From: fuhraih <55843623+fuhraih@users.noreply.github.com> Date: Tue, 8 Oct 2019 15:48:18 +0200 Subject: [PATCH 25/38] Update dict.php --- htdocs/admin/dict.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d739205124e..31ade656480 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1510,6 +1510,10 @@ if ($id) $key=$langs->trans("PaymentType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } + elseif ($fieldlist[$field]=='type' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { + $payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); + $valuetoshow = $payment_type_list[$valuetoshow]; + } elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); @@ -1876,6 +1880,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print $type.''; print ''; } + elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement') + { + print ''; + $select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); + print $form->selectarray($fieldlist[$field], $select_list, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'2')); + print ''; + } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { if ($fieldlist[$field] == 'type_cdr') print ''; else print ''; From 552a9498be8bd3538ce54e761dd004b3123c025d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:11:50 +0200 Subject: [PATCH 26/38] Update llx_product.sql --- htdocs/install/mysql/tables/llx_product.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 1603ee52eff..f828c770089 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -69,8 +69,8 @@ create table llx_product accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. - capacity float DEFAULT NULL, - capacity_units tinyint DEFAULT NULL, + net_measure float DEFAULT NULL, + net_measure_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, From e2d76f6f2485b09f485fdbb3546a6320c748848b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:13:59 +0200 Subject: [PATCH 27/38] Update product.class.php --- htdocs/product/class/product.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6dbb54b1203..155fccd354f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -257,8 +257,8 @@ class Product extends CommonObject public $url; //! Unites de mesure - public $capacity; - public $capacity_units; + public $net_measure; + public $net_measure_units; public $weight; public $weight_units; public $length; @@ -808,8 +808,8 @@ class Product extends CommonObject $this->label = trim($this->label); $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); - $this->capacity = price2num($this->capacity); - $this->capacity_units = trim($this->capacity_units); + $this->net_measure = price2num($this->net_measure); + $this->net_measure_units = trim($this-net_measure_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -956,8 +956,8 @@ class Product extends CommonObject $sql.= ", tobuy = " . (int) $this->status_buy; $sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); - $sql.= ", capacity = " . ($this->capacity!='' ? "'".$this->db->escape($this->capacity)."'" : 'null'); - $sql.= ", capacity_units = " . ($this->capacity_units!='' ? "'".$this->db->escape($this->capacity_units)."'": 'null'); + $sql.= ", net_measure = " . ($this->net_measure!='' ? "'".$this->db->escape($this->net_measure)."'" : 'null'); + $sql.= ", net_measure_units = " . ($this->net_measure_units!='' ? "'".$this->db->escape($this->net_measure_units)."'": 'null'); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->db->escape($this->weight)."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->db->escape($this->weight_units)."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->db->escape($this->length)."'" : 'null'); @@ -2114,8 +2114,8 @@ class Product extends CommonObject $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1); $this->canvas = $obj->canvas; - $this->capacity = $obj->capacity; - $this->capacity_units = $obj->capacity_units; + $this->net_measure = $obj->net_measure; + $this->net_measure_units = $obj->net_measure_units; $this->weight = $obj->weight; $this->weight_units = $obj->weight_units; $this->length = $obj->length; From 10c29887d662b8774b3b6b8e9caf47d5c8a30f69 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:15:12 +0200 Subject: [PATCH 28/38] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 155fccd354f..dffaef1d9e7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -809,7 +809,7 @@ class Product extends CommonObject $this->description = trim($this->description); $this->note = (isset($this->note) ? trim($this->note) : null); $this->net_measure = price2num($this->net_measure); - $this->net_measure_units = trim($this-net_measure_units); + $this->net_measure_units = trim($this->net_measure_units); $this->weight = price2num($this->weight); $this->weight_units = trim($this->weight_units); $this->length = price2num($this->length); @@ -2050,7 +2050,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, capacity, capacity_units, weight, weight_units,"; + $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,"; $sql.= " length, length_units, width, width_units, height, height_units,"; $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; From 17198d59c210b6cce801d236a4ba0e8b0d0a15e6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 8 Oct 2019 16:17:31 +0200 Subject: [PATCH 29/38] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index cc375e72714..67132713ed7 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -163,4 +163,5 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1); - +ALTER TABLE llx_product ADD COLUMN net_measure float; +ALTER TABLE llx_product ADD COLUMN net_measure_units tinyint; From fbb44192e0425412453a042fdc81b1896d8236e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Oct 2019 18:40:39 +0200 Subject: [PATCH 30/38] fix travis --- htdocs/projet/tasks/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 0b0a598167b..00ef201aa9f 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -328,6 +328,7 @@ if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.bill // Add fields from extrafields if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); + } } $sql.= $db->order($sortfield, $sortorder); From ae62d3d60ab2399a969c6b16e8d5b805e1bf82ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Oct 2019 18:43:22 +0200 Subject: [PATCH 31/38] Update list.php --- htdocs/contrat/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 5d8a9f8521a..fc110d4a396 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -267,6 +267,7 @@ $sql.= " state.code_departement, state.nom"; // Add fields from extrafields if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); +} // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook From a8fbefed8c3298549ffe97035ac0db4faada4d73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Oct 2019 19:42:40 +0200 Subject: [PATCH 32/38] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 134d8c3190e..733e850d831 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -93,7 +93,7 @@ ALTER TABLE llx_extrafields ADD COLUMN printable boolean DEFAULT FALSE; ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final; ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty; ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit; -ALTER TABLE llx_facture ADD COLUMN date_cosing datetime DEFAULT NULL after date_valid; +ALTER TABLE llx_facture ADD COLUMN date_closing datetime DEFAULT NULL after date_valid; ALTER TABLE llx_facture ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid; ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL; From f83cc0bcfd37ef9fce1eeaf1c9cdb05417935250 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Oct 2019 21:02:59 +0200 Subject: [PATCH 33/38] Picto of user umage larger --- htdocs/langs/en_US/margins.lang | 2 +- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index d4545b8e75f..1d90f389e9b 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -36,7 +36,7 @@ CostPrice=Cost price UnitCharges=Unit charges Charges=Charges AgentContactType=Commercial agent contact type -AgentContactTypeDetails=Define what contact type (linked on invoices) will be used for margin report per sale representative +AgentContactTypeDetails=Define what contact type (linked on invoices) will be used for margin report per sale representative. Note that reading statistics on a sale representative as a contact is not reliable since in most cases the contact may not be defined explicitely on the invoices. rateMustBeNumeric=Rate must be a numeric value markRateShouldBeLesserThan100=Mark rate should be lower than 100 ShowMarginInfos=Show margin infos diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index dbbed3bc274..262796fe080 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2064,8 +2064,8 @@ img.login, img.printer, img.entity { } img.userphoto { /* size for user photo in lists */ border-radius: 9px; - width: 18px; - height: 18px; + width: 1.5em; + height: 1.5em; background-size: contain; vertical-align: middle; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5960142dfc9..7d08340c8e2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2182,15 +2182,15 @@ img.login, img.printer, img.entity { } img.userphoto { /* size for user photo in lists */ border-radius: 9px; - width: 18px; - height: 18px; + width: 1.5em; + height: 1.5em; background-size: contain; vertical-align: middle; } img.userphotosmall { /* size for user photo in lists */ border-radius: 6px; - width: 12px; - height: 12px; + width: 1em; + height: 1em; background-size: contain; vertical-align: middle; } From 9d534617a003b08fa96eca2169b1882c86624b8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Oct 2019 21:10:51 +0200 Subject: [PATCH 34/38] css --- htdocs/theme/eldy/global.inc.php | 8 ++++---- htdocs/theme/md/style.css.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 262796fe080..d900459e22f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2063,16 +2063,16 @@ img.login, img.printer, img.entity { background-size: contain; } img.userphoto { /* size for user photo in lists */ - border-radius: 9px; + border-radius: 0.75em; width: 1.5em; height: 1.5em; background-size: contain; vertical-align: middle; } img.userphotosmall { /* size for user photo in lists */ - border-radius: 6px; - width: 1em; - height: 1em; + border-radius: 0.6em; + width: 1.2em; + height: 1.2em; background-size: contain; vertical-align: middle; background-color: #FFF; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7d08340c8e2..851829e89df 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2181,16 +2181,16 @@ img.login, img.printer, img.entity { background-color: #FFF; } img.userphoto { /* size for user photo in lists */ - border-radius: 9px; + border-radius: 0.75em; width: 1.5em; height: 1.5em; background-size: contain; vertical-align: middle; } img.userphotosmall { /* size for user photo in lists */ - border-radius: 6px; - width: 1em; - height: 1em; + border-radius: 0.6em; + width: 1.2em; + height: 1.2em; background-size: contain; vertical-align: middle; } From 5ac8ba8c65b8737b3a5d8605a48d94d6a70b0053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Oct 2019 22:13:19 +0200 Subject: [PATCH 35/38] fix travis --- htdocs/core/class/ccountry.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 44445e7d5de..84defbfd163 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -334,6 +334,7 @@ class Ccountry // extends CommonObject return 1; } } + /** * Return a link to the object card (with optionaly the picto) * @@ -344,7 +345,7 @@ class Ccountry // extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $langs; return $langs->trans($this->label); From 7f1aa818d2ef446f32db8b89f1fec6c2772b9dee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Oct 2019 11:57:49 +0200 Subject: [PATCH 36/38] Fix php7.4 error --- test/phpunit/UtilsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/UtilsTest.php b/test/phpunit/UtilsTest.php index e98ef2e8a61..a1b9eafa45e 100644 --- a/test/phpunit/UtilsTest.php +++ b/test/phpunit/UtilsTest.php @@ -145,7 +145,7 @@ class UtilsTest extends PHPUnit\Framework\TestCase $this->assertEquals($result['error'], ''); //$this->assertEquals(preg_match('/phpunit/', $result['output']), 1); - print __METHOD__." result=".$result."\n"; + print __METHOD__." result=".$result['result']."\n"; return $result; } } From b93213e9a39c396f1b947dae9d9ef76738046c92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Oct 2019 13:25:32 +0200 Subject: [PATCH 37/38] Add more phpunit --- test/phpunit/AllTests.php | 6 ++++++ test/phpunit/BankAccountTest.php | 1 + 2 files changed, 7 insertions(+) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index ccf8d205daa..09c075c1083 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -155,6 +155,9 @@ class AllTests require_once dirname(__FILE__).'/DiscountTest.php'; $suite->addTestSuite('DiscountTest'); + require_once dirname(__FILE__).'/BOMTest.php'; + $suite->addTestSuite('BOMTest'); + require_once dirname(__FILE__).'/ContratTest.php'; $suite->addTestSuite('ContratTest'); @@ -253,6 +256,9 @@ class AllTests $suite->addTestSuite('FormAdminTest'); + require_once dirname(__FILE__).'/PaypalTest.php'; + $suite->addTestSuite('PaypalTest'); + return $suite; } } diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index 33103f1059b..48e2a8ddb65 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -108,6 +108,7 @@ class BankAccountTest extends PHPUnit\Framework\TestCase print __METHOD__."\n"; } + /** * End phpunit tests * From 5fce7e5fd0233256f01bec4cbd634fc7f9f29957 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Oct 2019 13:32:00 +0200 Subject: [PATCH 38/38] Update logo name --- ...libarr_256x256.png => dolibarr_logo_256x256.png} | Bin htdocs/theme/eldy/manifest.json.php | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename htdocs/theme/common/{appli_dolibarr_256x256.png => dolibarr_logo_256x256.png} (100%) diff --git a/htdocs/theme/common/appli_dolibarr_256x256.png b/htdocs/theme/common/dolibarr_logo_256x256.png similarity index 100% rename from htdocs/theme/common/appli_dolibarr_256x256.png rename to htdocs/theme/common/dolibarr_logo_256x256.png diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index afaa3a4258c..72465fea2a3 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -46,7 +46,7 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP "name": "", "icons": [ { - "src": "", + "src": "", "sizes": "256x256", "type": "image/png" }