Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1e706fd090
@ -641,11 +641,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
// We discard showing according to filters
|
||||
if ($search_keyword) {
|
||||
$qualified = 0;
|
||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
||||
if (preg_match('/'.preg_quote($search_keyword, '/').'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduletechnicalname)
|
||||
|| ($moduledesc && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesc))
|
||||
|| ($moduledesclong && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesclong))
|
||||
|| ($moduleauthor && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduleauthor))
|
||||
) {
|
||||
$qualified = 1;
|
||||
}
|
||||
|
||||
@ -203,11 +203,11 @@ function printDropdownBookmarksList()
|
||||
|
||||
$html .= '<!-- script to open/close the popup -->
|
||||
<script>
|
||||
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
||||
jQuery(document).on("keyup", "#top-bookmark-search-input", function () {
|
||||
console.log("keyup in bookmark search input");
|
||||
|
||||
var filter = $(this).val(), count = 0;
|
||||
$("#dropdown-bookmarks-list .bookmark-item").each(function () {
|
||||
jQuery("#dropdown-bookmarks-list .bookmark-item").each(function () {
|
||||
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
|
||||
$(this).addClass("hidden-search-result");
|
||||
} else {
|
||||
@ -215,7 +215,7 @@ function printDropdownBookmarksList()
|
||||
count++;
|
||||
}
|
||||
});
|
||||
$("#top-bookmark-search-filter-count").text(count);
|
||||
jQuery("#top-bookmark-search-filter-count").text(count);
|
||||
if (count == 0) {
|
||||
jQuery("#top-bookmark-search-nothing-found").removeClass("hidden-search-result");
|
||||
} else {
|
||||
|
||||
@ -459,7 +459,7 @@ if (isModEnabled('don') && !empty($user->rights->don->lire)) {
|
||||
$donationstatic->ref = $obj->rowid;
|
||||
$donationstatic->lastname = $obj->lastname;
|
||||
$donationstatic->firstname = $obj->firstname;
|
||||
$donationstatic->date = $obj->date;
|
||||
$donationstatic->date = $db->jdate($obj->date);
|
||||
$donationstatic->statut = $obj->status;
|
||||
$donationstatic->status = $obj->status;
|
||||
|
||||
|
||||
@ -55,9 +55,10 @@ class DolibarrDebugBar extends DebugBar
|
||||
public function getRenderer()
|
||||
{
|
||||
$renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/maximebf/debugbar/src/DebugBar/Resources');
|
||||
//$renderer->disableVendor('jquery');
|
||||
$renderer->disableVendor('fontawesome');
|
||||
$renderer->disableVendor('highlightjs');
|
||||
$renderer->disableVendor('jquery'); // We already have jquery loaded globally by the main.inc.php
|
||||
$renderer->disableVendor('fontawesome'); // We already have fontawesome loaded globally by the main.inc.php
|
||||
$renderer->disableVendor('highlightjs'); // We don't need this
|
||||
$renderer->setEnableJqueryNoConflict(false); // We don't need no conflict
|
||||
return $renderer;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,125 +0,0 @@
|
||||
/*
|
||||
|
||||
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
||||
|
||||
*/
|
||||
|
||||
div.phpdebugbar .hljs {
|
||||
display: block; padding: 0.5em;
|
||||
color: #333;
|
||||
background: #f8f8f8
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-comment,
|
||||
div.phpdebugbar .hljs-template_comment,
|
||||
div.phpdebugbar .diff .hljs-header,
|
||||
div.phpdebugbar .hljs-javadoc {
|
||||
color: #998;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-keyword,
|
||||
div.phpdebugbar .css .rule .hljs-keyword,
|
||||
div.phpdebugbar .hljs-winutils,
|
||||
div.phpdebugbar .javascript .hljs-title,
|
||||
div.phpdebugbar .nginx .hljs-title,
|
||||
div.phpdebugbar .hljs-subst,
|
||||
div.phpdebugbar .hljs-request,
|
||||
div.phpdebugbar .hljs-status {
|
||||
color: #333;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-number,
|
||||
div.phpdebugbar .hljs-hexcolor,
|
||||
div.phpdebugbar .ruby .hljs-constant {
|
||||
color: #099;
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-string,
|
||||
div.phpdebugbar .hljs-tag .hljs-value,
|
||||
div.phpdebugbar .hljs-phpdoc,
|
||||
div.phpdebugbar .tex .hljs-formula {
|
||||
color: #d14
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-title,
|
||||
div.phpdebugbar .hljs-id,
|
||||
div.phpdebugbar .coffeescript .hljs-params,
|
||||
div.phpdebugbar .scss .hljs-preprocessor {
|
||||
color: #900;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
div.phpdebugbar .javascript .hljs-title,
|
||||
div.phpdebugbar .lisp .hljs-title,
|
||||
div.phpdebugbar .clojure .hljs-title,
|
||||
div.phpdebugbar .hljs-subst {
|
||||
font-weight: normal
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-class .hljs-title,
|
||||
div.phpdebugbar .haskell .hljs-type,
|
||||
div.phpdebugbar .vhdl .hljs-literal,
|
||||
div.phpdebugbar .tex .hljs-command {
|
||||
color: #458;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-tag,
|
||||
div.phpdebugbar .hljs-tag .hljs-title,
|
||||
div.phpdebugbar .hljs-rules .hljs-property,
|
||||
div.phpdebugbar .django .hljs-tag .hljs-keyword {
|
||||
color: #000080;
|
||||
font-weight: normal
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-attribute,
|
||||
div.phpdebugbar .hljs-variable,
|
||||
div.phpdebugbar .lisp .hljs-body {
|
||||
color: #008080
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-regexp {
|
||||
color: #009926
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-symbol,
|
||||
div.phpdebugbar .ruby .hljs-symbol .hljs-string,
|
||||
div.phpdebugbar .lisp .hljs-keyword,
|
||||
div.phpdebugbar .tex .hljs-special,
|
||||
div.phpdebugbar .hljs-prompt {
|
||||
color: #990073
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-built_in,
|
||||
div.phpdebugbar .lisp .hljs-title,
|
||||
div.phpdebugbar .clojure .hljs-built_in {
|
||||
color: #0086b3
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-preprocessor,
|
||||
div.phpdebugbar .hljs-pragma,
|
||||
div.phpdebugbar .hljs-pi,
|
||||
div.phpdebugbar .hljs-doctype,
|
||||
div.phpdebugbar .hljs-shebang,
|
||||
div.phpdebugbar .hljs-cdata {
|
||||
color: #999;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-deletion {
|
||||
background: #fdd
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-addition {
|
||||
background: #dfd
|
||||
}
|
||||
|
||||
div.phpdebugbar .diff .hljs-change {
|
||||
background: #0086b3
|
||||
}
|
||||
|
||||
div.phpdebugbar .hljs-chunk {
|
||||
color: #aaa
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -2363,32 +2363,32 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
||||
$btnUser .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
|
||||
//console.log("close login dropdown");
|
||||
// Hide the menus.
|
||||
$("#topmenu-login-dropdown").removeClass("open");
|
||||
jQuery("#topmenu-login-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
';
|
||||
|
||||
if ($conf->theme != 'md') {
|
||||
$btnUser .= '
|
||||
$("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
jQuery("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
console.log("toggle login dropdown");
|
||||
event.preventDefault();
|
||||
$("#topmenu-login-dropdown").toggleClass("open");
|
||||
jQuery("#topmenu-login-dropdown").toggleClass("open");
|
||||
});
|
||||
|
||||
$("#topmenulogincompanyinfo-btn").on("click", function() {
|
||||
jQuery("#topmenulogincompanyinfo-btn").on("click", function() {
|
||||
console.log("Clik on topmenulogincompanyinfo-btn");
|
||||
$("#topmenulogincompanyinfo").slideToggle();
|
||||
jQuery("#topmenulogincompanyinfo").slideToggle();
|
||||
});
|
||||
|
||||
$("#topmenuloginmoreinfo-btn").on("click", function() {
|
||||
jQuery("#topmenuloginmoreinfo-btn").on("click", function() {
|
||||
console.log("Clik on topmenuloginmoreinfo-btn");
|
||||
$("#topmenuloginmoreinfo").slideToggle();
|
||||
jQuery("#topmenuloginmoreinfo").slideToggle();
|
||||
});';
|
||||
}
|
||||
|
||||
@ -2420,8 +2420,8 @@ function top_menu_quickadd()
|
||||
$html .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-quickadd-dropdown").length) {
|
||||
// Hide the menus.
|
||||
$("#topmenu-quickadd-dropdown").removeClass("open");
|
||||
@ -2665,8 +2665,8 @@ function top_menu_bookmark()
|
||||
$html .= '
|
||||
<!-- Code to show/hide the bookmark drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
||||
//console.log("close bookmark dropdown - we click outside");
|
||||
// Hide the menus.
|
||||
@ -2674,13 +2674,13 @@ function top_menu_bookmark()
|
||||
}
|
||||
});
|
||||
|
||||
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
jQuery("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
console.log("toggle bookmark dropdown");
|
||||
openBookMarkDropDown();
|
||||
});
|
||||
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
jQuery(document).keydown(function(e){
|
||||
if( e.which === 77 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + m : trigger open bookmark dropdown\');
|
||||
openBookMarkDropDown();
|
||||
@ -2690,8 +2690,8 @@ function top_menu_bookmark()
|
||||
|
||||
var openBookMarkDropDown = function() {
|
||||
event.preventDefault();
|
||||
$("#topmenu-bookmark-dropdown").toggleClass("open");
|
||||
$("#top-bookmark-search-input").focus();
|
||||
jQuery("#topmenu-bookmark-dropdown").toggleClass("open");
|
||||
jQuery("#top-bookmark-search-input").focus();
|
||||
}
|
||||
|
||||
});
|
||||
@ -2765,10 +2765,10 @@ function top_menu_search()
|
||||
$html .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
// prevent submiting form on press ENTER
|
||||
$("#top-global-search-input").keydown(function (e) {
|
||||
jQuery("#top-global-search-input").keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
var inputs = $(this).parents("form").eq(0).find(":button");
|
||||
if (inputs[inputs.index(this) + 1] != null) {
|
||||
@ -2780,7 +2780,7 @@ function top_menu_search()
|
||||
});
|
||||
|
||||
// arrow key nav
|
||||
$(document).keydown(function(e) {
|
||||
jQuery(document).keydown(function(e) {
|
||||
// Get the focused element:
|
||||
var $focused = $(":focus");
|
||||
if($focused.length && $focused.hasClass("global-search-item")){
|
||||
@ -2801,28 +2801,28 @@ function top_menu_search()
|
||||
|
||||
|
||||
// submit form action
|
||||
$(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
|
||||
$("#top-menu-action-search").attr("action", $(this).data("target"));
|
||||
$("#top-menu-action-search").submit();
|
||||
jQuery(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
|
||||
jQuery("#top-menu-action-search").attr("action", $(this).data("target"));
|
||||
jQuery("#top-menu-action-search").submit();
|
||||
});
|
||||
|
||||
// close drop down
|
||||
$(document).on("click", function(event) {
|
||||
jQuery(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
|
||||
console.log("click close search - we click outside");
|
||||
// Hide the menus.
|
||||
$("#topmenu-global-search-dropdown").removeClass("open");
|
||||
jQuery("#topmenu-global-search-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
|
||||
// Open drop down
|
||||
$("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
jQuery("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
console.log("toggle search dropdown");
|
||||
openGlobalSearchDropDown();
|
||||
});
|
||||
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
jQuery(document).keydown(function(e){
|
||||
if( e.which === 70 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + f : trigger open global-search dropdown\');
|
||||
openGlobalSearchDropDown();
|
||||
@ -2831,8 +2831,8 @@ function top_menu_search()
|
||||
|
||||
|
||||
var openGlobalSearchDropDown = function() {
|
||||
$("#topmenu-global-search-dropdown").toggleClass("open");
|
||||
$("#top-global-search-input").focus();
|
||||
jQuery("#topmenu-global-search-dropdown").toggleClass("open");
|
||||
jQuery("#top-global-search-input").focus();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -32,18 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$TSelectedProducts = GETPOST('products', 'array');
|
||||
$TSelectedCats = GETPOST('categories', 'array');
|
||||
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'societe', '', '');
|
||||
$result = restrictedArea($user, 'margins');
|
||||
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -74,6 +62,17 @@ if (GETPOST('enddatemonth')) {
|
||||
$object = new Societe($db);
|
||||
$hookmanager->initHooks(array('margincustomerlist'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$TSelectedProducts = GETPOST('products', 'array');
|
||||
$TSelectedCats = GETPOST('categories', 'array');
|
||||
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'societe', '', '');
|
||||
$result = restrictedArea($user, 'margins');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -157,7 +156,7 @@ print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $
|
||||
print '</td></tr>';
|
||||
|
||||
// Categories
|
||||
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
|
||||
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
|
||||
@ -38,17 +38,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$TSelectedCats = GETPOST('categories', 'array');
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
if (empty($user->rights->margins->liretous)) {
|
||||
accessforbidden();
|
||||
}
|
||||
$socid = 0;
|
||||
|
||||
$mesg = '';
|
||||
|
||||
@ -85,6 +75,17 @@ if (GETPOST('enddatemonth')) {
|
||||
$object = new Product($db);
|
||||
$hookmanager->initHooks(array('marginproductlist'));
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
if (empty($user->rights->margins->liretous)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -119,7 +120,7 @@ print img_picto('', 'product').$form->select_produits(($id > 0 ? $id : ''), 'id'
|
||||
print '</td></tr>';
|
||||
|
||||
// Categories
|
||||
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
|
||||
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
@ -47,6 +46,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mostockmovement'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
@ -438,7 +438,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."product as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."stock_mouvement as m";
|
||||
if (is_array($extrafields->attributes[$objectlist->table_element]['label']) && count($extrafields->attributes[$objectlist->table_element]['label'])) {
|
||||
if (!empty($extrafields->attributes[$objectlist->table_element]) && is_array($extrafields->attributes[$objectlist->table_element]['label']) && count($extrafields->attributes[$objectlist->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$objectlist->table_element."_extrafields as ef on (m.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid";
|
||||
@ -503,6 +503,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
@ -568,9 +574,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
if ($id > 0) {
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
} else {
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -730,55 +736,74 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['m.rowid']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.datem']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['p.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.batch']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['pl.eatby']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['pl.sellby']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['e.ref']['checked'])) {
|
||||
// We are on a specific warehouse card, no filter on other should be possible
|
||||
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.fk_user_author']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.inventorycode']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['origin']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.fk_projet']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.fk_projet']['label'], $_SERVER["PHP_SELF"], "m.fk_projet", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.value']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.price']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
@ -790,22 +815,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['m.datec']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['m.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
$totalarray['nbfield']++;
|
||||
print "</tr>\n";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$totalarray = array();
|
||||
$i = 0;
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
@ -979,6 +1004,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
if (empty($num)) {
|
||||
print '<tr><td colspan="'.$savnbfield.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -104,6 +104,8 @@ class AllTests
|
||||
$suite->addTestSuite('XCalLibTest');
|
||||
|
||||
// Rules into source files content
|
||||
require_once dirname(__FILE__).'/RepositoryTest.php';
|
||||
$suite->addTestSuite('RepositoryTest');
|
||||
require_once dirname(__FILE__).'/LangTest.php';
|
||||
$suite->addTestSuite('LangTest');
|
||||
require_once dirname(__FILE__).'/CodingSqlTest.php';
|
||||
|
||||
@ -158,7 +158,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* testSql
|
||||
* testPHP
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -171,8 +171,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$db=$this->savdb;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname', SORT_ASC, 0, 0, '', 1);
|
||||
//$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname');
|
||||
$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname', SORT_ASC, 0, 1, '', 1);
|
||||
|
||||
foreach ($filesarray as $key => $file) {
|
||||
if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) {
|
||||
|
||||
@ -469,25 +469,6 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_dir of ".$dirout." into ".$conf->admin->dir_temp.'/testdir.zip');
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolDirList
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @depends testDolCompressUnCompress
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testDolDirList()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
// Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate).
|
||||
$founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
|
||||
print __METHOD__." count(founddirs)=".count($founddirs)."\n";
|
||||
$this->assertEquals(1, count($founddirs));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolCheckSecureAccessDocument
|
||||
*
|
||||
|
||||
214
test/phpunit/RepositoryTest.php
Normal file
214
test/phpunit/RepositoryTest.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file test/phpunit/RepositoryTest.php
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
*/
|
||||
|
||||
global $conf,$user,$langs,$db;
|
||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||
//require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/lib/files.lib.php';
|
||||
|
||||
if (! defined('NOREQUIREUSER')) {
|
||||
define('NOREQUIREUSER', '1');
|
||||
}
|
||||
if (! defined('NOREQUIREDB')) {
|
||||
define('NOREQUIREDB', '1');
|
||||
}
|
||||
if (! defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (! defined('NOREQUIRETRAN')) {
|
||||
define('NOREQUIRETRAN', '1');
|
||||
}
|
||||
if (! defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (! defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1');
|
||||
}
|
||||
if (! defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no menu to show
|
||||
}
|
||||
if (! defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
}
|
||||
if (! defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (! defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
}
|
||||
|
||||
if (empty($user->id)) {
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
|
||||
/**
|
||||
* Class for PHPUnit tests
|
||||
*
|
||||
* @backupGlobals disabled
|
||||
* @backupStaticAttributes enabled
|
||||
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
|
||||
*/
|
||||
class RepositoryTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* setUpBeforeClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDownAfterClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testJqueryOnce
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testJqueryOnce()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
// Scan dir to guarante we don't have library jquery twice
|
||||
$founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
|
||||
print __METHOD__." count(founddirs)=".count($founddirs)."\n";
|
||||
$this->assertEquals(1, count($founddirs), 'We found jquery lib (jquery.js) twice');
|
||||
|
||||
// Scan dir to guarante we don't have library jquery twice
|
||||
$founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.min\.js', array('ckeditor'));
|
||||
print __METHOD__." count(founddirs)=".count($founddirs)."\n";
|
||||
$this->assertEquals(1, count($founddirs), 'We found jquery lib (jquery.min.js) twice');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testRepository
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function testRepository()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'directories', 1, '', array('\/custom\/'), 'fullname', SORT_ASC, 0, 1, '', 1);
|
||||
//$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname');
|
||||
|
||||
$ok = true;
|
||||
foreach ($filesarray as $key => $file) {
|
||||
if (preg_match('/\/vendor\//', $file['fullname'])) {
|
||||
if (!preg_match('/php-imap/', $file['fullname'])) { // we accept 'vendor' dir for php-imap (not find how to do it easily without)
|
||||
print "Found a vendor dir into ".$file['fullname']."\n";
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertTrue($ok, 'Pb in list of files of repository');
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user