Clean code

This commit is contained in:
Laurent Destailleur 2021-03-10 16:41:48 +01:00
parent 514a9fb96a
commit c2200e6ffd
12 changed files with 61 additions and 37 deletions

View File

@ -318,8 +318,8 @@ print "</table></div>";
print "<br>\n";
print $resultboxes['boxlista'];
print '</div>'."\n";
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';

View File

@ -40,7 +40,7 @@ $action = GETPOST('action', 'aZ09');
// Define possible position of boxes
$pos_name = InfoBox::getListOfPagesForBoxes();
$arrayofhomepages = InfoBox::getListOfPagesForBoxes();
$boxes = array();
@ -348,7 +348,7 @@ foreach ($boxtoadd as $box) {
// For each possible position, an activation link is displayed if the box is not already active for that position
print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, -1, 1, 0, 0, '', 1)."\n";
print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';
@ -406,7 +406,7 @@ foreach ($boxactivated as $key => $box) {
print ($box->note ? $box->note : '&nbsp;');
}
print '</td>';
print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>';
print '<td class="center">'.(empty($arrayofhomepages[$box->position]) ? '' : $langs->trans($arrayofhomepages[$box->position])).'</td>';
$hasnext = ($key < (count($boxactivated) - 1));
$hasprevious = ($key != 0);
print '<td class="center">'.($key + 1).'</td>';

View File

@ -157,7 +157,10 @@ class box_nb_ticket_last_x_days extends ModeleBoxes
$stringtoshow .= '<input type="image" alt="' . $langs->trans("Refresh") . '" src="' . img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1) . '">';
$stringtoshow .= '</form>';
$stringtoshow .= '</div>';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
$totalnb = 0;
if (!$mesg) {

View File

@ -151,7 +151,9 @@ class box_nb_tickets_type extends ModeleBoxes
$stringtoprint = '';
$stringtoprint .= '<div class="div-table-responsive-no-min ">';
if (!empty($dataseries) && count($dataseries) > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
$totalnb = 0;
if (!$mesg) {

View File

@ -131,6 +131,7 @@ class box_new_vs_close_ticket extends ModeleBoxes
$stringtoprint = '';
$stringtoprint .= '<div class="div-table-responsive-no-min ">';
if (!empty($data) && count($data) > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {

View File

@ -157,6 +157,7 @@ class box_ticket_by_severity extends ModeleBoxes
$stringtoprint = '';
$stringtoprint .= '<div class="div-table-responsive-no-min ">';
if (!empty($dataseries) && count($dataseries) > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
$totalnb = 0;

View File

@ -40,17 +40,18 @@ class InfoBox
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
return array(
0 => 'Home',
1 => 'userhome',
2 => 'membersindex',
3 => 'thirdpartiesindex',
1 => 'UsersHome',
2 => 'MembersHome',
3 => 'ThirdpartiesHome',
11 => 'TicketsHome',
27 => 'AccountancyHome'
);
} else {
return array(
0 => 'Home',
1 => 'userhome',
2 => 'membersindex',
3 => 'thirdpartiesindex',
1 => 'UsersHome',
2 => 'MembersHome',
3 => 'ThirdpartiesHome',
4 => 'productindex',
5 => 'productindex',
6 => 'mrpindex',
@ -58,7 +59,7 @@ class InfoBox
8 => 'projectsindex',
9 => 'invoiceindex',
10 => 'hrmindex',
11 => 'ticketsindex',
11 => 'TicketsHome',
12 => 'stockindex',
13 => 'sendingindex',
14 => 'receptionindex',

View File

@ -257,7 +257,12 @@ UPDATE llx_payment_salary as ps SET ps.ref = ps.rowid WHERE ps.ref IS NULL;
ALTER TABLE llx_salary CHANGE paye paye smallint default 0 NOT NULL;
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_ticket_by_severity.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_ticket_by_severity.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_nb_ticket_last_x_days.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_nb_ticket_last_x_days.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_nb_tickets_type.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_nb_tickets_type.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_new_vs_close_ticket.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_new_vs_close_ticket.php' AND entity = 1);
DELETE FROM llx_boxes WHERE box_id IN (SELECT rowid FROM llx_boxes_def WHERE file IN ('box_ticket_by_severity.php', 'box_graph_nb_ticket_last_x_days.php', 'box_graph_nb_tickets_type.php', 'box_graph_new_vs_close_ticket.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_ticket_by_severity.php', 'box_graph_nb_ticket_last_x_days.php', 'box_graph_nb_tickets_type.php', 'box_graph_new_vs_close_ticket.php');
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_ticket_by_severity.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_ticket_by_severity.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_ticket_last_x_days.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_nb_ticket_last_x_days.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_tickets_type.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_nb_tickets_type.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_new_vs_close_ticket.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_new_vs_close_ticket.php' AND entity = 1);

View File

@ -111,5 +111,9 @@ BoxTitleLastCustomerShipments=Latest %s customer shipments
NoRecordedShipments=No recorded customer shipment
BoxCustomersOutstandingBillReached=Customers with oustanding limit reached
# Pages
AccountancyHome=Accountancy
UsersHome=Home users and groups
MembersHome=Home Membership
ThirdpartiesHome=Home Thirdparties
TicketsHome=Home Tickets
AccountancyHome=Home Accountancy
ValidatedProjects=Validated projects

View File

@ -1845,12 +1845,15 @@ div.fichehalfright {
print "margin-top: 10px;\n";
} ?>
}
div.firstcolumn div.box {
/*div.firstcolumn div.box {
padding-right: 10px;
}
div.secondcolumn div.box {
padding-left: 10px;
}
}*/
/* Force values on one colum for small screen */
@media only screen and (max-width: 1000px)
{

View File

@ -1846,12 +1846,14 @@ div.fichehalfright {
print "margin-top: 10px;\n";
} ?>
}
div.firstcolumn div.box {
/*div.firstcolumn div.box {
padding-right: 10px;
}
div.secondcolumn div.box {
padding-left: 10px;
}
}*/
/* Force values on one colum for small screen */
@media only screen and (max-width: 900px)
{

View File

@ -114,7 +114,12 @@ $startyear = $endyear - 1;
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%';
$HEIGHT = '200';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">';
print '<div class="twocolumns">';
print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
/*
* Statistics area
@ -281,8 +286,13 @@ print '</div>';
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<br>'."\n";
print $resultboxes['boxlista'];
print '</div>'."\n";
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
/*
* Latest tickets
@ -400,28 +410,20 @@ if ($result) {
dol_print_error($db);
}
print '</div></div></div>';
/*
* Show boxes
*/
$boxlist .= '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
$boxlist .= $resultboxes['boxlista'];
$boxlist .= '</div>';
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>';
$boxlist .= "\n";
$boxlist .= '</div>';
print $boxlist;
print $resultboxes['boxlistb'];
print '</div>';
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardTickets', $parameters, $object); // Note that $action and $object may have been modified by hook
// End of page
llxFooter('');
$db->close();