NEW Share msg "not found" for widgets and add a button to add new record when none exists (#31309)

* New msg displayed on widghet

* update msg

* comment code on box_fediverse

* comment code on box_fediverse and delete code langs

* fix errors

* remove underscore before comparing files

* update boxes for get messages and buttons

* continue adding button for widgets

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
lamrani abdelwadoud 2024-10-14 11:56:59 +02:00 committed by GitHub
parent 28cbda6a0b
commit 39e021feba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 258 additions and 225 deletions

View File

@ -55,6 +55,9 @@ class box_actions extends ModeleBoxes
$this->enabled = isModEnabled('agenda');
$this->hidden = !($user->hasRight('agenda', 'myactions', 'read'));
$this->urltoaddentry = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$this->msgNoRecords = 'NoActionsToDo';
}
/**
@ -173,12 +176,12 @@ class box_actions extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
// );
// }
$this->db->free($result);
} else {

View File

@ -51,6 +51,8 @@ class box_boms extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('bom', 'read');
$this->urltoaddentry = DOL_URL_ROOT.'/bom/bom_card.php?action=create';
$this->msgNoRecords = 'NoRecordedOrders';
}
/**
@ -149,12 +151,12 @@ class box_boms extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
// );
// }
$this->db->free($result);
} else {

View File

@ -47,6 +47,8 @@ class box_bookmarks extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('bookmark', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/bookmarks/card.php?action=create';
$this->msgNoRecords = 'NoRecordedBookmarks';
}
/**
@ -109,17 +111,17 @@ class box_bookmarks extends ModeleBoxes
$line++;
}
if ($num == 0) {
$mytxt = $langs->trans("NoRecordedBookmarks");
if ($user->hasRight("bookmark", "creer")) {
$mytxt .= ' '.$langs->trans("ClickToAdd");
}
$this->info_box_contents[$line][0] = array(
'td' => 'class="center" colspan="2"',
'tooltip' => $mytxt,
'url' => DOL_URL_ROOT.'/bookmarks/list.php', 'text' => $mytxt,
);
}
// if ($num == 0) {
// $mytxt = $langs->trans("NoRecordedBookmarks");
// if ($user->hasRight("bookmark", "creer")) {
// $mytxt .= ' '.$langs->trans("ClickToAdd");
// }
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center" colspan="2"',
// 'tooltip' => $mytxt,
// 'url' => DOL_URL_ROOT.'/bookmarks/list.php', 'text' => $mytxt,
// );
// }
$this->db->free($result);
} else {

View File

@ -58,6 +58,9 @@ class box_clients extends ModeleBoxes
}
$this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid));
$this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=c';
$this->msgNoRecords = 'NoRecordedCustomers';
}
/**
@ -147,12 +150,6 @@ class box_clients extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedCustomers").'</span>'
);
}
$this->db->free($result);
} else {

View File

@ -51,6 +51,10 @@ class box_commandes extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('commande', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/commande/card.php?action=create';
$this->msgNoRecords = 'NoRecordedOrders';
}
/**
@ -186,12 +190,6 @@ class box_commandes extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
);
}
$this->db->free($result);
} else {

View File

@ -60,6 +60,8 @@ class box_comptes extends ModeleBoxes
}
$this->hidden = !$user->hasRight('banque', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/compta/bank/card.php?action=create';
$this->msgNoRecords = 'NoRecordedBankAccounts';
}
/**
@ -164,12 +166,6 @@ class box_comptes extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedBankAccounts").'</span>'
);
}
$this->db->free($result);
} else {

View File

@ -54,6 +54,9 @@ class box_contacts extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('societe', 'lire') && $user->hasRight('societe', 'contact', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/contact/card.php?action=create';
$this->msgNoRecords = 'NoRecordedContacts';
}
/**
@ -183,13 +186,13 @@ class box_contacts extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedContacts").'</span>',
'asis' => 1
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedContacts").'</span>',
// 'asis' => 1
// );
// }
$this->db->free($result);
} else {

View File

@ -50,6 +50,8 @@ class box_contracts extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('contrat', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create';
$this->msgNoRecords = 'NoRecordedContracts';
}
/**
@ -162,12 +164,12 @@ class box_contracts extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedContracts").'</span>'
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedContracts").'</span>'
// );
// }
$this->db->free($resql);
} else {

View File

@ -52,6 +52,7 @@ class box_external_rss extends ModeleBoxes
{
$this->db = $db;
$this->paramdef = $param;
$this->urltoaddentry = DOL_URL_ROOT.'/admin/external_rss.php';
}
/**

View File

@ -49,6 +49,8 @@ class box_factures extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('facture', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/compta/facture/card.php?action=create';
$this->msgNoRecords = 'NoRecordedInvoices';
}
/**
@ -197,12 +199,12 @@ class box_factures extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedInvoices").'</span>',
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedInvoices").'</span>',
// );
// }
$this->db->free($result);
} else {

View File

@ -50,6 +50,8 @@ class box_factures_fourn extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('fournisseur', 'facture', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/fourn/facture/card.php?action=create';
$this->msgNoRecords = 'NoModifiedSupplierBills';
}
/**
@ -193,12 +195,12 @@ class box_factures_fourn extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoModifiedSupplierBills").'</span>',
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoModifiedSupplierBills").'</span>',
// );
// }
$this->db->free($result);
} else {

View File

@ -53,6 +53,8 @@ class box_factures_imp extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('facture', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/compta/facture/card.php?action=create';
$this->msgNoRecords = 'NoUnpaidCustomerBills';
}
/**
@ -220,10 +222,10 @@ class box_factures_imp extends ModeleBoxes
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center" colspan="3"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoUnpaidCustomerBills").'</span>'
);
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center" colspan="3"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoUnpaidCustomerBills").'</span>'
// );
} else {
$sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2;

View File

@ -50,6 +50,8 @@ class box_fediverse extends ModeleBoxes
{
$this->db = $db;
$this->paramdef = $param;
$this->urltoaddentry = DOL_URL_ROOT.'/admin/fediverse.php';
$this->msgNoRecords = 'NoRecordFound';
}
/**
@ -150,12 +152,12 @@ class box_fediverse extends ModeleBoxes
}
if ($nbitems == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>'
);
}
// if ($nbitems == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>'
// );
// }
}

View File

@ -50,6 +50,8 @@ class box_ficheinter extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('ficheinter', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/fichinter/card.php?action=create';
$this->msgNoRecords = 'NoRecordedInterventions';
}
/**
@ -151,12 +153,12 @@ class box_ficheinter extends ModeleBoxes
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedInterventions").'</span>'
);
}
// if ($num == 0) {
// $this->info_box_contents[$i][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedInterventions").'</span>'
// );
// }
$this->db->free($resql);
} else {

View File

@ -51,6 +51,8 @@ class box_fournisseurs extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid));
$this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=f';
$this->msgNoRecords = 'NoRecordedSuppliers';
}
/**
@ -138,13 +140,13 @@ class box_fournisseurs extends ModeleBoxes
$line++;
}
if ($num == 0) {
$langs->load("suppliers");
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedSuppliers").'</span>'
);
}
// if ($num == 0) {
// $langs->load("suppliers");
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedSuppliers").'</span>'
// );
// }
$this->db->free($result);
} else {

View File

@ -59,6 +59,9 @@ class box_members_last_subscriptions extends ModeleBoxes
}
$this->hidden = !(isModEnabled('member') && $user->hasRight('adherent', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/adherents/card.php?leftmenu=members&action=create';
$this->msgNoRecords = 'NoRecordedMembers';
}
/**
@ -156,12 +159,6 @@ class box_members_last_subscriptions extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedMembers").'</span>',
);
}
$this->db->free($result);
} else {

View File

@ -51,6 +51,9 @@ class box_mos extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('bom', 'read');
$this->urltoaddentry = DOL_URL_ROOT.'/mrp/mo_card.php?action=create';
$this->msgNoRecords = 'NoRecordedOrders';
}
/**
@ -146,12 +149,6 @@ class box_mos extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedOrders").'</span>'
);
}
$this->db->free($result);
} else {

View File

@ -55,6 +55,8 @@ class box_produits extends ModeleBoxes
$tmpentry = array('enabled' => (isModEnabled("product") || isModEnabled("service")), 'perms' => ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')), 'module' => 'product|service');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
$this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create';
$this->msgNoRecords = 'NoRecordedProducts';
}
/**
@ -210,12 +212,12 @@ class box_produits extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoRecordedProducts"),
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => $langs->trans("NoRecordedProducts"),
// );
// }
$this->db->free($result);
} else {

View File

@ -57,6 +57,8 @@ class box_produits_alerte_stock extends ModeleBoxes
$tmpentry = array('enabled' => ((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms' => $user->hasRight('stock', 'lire'), 'module' => 'product|service|stock');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
$this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create';
$this->msgNoRecords = 'NoTooLowStockProducts';
}
/**
@ -202,12 +204,12 @@ class box_produits_alerte_stock extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoTooLowStockProducts"),
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => $langs->trans("NoTooLowStockProducts"),
// );
// }
$this->db->free($result);
} else {

View File

@ -54,6 +54,8 @@ class box_project extends ModeleBoxes
$this->boxlabel = "OpenedProjects";
$this->hidden = !$user->hasRight('projet', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/projet/card.php?action=create';
$this->msgNoRecords = 'NoOpenedProjects';
}
/**
@ -175,33 +177,34 @@ class box_project extends ModeleBoxes
}
}
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array(
'tr' => 'class="liste_total_wrap"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
if ($num > 0) {
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array(
'tr' => 'class="liste_total_wrap"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
}
}

View File

@ -55,6 +55,8 @@ class box_project_opportunities extends ModeleBoxes
$this->enabled = getDolGlobalInt('PROJECT_USE_OPPORTUNITIES');
$this->hidden = !$user->hasRight('projet', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/projet/card.php?action=create';
$this->msgNoRecords = 'NoOpenedProjectsOpportunities';
}
/**
@ -160,33 +162,34 @@ class box_project_opportunities extends ModeleBoxes
}
}
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array(
'tr' => 'class="liste_total_wrap"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
if ($num > 0) {
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][] = array(
'tr' => 'class="liste_total_wrap"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
);
$this->info_box_contents[$i][] = array(
'td' => 'class="right liste_total" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][] = array(
'td' => 'class="liste_total"',
'text' => "&nbsp;",
);
}
}

View File

@ -52,6 +52,9 @@ class box_propales extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('propal', 'read'));
$this->urltoaddentry = DOL_URL_ROOT.'/comm/propal/card.php?action=create';
$this->msgNoRecords = 'NoRecordedProposals';
}
/**
@ -171,12 +174,6 @@ class box_propales extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoRecordedProposals"),
);
}
$this->db->free($result);
} else {

View File

@ -60,6 +60,9 @@ class box_prospect extends ModeleBoxes
}
$this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid));
$this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=p';
$this->msgNoRecords = 'NoRecordedProspects';
}
/**
@ -153,13 +156,6 @@ class box_prospect extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedProspects").'</span>'
);
}
$this->db->free($resql);
} else {
$this->info_box_contents[0][0] = array(

View File

@ -51,6 +51,9 @@ class box_scheduled_jobs extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('cron', 'read'));
$this->urltoaddentry = DOL_URL_ROOT.'/cron/card.php?action=create';
$this->msgNoRecords = 'NoScheduledJobs';
}
/**
@ -159,26 +162,27 @@ class box_scheduled_jobs extends ModeleBoxes
);
$line++;
}
// Line nb job in error
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax300" colspan="3"',
'text' => $langs->trans("NumberScheduledJobError")
);
$textnoformat = '';
if ($nbjobsnotfinished) {
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly'.($nbjobsinerror ? ' marginrightonly' : '').' minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php" title="'.$langs->trans("NumberScheduledJobNeverFinished").'"><div class="center badge badge-warning nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsnotfinished.'</div></a>';
if ($num > 0) {
// Line nb job in error
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax300" colspan="3"',
'text' => $langs->trans("NumberScheduledJobError")
);
$textnoformat = '';
if ($nbjobsnotfinished) {
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly'.($nbjobsinerror ? ' marginrightonly' : '').' minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php" title="'.$langs->trans("NumberScheduledJobNeverFinished").'"><div class="center badge badge-warning nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsnotfinished.'</div></a>';
}
if ($nbjobsinerror) {
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'" title="'.$langs->trans("NumberScheduledJobError").'"><div class="badge badge-danger nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>';
}
if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) {
$textnoformat .= '<a class="inline-block paddingleft marginleftonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge badge-status4 nounderline">0</div></a>';
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'textnoformat' => $textnoformat
);
}
if ($nbjobsinerror) {
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'" title="'.$langs->trans("NumberScheduledJobError").'"><div class="badge badge-danger nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>';
}
if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) {
$textnoformat .= '<a class="inline-block paddingleft marginleftonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge badge-status4 nounderline">0</div></a>';
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'textnoformat' => $textnoformat
);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',

View File

@ -51,6 +51,9 @@ class box_services_contracts extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('service', 'lire') && $user->hasRight('contrat', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create';
$this->msgNoRecords = 'NoContractedProducts';
}
/**
@ -200,12 +203,6 @@ class box_services_contracts extends ModeleBoxes
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoContractedProducts").'</span>'
);
}
$this->db->free($result);
} else {

View File

@ -48,6 +48,9 @@ class box_services_expired extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('contrat', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create';
$this->msgNoRecords = 'NoExpiredServices';
}
/**
@ -155,13 +158,6 @@ class box_services_expired extends ModeleBoxes
$i++;
}
if ($num == 0) {
$langs->load("contracts");
$this->info_box_contents[$i][] = array(
'td' => 'class="nohover center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoExpiredServices").'</span>'
);
}
$this->db->free($resql);
} else {

View File

@ -51,6 +51,9 @@ class box_shipments extends ModeleBoxes
$this->db = $db;
$this->hidden = !$user->hasRight('expedition', 'lire');
$this->urltoaddentry = DOL_URL_ROOT.'/expedition/card.php?action=create2';
$this->msgNoRecords = 'NoRecordedShipments';
}
/**
@ -163,12 +166,12 @@ class box_shipments extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedShipments").'</span>'
);
}
// if ($num == 0) {
// $this->info_box_contents[$line][0] = array(
// 'td' => 'class="center"',
// 'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedShipments").'</span>'
// );
// }
$this->db->free($result);
} else {

View File

@ -49,6 +49,9 @@ class box_supplier_orders extends ModeleBoxes
$this->db = $db;
$this->hidden = !($user->hasRight('fournisseur', 'commande', 'lire'));
$this->urltoaddentry = DOL_URL_ROOT.'/fourn/commande/card.php?action=create';
$this->msgNoRecords = 'NoSupplierOrder';
}
/**
@ -160,13 +163,6 @@ class box_supplier_orders extends ModeleBoxes
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
'text' => '<span class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</span>',
);
}
$this->db->free($result);
} else {
$this->info_box_contents[0][] = array(

View File

@ -158,6 +158,14 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
* @var string[] Example array("accounting")
*/
public $depends;
/**
* @var string urltoaddentry
*/
public $urltoaddentry;
/**
* @var string msg when no records exist
*/
public $msgNoRecords = 'NoRecordFound';
@ -429,6 +437,17 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
$out .= "</tr>\n";
}
}
} else {
if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {
$out .= '<tr><td colspan="2" class="center"><span class="opacitymedium">'.$langs->trans($this->msgNoRecords).' </span>';
// Check if $urltoaddentry is defined for the widget
if (!empty($this->urltoaddentry)) {
$out .= '<a href="'.$this->urltoaddentry.'">'.img_picto($langs->trans("New"), 'add', 'pictofixedwidth').'</a>';
}
$out .= '</td></tr>';
}
}
if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {

View File

@ -119,6 +119,9 @@ NoRecordedShipments=No recorded customer shipment
BoxCustomersOutstandingBillReached=Customers with outstanding limit reached
BoxTitleLastFediverseInfos=Last %s posts from %s
BoxLastFediverseInfos=Latest Fediverse Updates: News and Trends
NoOpenedProjectsOpportunities=No open opportunities
NoOpenedProjects=No open projects
NoScheduledJobs=No Scheduled jobs
# Pages
UsersHome=Home users and groups
MembersHome=Home Membership

View File

@ -118,6 +118,8 @@ NoRecordedShipments=Aucune expédition client
BoxCustomersOutstandingBillReached=Clients dont l'en-cours de facturation est dépassé
BoxTitleLastFediverseInfos=Les %s derniers messages de %s
BoxLastFediverseInfos=Dernières mises à jour de Fediverse : Actualités et Tendances
NoOpenedProjectsOpportunities=Aucune opportunités ouvertes
NoOpenedProjects=Aucun projet ouvert
# Pages
UsersHome=Accueil des utilisateurs et groupes
MembersHome=Accueil des adhérents