NEW The info_admin() can show text after click on other text
This commit is contained in:
parent
5823e2f5ef
commit
05f0242198
@ -325,7 +325,7 @@ class FormFile
|
||||
* @param int $notused Not used
|
||||
* @param integer $noform Do not output html form tags
|
||||
* @param string $param More param on http links
|
||||
* @param string $title Title to show on top of form
|
||||
* @param string $title Title to show on top of form. Example: '' (Default to "Documents") or 'none'
|
||||
* @param string $buttonlabel Label on submit button
|
||||
* @param string $codelang Default language code to use on lang combo box if multilang is enabled
|
||||
* @param string $morepicto Add more HTML content into cell with picto
|
||||
@ -408,7 +408,7 @@ class FormFile
|
||||
}
|
||||
|
||||
$titletoshow = $langs->trans("Documents");
|
||||
if (!empty($title)) $titletoshow = $title;
|
||||
if (!empty($title)) $titletoshow = ($title == 'none' ? '' : $title);
|
||||
|
||||
// Show table
|
||||
if ($genallowed)
|
||||
|
||||
@ -13,6 +13,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This tool can be included into a list page with
|
||||
* define('USE_CUSTOME_REPORT_AS_INCLUDE', 1);
|
||||
* include DOL_DOCUMENT_ROOT.'/core/customreports.php';
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,50 +25,48 @@
|
||||
* \brief Page to make custom reports
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
{
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
|
||||
$mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph';
|
||||
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||
$tabfamily = GETPOST('tabfamily', 'aZ09');
|
||||
|
||||
if (empty($objecttype)) $objecttype = 'thirdparty';
|
||||
|
||||
$search_filters = GETPOST('search_filters', 'array');
|
||||
$search_measures = GETPOST('search_measures', 'array');
|
||||
$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
$search_yaxis = GETPOST('search_yaxis', 'array');
|
||||
$search_graph = GETPOST('search_graph', 'none');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||
}
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("companies", "bills", "other", "exports"));
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
|
||||
$mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph';
|
||||
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||
$tabfamily = GETPOST('tabfamily', 'aZ09');
|
||||
|
||||
if (empty($objecttype)) $objecttype = 'thirdparty';
|
||||
|
||||
$search_filters = GETPOST('search_filters', 'array');
|
||||
$search_measures = GETPOST('search_measures', 'array');
|
||||
$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
$search_yaxis = GETPOST('search_yaxis', 'array');
|
||||
$search_graph = GETPOST('search_graph', 'none');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
//accessforbidden();
|
||||
}
|
||||
$langs->loadLangs(array("companies", "other", "exports"));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||
$hookmanager->initHooks(array('customreport')); // Note that conf->hooks_modules contains array
|
||||
|
||||
$title = '';
|
||||
@ -105,6 +107,9 @@ elseif (is_array($hookmanager->resArray)) {
|
||||
$arrayoftype[$key] = $val;
|
||||
}
|
||||
}
|
||||
if (! empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
|
||||
$modenotusedforlist = $hookmanager->resArray['modenotusedforlist'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($objecttype) {
|
||||
@ -157,22 +162,27 @@ $search_component_params=array('');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||
|
||||
dol_fiche_head($head, 'customreports', $title, -1, $picto);
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
|
||||
$search_graph = 'lines';
|
||||
if ($action == 'viewgraph') {
|
||||
if (! count($search_measures)) {
|
||||
setEventMessages($langs->trans("AtLeastOneMeasureIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && count($search_xaxis) > 1) {
|
||||
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
|
||||
$search_xaxis = array(0 => $search_xaxis[0]);
|
||||
}
|
||||
if (! count($search_xaxis)) {
|
||||
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
|
||||
$search_graph = 'lines';
|
||||
}
|
||||
}
|
||||
if ($mode == 'graph' && count($search_xaxis) > 1) {
|
||||
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
|
||||
$search_xaxis = array(0 => $search_xaxis[0]);
|
||||
}
|
||||
|
||||
|
||||
//$head = commande_prepare_head(null);
|
||||
dol_fiche_head($head, 'customreports', $title, -1, $picto);
|
||||
|
||||
|
||||
$tmparray=dol_getdate(dol_now());
|
||||
$endyear=$tmparray['year'];
|
||||
@ -188,6 +198,7 @@ $arrayofyaxis = array();
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="viewgraph">';
|
||||
print '<input type="hidden" name="tabfamily" value="'.$tabfamily.'">';
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -195,7 +206,13 @@ print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
// Select object
|
||||
print '<div class="divadvancedsearchfield center floatnone">';
|
||||
print '<div class="inline-block"><span class="opacitymedium">'.$langs->trans("StatisticsOn").'</span></div> ';
|
||||
print $form->selectarray('objecttype', $arrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', '', 1);
|
||||
$newarrayoftype = array();
|
||||
foreach($arrayoftype as $key => $val) {
|
||||
if (dol_eval($val['enabled'], 1)) {
|
||||
$newarrayoftype[$key] = $arrayoftype[$key];
|
||||
}
|
||||
}
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', '', 1);
|
||||
if (empty($conf->use_javascript_ajax)) print '<input type="submit" class="button" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
else {
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -209,7 +226,6 @@ else {
|
||||
}
|
||||
print '</div><div class="clearboth"></div>';
|
||||
|
||||
|
||||
// Add Filter
|
||||
print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params);
|
||||
@ -507,13 +523,14 @@ if ($mode == 'graph') {
|
||||
|
||||
if ($sql) {
|
||||
// Show admin info
|
||||
print '<br>'.info_admin($langs->trans("SQLUsedForExport").':<br> '.$sql);
|
||||
print '<br>'.info_admin($langs->trans("SQLUsedForExport").':<br> '.$sql, 0, 0, 1, '', 'TechnicalInformation');
|
||||
}
|
||||
|
||||
print '<div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -3822,23 +3822,44 @@ function img_searchclear($titlealt = 'default', $other = '')
|
||||
/**
|
||||
* Show information for admin users or standard users
|
||||
*
|
||||
* @param string $text Text info
|
||||
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
|
||||
* @param int $nodiv No div
|
||||
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other
|
||||
* @param string $morecss More CSS ('', 'warning', 'error')
|
||||
* @return string String with info text
|
||||
* @param string $text Text info
|
||||
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
|
||||
* @param int $nodiv No div
|
||||
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other
|
||||
* @param string $morecss More CSS ('', 'warning', 'error')
|
||||
* @param string $textfordropdown Show a text to click to dropdown the info box.
|
||||
* @return string String with info text
|
||||
*/
|
||||
function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss = '')
|
||||
function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss = '', $textfordropdown = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($infoonimgalt)
|
||||
{
|
||||
return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"');
|
||||
$result = img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"');
|
||||
}
|
||||
else {
|
||||
if (empty($conf->use_javascript_ajax)) $textfordropdown = '';
|
||||
|
||||
$class = (empty($admin) ? 'undefined' : ($admin == '1' ? 'info' : $admin));
|
||||
$result = ($nodiv ? '' : '<div class="'.$class.' hideonsmartphone'.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
|
||||
|
||||
if ($textfordropdown) {
|
||||
$tmpresult .= '<span class="'.$class.'text opacitymedium">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>';
|
||||
$tmpresult .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".'.$class.'text").click(function() {
|
||||
console.log("toggle text");
|
||||
jQuery(".'.$class.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$result = $tmpresult.$result;
|
||||
}
|
||||
}
|
||||
|
||||
return ($nodiv ? '' : '<div class="'.(empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)).' hideonsmartphone'.($morecss ? ' '.$morecss : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -147,6 +147,7 @@ $htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$sqlusedforexport = '';
|
||||
|
||||
$head = array();
|
||||
$upload_dir = $conf->export->dir_temp.'/'.$user->id;
|
||||
|
||||
//$usefilters=($conf->global->MAIN_FEATURES_LEVEL > 1);
|
||||
@ -1266,22 +1267,17 @@ if ($step == 5 && $datatoexport)
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<table width="100%">';
|
||||
|
||||
if ($sqlusedforexport && $user->admin)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlusedforexport);
|
||||
print '</td></tr>';
|
||||
print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlusedforexport, 0, 0, 1, '', 'TechnicalInformation');
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
if (!is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp);
|
||||
|
||||
// Show existing generated documents
|
||||
// NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste
|
||||
print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', ' ', '', '', '');
|
||||
print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', '');
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -32,6 +32,8 @@ DateNextInvoiceBeforeGen=Date of next invoice (before generation)
|
||||
DateNextInvoiceAfterGen=Date of next invoice (after generation)
|
||||
GraphInBarsAreLimitedTo3Measures=Grapics are limited to 3 measures in 'Bars' mode. The mode 'Lines' was automatically selected instead.
|
||||
OnlyOneFieldForXAxisIsPossible=Only 1 field is currently possible as X-Axis. Only the first selected field has been selected.
|
||||
AtLeastOneMeasureIsRequired=At least 1 field for measure is required
|
||||
AtLeastOneXAxisIsRequired=At least 1 field for X-Axis is required
|
||||
|
||||
Notify_ORDER_VALIDATE=Sales order validated
|
||||
Notify_ORDER_SENTBYMAIL=Sales order sent by mail
|
||||
|
||||
Loading…
Reference in New Issue
Block a user