From 828e561c86e31b865d292c790f97667e6aed5c40 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Tue, 12 Feb 2019 15:09:55 +0100 Subject: [PATCH 01/10] fix the ref vs facnumber --- htdocs/accountancy/journal/purchasesjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index caaf0b24d37..7c5a567cbf2 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -93,7 +93,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end) $idpays = $mysoc->country_id; -$sql = "SELECT f.rowid, f.facnumber as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; +$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; From f311d5020185130c255403261e353b0876e20976 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 15:43:24 +0100 Subject: [PATCH 02/10] Fix unique key in accounting_account Conflicts: htdocs/install/mysql/migration/8.0.0-9.0.0.sql --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 9 +++++++++ 1 file changed, 9 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 9b97f7c1918..f2a8ca9f380 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 @@ -260,3 +260,12 @@ CREATE TABLE llx_pos_cash_fence( -- VMYSQL4.3 ALTER TABLE llx_accounting_account MODIFY COLUMN account_number varchar(32) NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_number SET NOT NULL; + + +-- Withdrawals / Prelevements +UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; +UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; + + +ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; +ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); From f7d183f3ef6b11140e122d9a25d6cc2893703e5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:43:38 +0100 Subject: [PATCH 03/10] Add Kosovo country --- htdocs/install/mysql/data/llx_00_c_country.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 0ea1a55d3d3..b97ce386eab 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -274,4 +274,5 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (244,'ME','MNE','Monténégro',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (245,'BL','BLM','Saint-Barthélemy',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (246,'MF','MAF','Saint-Martin',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (247,'XK','XKX','Kosovo',1,0); From 68e6f32320bfe9fb5836b90cd01efba4515191d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 17:56:03 +0100 Subject: [PATCH 04/10] css --- htdocs/compta/charges/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 54e1d285f3e..33a06e09136 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -106,7 +106,7 @@ if ($year) $param.='&year='.$year; if ($mode != 'sconly') { - print $langs->trans("DescTaxAndDividendsArea").'
'; + print ''.$langs->trans("DescTaxAndDividendsArea").'
'; print "
"; } From 666d03f596de232f92c945b595c827fc3d2722c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 18:15:30 +0100 Subject: [PATCH 05/10] Fix multicompany for page to export zip of invoices --- htdocs/compta/compta-files.php | 41 ++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 23eff46da51..7fa3e8fb251 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -81,6 +81,8 @@ if ($user->societe_id > 0) * Actions */ +$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; + //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -91,21 +93,27 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; $sql="SELECT rowid as id, ref as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date,'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, ref,paid,amount as total_ttc, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; $sql.=" WHERE datedon between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.=" WHERE datep between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" UNION ALL"; $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; $sql.=" WHERE date_creation between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $resd = $db->query($sql); $files=array(); $link=''; @@ -264,8 +272,37 @@ $form = new Form($db); $userstatic=new User($db); $title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); print '
'."\n"; -print $langs->trans("ReportPeriod").': '.$form->select_date($date_start, 'date_start', 0, 0, 0, "", 1, 1, 1); -print ' - '.$form->select_date($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 1)."\n"; +print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); +print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; +// Multicompany +if (! empty($conf->multicompany->enabled) && is_object($mc)) +{ + print '
'; + // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module + if (method_exists($mc, 'formObjectOptions')) + { + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode + { + print "".''.$langs->trans("Entity").''; + print "".$mc->select_entities($entity); + print "\n"; + } + else + { + print ''; + } + } + + /*$object = new stdClass(); + // Other attributes + $parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + }*/ +} print '
'."\n"; dol_fiche_end(); From affbd20cdb5018cd788712bcc26917d82a3d0135 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 18:56:32 +0100 Subject: [PATCH 06/10] FIX Bad link in menu manager --- htdocs/core/lib/treeview.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 6c66079090a..11f6e2652c1 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -115,7 +115,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0) { - global $tree_recur_alreadyadded; + global $tree_recur_alreadyadded, $menu_handler_to_search; if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); @@ -203,7 +203,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal if ($showfk) { print '"; } diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 74d175ac2c9..4495de9917f 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -190,6 +190,8 @@ function getCategory($authentication, $id) { global $db,$conf,$langs; + $nbmax = 10; + dol_syslog("Function: getCategory login=".$authentication['login']." id=".$id); if ($authentication['entity']) $conf->entity=$authentication['entity']; @@ -228,7 +230,7 @@ function getCategory($authentication, $id) //'visible'=>$categorie->visible, 'type' => $categorie->type, 'dir' => $pdir, - 'photos' => $categorie->liste_photos($dir, $nbmax=10) + 'photos' => $categorie->liste_photos($dir, $nbmax) ); $cats = $categorie->get_filles(); @@ -248,7 +250,7 @@ function getCategory($authentication, $id) //'visible'=>$fille->visible, 'type'=>$fille->type, 'dir' => $pdir, - 'photos' => $fille->liste_photos($dir, $nbmax=10) + 'photos' => $fille->liste_photos($dir, $nbmax) ); } } diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index d49a76af117..32f25fa2ca8 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -337,6 +337,8 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' { global $db,$conf,$langs; + $nbmax = 10; + dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); @@ -417,7 +419,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' 'pmp' => $product->pmp, 'import_key' => $product->import_key, 'dir' => $pdir, - 'images' => $product->liste_photos($dir, $nbmax=10) + 'images' => $product->liste_photos($dir, $nbmax) ); //Retreive all extrafield for thirdsparty @@ -1001,6 +1003,8 @@ function getProductsForCategory($authentication, $id, $lang = '') { global $db,$conf,$langs; + $nbmax = 10; + $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); @@ -1086,7 +1090,7 @@ function getProductsForCategory($authentication, $id, $lang = '') 'pmp' => $obj->pmp, 'import_key' => $obj->import_key, 'dir' => $pdir, - 'images' => $obj->liste_photos($dir, $nbmax=10) + 'images' => $obj->liste_photos($dir, $nbmax) ); //Retreive all extrafield for thirdsparty From 986fb2ae38cfeb9a10cc8df150ec83a1d71ffd85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:09:27 +0100 Subject: [PATCH 08/10] FIX creation of menu entry with parent id not int --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9e9d5cad8f1..9e5bcd9ca72 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,9 +144,9 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; - if (GETPOST('menuId', 'int') && ! is_numeric(GETPOST('menuId', 'int'))) + if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { - $tmp=explode('&', GETPOST('menuId', 'int')); + $tmp=explode('&', GETPOST('menuId', 'alpha')); foreach($tmp as $s) { if (preg_match('/fk_mainmenu=/', $s)) From 1f9f335e44371fc33399d8dfb1af98cfd8c86574 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:09:27 +0100 Subject: [PATCH 09/10] FIX creation of menu entry with parent id not int Conflicts: htdocs/admin/menus/edit.php --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index b16e9047b26..33a73147251 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -144,9 +144,9 @@ if ($action == 'add') } $leftmenu=''; $mainmenu=''; - if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int'))) + if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha'))) { - $tmp=explode('&',GETPOST('menuId','int')); + $tmp=explode('&', GETPOST('menuId', 'alpha')); foreach($tmp as $s) { if (preg_match('/fk_mainmenu=/',$s)) From 6a8504e1f812dee73075fac8407679a0242775b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:44:12 +0100 Subject: [PATCH 10/10] Fix missing constant --- htdocs/don/class/don.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index c3941059e64..e7296e2e157 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -91,6 +91,11 @@ class Don extends CommonObject public $labelstatut; public $labelstatutshort; + /** + * Draft + */ + const STATUS_DRAFT = 0; + /** * Constructor
'; - print '   '; + print '   '; print $tab[$x]['title']; print ''; print '  (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; From f1500281efb6b36895ed59606e9126b1b6d99ff9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 19:00:50 +0100 Subject: [PATCH 07/10] Fix phpcs --- htdocs/contact/consumption.php | 3 ++- htdocs/user/card.php | 3 +-- htdocs/webservices/server_category.php | 6 ++++-- htdocs/webservices/server_productorservice.php | 8 ++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 4191563eaec..ebbe7332236 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -488,7 +488,8 @@ if ($sql_select) $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); } - if (($objp->info_bits & 2) == 2) { + if (($objp->info_bits & 2) == 2) + { print ''; $txt=''; print img_object($langs->trans("ShowReduc"), 'reduc').' '; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 859b2220b28..63a2a598d41 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1104,8 +1104,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); -print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, - null, '90%' ); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%'); print "