From 604cc5896e9f468e6245587da5286edf40236b0a Mon Sep 17 00:00:00 2001 From: vabeltran Date: Mon, 26 Feb 2018 12:31:40 +0100 Subject: [PATCH 01/49] FIX Unknown column 'pl.amount_requested' in compta/prelevement/factures.php Column 'amount_requested' in ORDER clause not exists because that column is called 'amount' now in 'prelevement_bons' table in db. --- htdocs/compta/prelevement/factures.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index c829b139436..64811c7604a 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -205,7 +205,7 @@ if ($result) print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder); print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder); print_liste_field_titre("AmountInvoice",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount_requested","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; From 4d05bff78037be41f9a91c27f33d970a0ca75863 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 27 Feb 2018 12:25:36 +0100 Subject: [PATCH 02/49] FIX : if we make a mistake with situation_percent, now we can correct it. before situation_final was always set to 1 and no way to go back --- htdocs/compta/facture/class/facture.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d1ede7cb41d..3728908f01d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2245,9 +2245,12 @@ class Facture extends CommonInvoice $final = ($this->lines[$i]->situation_percent == 100); $i++; } - if ($final) { - $this->setFinal($user); - } + + if (empty($final)) $this->situation_final = 0; + else $this->situation_final = 1; + + $this->setFinal($user); + } } } @@ -4090,7 +4093,6 @@ class Facture extends CommonInvoice $this->db->begin(); - $this->situation_final = 1; $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; dol_syslog(__METHOD__, LOG_DEBUG); From ce2fc28d809934abe1e60b3974c370e175231a3a Mon Sep 17 00:00:00 2001 From: alexis Algoud Date: Fri, 2 Mar 2018 16:12:58 +0100 Subject: [PATCH 03/49] FIX migration script for product photo --- scripts/product/migrate_picture_path.php | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 98a5c4d51bc..d72c60f05e5 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -104,6 +104,7 @@ function migrate_product_photospath($product) global $conf; $dir = $conf->product->multidir_output[$product->entity]; + $conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO = 1; $origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos"; $destin = $dir.'/'.dol_sanitizeFileName($product->ref); From b87db9d32d01feced9d2bb04711af9357e362a38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Mar 2018 16:38:56 +0100 Subject: [PATCH 04/49] Fix missing ; --- htdocs/install/mysql/tables/llx_expensereport_rules.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules.sql index e6103ee8fb9..3aaca6f00b5 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_rules.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_rules.sql @@ -31,4 +31,4 @@ CREATE TABLE llx_expensereport_rules ( code_expense_rules_type varchar(50) NOT NULL, is_for_all tinyint DEFAULT '0', entity integer DEFAULT 1 -) ENGINE=InnoDB \ No newline at end of file +) ENGINE=InnoDB; \ No newline at end of file From bf4543a636f81e30dfa851e655419805b8c2727a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Mar 2018 17:05:52 +0100 Subject: [PATCH 05/49] Fix: missing hook during rename file action --- htdocs/core/actions_linkedfiles.inc.php | 72 ++++++++++++++----------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 0e0c444af33..5ec20a81b8c 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -177,42 +177,50 @@ elseif ($action == 'confirm_updateline' && GETPOST('save','alpha') && GETPOST('l elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha')) { // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. - if (! empty($upload_dir)) - { - $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0); // Do not remove accents - $filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0); // Do not remove accents + if (! empty($upload_dir)) + { + $reshook=$hookmanager->initHooks(array('actionlinkedfiles')); - // Security: - // Disallow file with some extensions. We rename them. - // Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code. - if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) - { - $filenameto.= '.noexe'; - } + $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0); // Do not remove accents + $filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0); // Do not remove accents - if ($filenamefrom && $filenameto) - { - $srcpath = $upload_dir.'/'.$filenamefrom; - $destpath = $upload_dir.'/'.$filenameto; + $parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto); + $reshook=$hookmanager->executeHooks('renameUploadedFile', $parameters, $object); - $result = dol_move($srcpath, $destpath); - if ($result) - { - if ($object->id) - { - $object->addThumbs($destpath); - } + if (empty($reshook)) + { + // Security: + // Disallow file with some extensions. We rename them. + // Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code. + if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) + { + $filenameto.= '.noexe'; + } - // TODO Add revert function of addThumbs to remove for old name - //$object->delThumbs($srcpath); + if ($filenamefrom && $filenameto) + { + $srcpath = $upload_dir.'/'.$filenamefrom; + $destpath = $upload_dir.'/'.$filenameto; - setEventMessages($langs->trans("FileRenamed"), null); - } - else - { - $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. - setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); - } - } + $result = dol_move($srcpath, $destpath); + if ($result) + { + if ($object->id) + { + $object->addThumbs($destpath); + } + + // TODO Add revert function of addThumbs to remove for old name + //$object->delThumbs($srcpath); + + setEventMessages($langs->trans("FileRenamed"), null); + } + else + { + $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); + } + } + } } } From 473c16ede599c1e739f1332bff9395f47b67b091 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 2 Mar 2018 17:30:46 +0100 Subject: [PATCH 06/49] fix pgSQL install --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_expensereport_rules.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 190e0dcf05f..e745ad20847 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -437,7 +437,7 @@ CREATE TABLE llx_expensereport_rules ( fk_usergroup integer DEFAULT NULL, fk_c_type_fees integer NOT NULL, code_expense_rules_type varchar(50) NOT NULL, - is_for_all tinyint DEFAULT '0', + is_for_all tinyint DEFAULT 0, entity integer DEFAULT 1 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules.sql index e6103ee8fb9..a105b8f28ca 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_rules.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_rules.sql @@ -29,6 +29,6 @@ CREATE TABLE llx_expensereport_rules ( fk_usergroup integer DEFAULT NULL, fk_c_type_fees integer NOT NULL, code_expense_rules_type varchar(50) NOT NULL, - is_for_all tinyint DEFAULT '0', + is_for_all tinyint DEFAULT 0, entity integer DEFAULT 1 ) ENGINE=InnoDB \ No newline at end of file From 8e85198bd15206e61c4ca4c00a9b1191629e5f12 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Mar 2018 18:09:06 +0100 Subject: [PATCH 07/49] Fix: missing $upload_dir --- htdocs/core/actions_linkedfiles.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 5ec20a81b8c..2ef3191154d 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -184,7 +184,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha')) $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0); // Do not remove accents $filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0); // Do not remove accents - $parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto); + $parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto, 'upload_dir' => $upload_dir); $reshook=$hookmanager->executeHooks('renameUploadedFile', $parameters, $object); if (empty($reshook)) From b69d2800ef035d46e8fef6fe0067ffc0e72a6fe9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Mar 2018 18:59:30 +0100 Subject: [PATCH 08/49] Fix: check if file name already exists --- htdocs/core/actions_linkedfiles.inc.php | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 2ef3191154d..4e9e0063dc3 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -202,18 +202,26 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha')) $srcpath = $upload_dir.'/'.$filenamefrom; $destpath = $upload_dir.'/'.$filenameto; - $result = dol_move($srcpath, $destpath); - if ($result) + if (!file_exists($destpath)) { - if ($object->id) + $result = dol_move($srcpath, $destpath); + if ($result) { - $object->addThumbs($destpath); + if ($object->id) + { + $object->addThumbs($destpath); + } + + // TODO Add revert function of addThumbs to remove for old name + //$object->delThumbs($srcpath); + + setEventMessages($langs->trans("FileRenamed"), null); + } + else + { + $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); } - - // TODO Add revert function of addThumbs to remove for old name - //$object->delThumbs($srcpath); - - setEventMessages($langs->trans("FileRenamed"), null); } else { From 0c529770278aca05eea9b1f966f1c2c141ddcce2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 3 Mar 2018 08:37:44 +0100 Subject: [PATCH 09/49] Fix: avoid Warning: A non-numeric value encountered --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 621a229121c..dc00360acfd 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -384,6 +384,7 @@ class SupplierProposal extends CommonObject if (empty($info_bits)) $info_bits=0; if (empty($rang)) $rang=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + if (empty($pu_ht)) $pu_ht=0; $remise_percent=price2num($remise_percent); $qty=price2num($qty); From eac1b2efe96ef5f449021aa3834e1116864619ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Mar 2018 11:22:15 +0100 Subject: [PATCH 10/49] FIX Infinite loop on deletion of temp file when there is symbolic links --- htdocs/admin/tools/purge.php | 2 +- htdocs/core/class/utils.class.php | 2 +- htdocs/core/lib/files.lib.php | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index bc328e951d4..f415ed1692c 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -86,7 +86,7 @@ if (! empty($conf->syslog->enabled)) $filelogparam=$filelog; if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) { - $filelogparam =''.$filelog.''; } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 4502eb03240..7d5f742a779 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -67,7 +67,7 @@ class Utils // Delete temporary files if ($dolibarr_main_data_root) { - $filesarray=dol_dir_list($dolibarr_main_data_root,"directories",1,'^temp$','','','',2); + $filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', '', '', 2, 0, '', 1); // Do not follow symlinks if ($choice == 'tempfilesold') { $now = dol_now(); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index f62fb14c68b..088b68b1c2f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -52,10 +52,11 @@ function dol_basename($pathfile) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only * @param int $nohook Disable all hooks * @param string $relativename For recursive purpose only. Must be "" at first call. + * @param string $donotfollowsymlinks Do not follow symbolic links * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...) * @see dol_dir_list_indatabase */ -function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="") +function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0) { global $db, $hookmanager; global $object; @@ -159,7 +160,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil // if we're in a directory and we want recursive behavior, call this function again if ($recursive) { - $file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename!=''?$relativename.'/':'').$file)); + if (empty($donotfollowsymlinks) || ! is_link($path."/".$file)) + { + //var_dump('eee '. $path."/".$file. ' '.is_dir($path."/".$file).' '.is_link($path."/".$file)); + $file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename!=''?$relativename.'/':'').$file, $donotfollowsymlinks)); + } } } else if (! $isdir && (($types == "files") || ($types == "all"))) From 44eb50c4249282fb1cac949b2617b81b8ab2177e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Mar 2018 11:57:10 +0100 Subject: [PATCH 11/49] FIX Infinite loop on deletion of temp file when there is symbolic links --- htdocs/core/class/utils.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 7d5f742a779..37ccea748f1 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -67,7 +67,7 @@ class Utils // Delete temporary files if ($dolibarr_main_data_root) { - $filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', '', '', 2, 0, '', 1); // Do not follow symlinks + $filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks if ($choice == 'tempfilesold') { $now = dol_now(); @@ -81,10 +81,10 @@ class Utils if ($choice=='allfiles') { - // Delete all files (except install.lock) + // Delete all files (except install.lock, do not follow symbolic links) if ($dolibarr_main_data_root) { - $filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$'); + $filesarray=dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); } } @@ -93,7 +93,7 @@ class Utils // Define files log if ($dolibarr_main_data_root) { - $filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$'); + $filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); } $filelog=''; From c0664474e41c390b31e3de8e10445438c0b3fd98 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Mar 2018 06:32:55 +0100 Subject: [PATCH 12/49] Fix : Missing language file --- htdocs/admin/taxes.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index bbf2435436e..a4aa1afbd8c 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load('admin'); +$langs->load("products"); if (!$user->admin) accessforbidden(); From 5839cedb4cee60ef9abe6860872d5a37bed499b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 10:47:35 +0100 Subject: [PATCH 13/49] CSS --- htdocs/index.php | 28 +++++++++++++-------------- htdocs/theme/eldy/style.css.php | 34 +++++++++++++++++++++------------ htdocs/theme/md/style.css.php | 6 +++--- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 3eb1aa2285a..29e716d31ad 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -339,14 +339,14 @@ if (empty($user->societe_id)) } } - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; $boxstat.=''; $boxstat.=''; @@ -583,12 +583,12 @@ if (! empty($valid_dashboardlines)) $boxwork .="\n"; } - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; + $boxwork .='
'; + $boxwork .='
'; + $boxwork .='
'; + $boxwork .='
'; + $boxwork .='
'; + $boxwork .='
'; $boxwork .=''; } else diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 41477d929bf..d438a8c9d57 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -833,21 +833,13 @@ div.fiche>div.tabBar>form>div.div-table-responsive { flex-flow: row wrap; justify-content: flex-start; } -/*.thumbstat { - flex: 1 1 116px; -}*/ +.thumbstat { + min-width: 150px; +} .thumbstat150 { - flex: 1 1 170px; + min-width: 170px; } .thumbstat, .thumbstat150 { - /* - flex-shrink: 1; - flex-basis: 140px; - display: inline; - width: 100%; - justify-content: flex-start; - align-self: flex-start; - */ flex-grow: 1; flex-shrink: 0; min-width: 150px; @@ -3095,6 +3087,20 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .boxstatscontent { padding: 3px; } +.boxstatsempty { + width: 121px; + padding-left: 3px; + padding-right: 3px; + margin-left: 8px; + margin-right: 8px; +} +.boxstats150empty { + width: 158px; + padding-left: 3px; + padding-right: 3px; + margin-left: 8px; + margin-right: 8px; +} @media only screen and (max-width: 767px) { @@ -3122,6 +3128,10 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .boxstats { width: 111px; } + .boxstatsempty { + width: 111px; + } + } .boxstats:hover { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 94dc4235641..5b4040b0501 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -153,7 +153,7 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); } -//if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; +if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white @@ -3184,8 +3184,8 @@ span.dashboardlineko { text-align: center; } .boxworkingboard .tdboxstats { - padding-left: 0px !important; - padding-right: 0px !important; + padding-left: 1px !important; + padding-right: 1px !important; } a.valignmiddle.dashboardlineindicator { line-height: 30px; From 6338328c900df5e46d05e732d5a703c463f94b52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 11:09:53 +0100 Subject: [PATCH 14/49] Fix scrutinizer errors --- .../boxes/box_graph_invoices_permonth.php | 2 + .../core/class/commondocgenerator.class.php | 2 +- htdocs/core/class/commonobject.class.php | 3 +- htdocs/core/class/extrafields.class.php | 1 + htdocs/core/class/html.formactions.class.php | 1 + htdocs/core/class/html.formwebsite.class.php | 7 ++- htdocs/core/lib/admin.lib.php | 5 ++- htdocs/core/lib/website.lib.php | 1 + htdocs/societe/class/societe.class.php | 45 +++++++++---------- htdocs/website/class/website.class.php | 2 +- 10 files changed, 36 insertions(+), 33 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 4c95d446f8a..d665d70da56 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -91,6 +91,8 @@ class box_graph_invoices_permonth extends ModeleBoxes if ($user->rights->facture->lire) { + $mesg = ''; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f5a16aa540b..a4ea3a70447 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -319,7 +319,7 @@ abstract class CommonDocGenerator foreach($conf->global as $key => $val) { - if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; + if (preg_match('/(_pass|password|secret|_key|key$)/i', $key)) $newval = '*****forbidden*****'; else $newval = $val; $array_other['__['.$key.']__'] = $newval; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c7335298bdd..fe4eaffc177 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4691,7 +4691,8 @@ abstract class CommonObject if ($this->array_options[$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { // If there is an encryption choice, we use it to crypt data before insert - $algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])); + $tmparrays = array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options']) + $algo=reset($tmparrays); if ($algo != '') { //global $action; // $action may be 'create', 'update', 'update_extras'... diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4477a4812da..861848e6924 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -235,6 +235,7 @@ class ExtraFields $lengthdb='11'; } elseif ($type=='html') { $typedb='text'; + $lengthdb=$length; } elseif($type=='password') { $typedb='varchar'; $lengthdb='128'; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 2d66661c839..f254fe44b9d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -194,6 +194,7 @@ class FormActions $projectid = $object->fk_project; if ($typeelement == 'project') $projectid = $object->id; + $buttontoaddnewevent=''; if (! empty($conf->agenda->enabled)) { $buttontoaddnewevent = ''; diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index e7cd6d447a0..86e0f48c65f 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -164,7 +164,7 @@ class FormWebsite * * @param string $htmlname Name of select zone * @param string $selected Selected value - * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param int $useempty 1=Add an empty value in list * @param string $moreattrib More attributes on HTML select tag * @return void */ @@ -177,9 +177,9 @@ class FormWebsite $arrayofsamples=array('corporatehome'=>'CorporateHomePage', 'empty'=>'EmptyPage'); $out = ''; - $out .= '"; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index fcc3098c730..0f219a032cc 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1288,9 +1288,10 @@ function complete_elementList_with_modules(&$elementList) $modules[$i] = $objMod; $filename[$i]= $modName; - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module + $orders[$i] = $objMod->family."_".$j; // Sort on family then module number + $dirmod[$i] = $dir; //print "x".$modName." ".$orders[$i]."\n
"; - $dirmod[$i] = $dirroot; + if (! empty($objMod->module_parts['contactelement'])) { $elementList[$objMod->name] = $langs->trans($objMod->name); diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 82e9a98d43f..50716c27aca 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -177,6 +177,7 @@ function redirectToContainer($containerref, $containeraliasalt='',$containerid=0 global $db, $website; $newurl = ''; + $result=0; // We make redirect using the alternative alias, we must find the real $containerref if ($containeraliasalt) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 48c35c7143e..db614ed833e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1169,7 +1169,7 @@ class Societe extends CommonObject $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; if ($rowid) $sql .= ' AND s.rowid = '.$rowid; if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'"; - if ($ref_alias) $sql .= " AND s.nom_alias = '".$this->db->escape($nom_alias)."'"; + if ($ref_alias) $sql .= " AND s.nom_alias = '".$this->db->escape($ref_alias)."'"; if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'"; if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'"; @@ -2833,10 +2833,10 @@ class Societe extends CommonObject //Check NIF if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $string)) - if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1)) - return 1; - else - return -1; + if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1)) + return 1; + else + return -1; //algorithm checking type code CIF $sum = $num[2] + $num[4] + $num[6]; @@ -2846,31 +2846,31 @@ class Societe extends CommonObject //Chek special NIF if (preg_match('/^[KLM]{1}/', $string)) - if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1)) - return 1; - else - return -1; + if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1)) + return 1; + else + return -1; //Check CIF if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $string)) - if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1)) - return 2; - else - return -2; + if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1)) + return 2; + else + return -2; //Check NIE T if (preg_match('/^[T]{1}/', $string)) - if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string)) - return 3; - else - return -3; + if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string)) + return 3; + else + return -3; //Check NIE XYZ if (preg_match('/^[XYZ]{1}/', $string)) - if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1)) - return 3; - else - return -3; + if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1)) + return 3; + else + return -3; //Can not be verified return -4; @@ -2894,9 +2894,6 @@ class Societe extends CommonObject else { return -1; } - - //Wrong format - return 0; } return $ok; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 3574c95e470..5a46425cb66 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -616,7 +616,7 @@ class Website extends CommonObject // Generate the index.php page to be the home page //------------------------------------------------- - $result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl); + $result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl); } } From 82fd84fb484fc4ee23bfb3437a5cced5b8e988d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 11:22:43 +0100 Subject: [PATCH 15/49] Fix scrutinizer errors --- htdocs/compta/facture/fiche-rec.php | 2 +- .../compta/localtax/class/localtax.class.php | 30 +++++++++---------- htdocs/core/class/commonobject.class.php | 6 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index e1b5af4e88d..8d955f1141d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1189,7 +1189,7 @@ if ($action == 'create') $disableedit=1; $disablemove=1; $disableremove=1; - $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice } print "\n"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 570942590c2..79a88d11c4d 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -132,7 +132,7 @@ class Localtax extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update(User $user, $notrigger=0) { global $conf, $langs; @@ -149,8 +149,8 @@ class Localtax extends CommonObject $this->db->begin(); // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; - $sql.= " localtaxtype=".$this->ltt.","; + $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; + $sql.= " localtaxtype=".$this->ltt.","; $sql.= " tms='".$this->db->idate($this->tms)."',"; $sql.= " datep='".$this->db->idate($this->datep)."',"; $sql.= " datev='".$this->db->idate($this->datev)."',"; @@ -160,7 +160,7 @@ class Localtax extends CommonObject $sql.= " fk_bank=".$this->fk_bank.","; $sql.= " fk_user_creat=".$this->fk_user_creat.","; $sql.= " fk_user_modif=".$this->fk_user_modif; - $sql.= " WHERE rowid=".$this->id; + $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); @@ -255,12 +255,12 @@ class Localtax extends CommonObject } - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK - */ + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK + */ function delete($user) { // Call trigger @@ -285,11 +285,11 @@ class Localtax extends CommonObject /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fe4eaffc177..4179863400c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2739,7 +2739,7 @@ abstract class CommonObject * @param string $targettype Object target type (if not defined, elemennt name of object) * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided * @param int $alsosametype 0=Return only links to object that differs from source. 1=Include also link to objects of same type. - * @return void + * @return int <0 if KO, >0 if OK * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1) @@ -2920,10 +2920,12 @@ abstract class CommonObject } } } + return 1; } else { dol_print_error($this->db); + return -1; } } @@ -3582,7 +3584,7 @@ abstract class CommonObject * Return HTML table for object lines * TODO Move this into an output class file (htmlline.class.php) * If lines are into a template, title must also be into a template - * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. + * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * * @param string $action Action code * @param string $seller Object of seller third party From e574ec4bf14507f0b09781d70d44246dde69379e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 11:28:01 +0100 Subject: [PATCH 16/49] Fix backward compatibility --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4179863400c..378898e0607 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4520,6 +4520,7 @@ abstract class CommonObject } else { + global $extrafields; dol_syslog("Warning: fetch_optionals was called with param optionsArray defined when you should pass null now", LOG_WARNING); } From 9355c5a8d79eb6ec14c07b82eafc20e531b192ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 11:31:57 +0100 Subject: [PATCH 17/49] Fix scrutinizer --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 378898e0607..7e565e0222f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4694,7 +4694,7 @@ abstract class CommonObject if ($this->array_options[$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { // If there is an encryption choice, we use it to crypt data before insert - $tmparrays = array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options']) + $tmparrays = array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options']); $algo=reset($tmparrays); if ($algo != '') { From d8b2d1f8c283e5b1f05bed2bfbec50a7ff204614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 12:11:28 +0100 Subject: [PATCH 18/49] Add example of test credit card --- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/stripe.lang | 3 ++- htdocs/public/payment/newpayment.php | 2 +- htdocs/public/stripe/newpayment.php | 2 +- htdocs/stripe/admin/stripe.php | 2 ++ htdocs/theme/eldy/style.css.php | 7 ++++--- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0fd9fe52b3e..67dce721afe 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -707,6 +707,7 @@ WarningYouAreInMaintenanceMode=Warning, you are in a maintenance mode, so only l CoreErrorTitle=System error CoreErrorMessage=Sorry, an error occurred. Contact your system administrator to check the logs or disable $dolibarr_main_prod=1 to get more information. CreditCard=Credit card +ValidatePayment=Validate payment FieldsWithAreMandatory=Fields with %s are mandatory FieldsWithIsForPublic=Fields with %s are shown on public list of members. If you don't want this, check off the "public" box. AccordingToGeoIPDatabase=(according to GeoIP convertion) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index ff6b4a58608..2b5823c28fb 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -38,4 +38,5 @@ STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key STRIPE_LIVE_SECRET_KEY=Secret live key STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode) -StripeImportPayment=Import Stripe payments \ No newline at end of file +StripeImportPayment=Import Stripe payments +ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails) \ No newline at end of file diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 74ffcfd120a..dc9bbad1188 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1442,7 +1442,7 @@ if (preg_match('/^dopayment/',$action))
- + diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 36cd64b4f01..ff1b03187c1 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -1168,7 +1168,7 @@ if (preg_match('/^dopayment/',$action))
- + diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c658e19fa20..5762c54a698 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -253,6 +253,8 @@ $token=''; include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php'; +print info_admin($langs->trans("ExampleOfTestCreditCard", '4242424242424242', '4000000000000101', '4000000000000069', '4000000000000341')); + if (! empty($conf->use_javascript_ajax)) { print "\n".'