diff --git a/htdocs/core/quickadd_page.php b/htdocs/core/quickadd_page.php new file mode 100644 index 00000000000..e97636e928d --- /dev/null +++ b/htdocs/core/quickadd_page.php @@ -0,0 +1,121 @@ + + * Copyright (C) 2024 Frédéric France + * + * This file is a modified version of datepicker.php from phpBSM to fix some + * bugs, to add new features and to dramatically increase speed. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/quickadd_page.php + * \brief File to return a page with the link for a quick add + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', 1); +} +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', 1); +} +//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', 1); +} +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); + +require_once '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +if (GETPOST('lang', 'aZ09')) { + $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php +} + +$langs->loadLangs(array("main", "other")); + +$action = GETPOST('action', 'aZ09'); + +/*$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); +$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');*/ + + +/* + * Actions + */ + +// None + + +/* + * View + */ + +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. +if (empty($dolibarr_nocache) && GETPOSTINT('cache')) { + header('Cache-Control: max-age='.GETPOSTINT('cache').', public'); + // For a .php, we must set an Expires to avoid to have it forced to an expired value by the web server + header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + GETPOSTINT('cache')).' GMT'); + // HTTP/1.0 + header('Pragma: token=public'); +} else { + // HTTP/1.0 + header('Cache-Control: no-cache'); +} + +$title = $langs->trans("QuickAdd"); + +// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests +$head = ''."\n"; // This is used by DoliDroid to know page is a search page +$arrayofjs = array(); +$arrayofcss = array(); +top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); + + + +print ''."\n"; +print '
'; +//print '
'; + +// Instantiate hooks of thirdparty module +$hookmanager->initHooks(array('quickaddform')); + +// Show all forms +print "\n"; +print "\n"; +print '
'; +print ''; +print '
'."\n"; + +print printDropdownQuickadd(1); + +print '
'."\n"; +print '
'; +print "\n\n"; + + +print '
'; +print ''."\n"; + +$db->close(); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2d03f2e0889..f30689eccab 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2940,9 +2940,10 @@ function top_menu_importfile() /** * Generate list of quickadd items * - * @return string HTML output + * @param int $mode 1=No scroll + * @return string HTML output */ -function printDropdownQuickadd() +function printDropdownQuickadd($mode = 0) { global $user, $langs, $hookmanager; @@ -3075,7 +3076,9 @@ function printDropdownQuickadd() $dropDownQuickAddHtml = ''; // Define $dropDownQuickAddHtml - $dropDownQuickAddHtml .= ''; return $dropDownQuickAddHtml;