NEW Add a checkbox to select/unselect all lines on page that support
mass actions (like invoice list page)
This commit is contained in:
parent
786f16de02
commit
81aae30253
@ -783,8 +783,8 @@ if ($resql)
|
|||||||
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
|
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
|
||||||
print $form->selectarray('search_status', $liststatus, $search_status, 1);
|
print $form->selectarray('search_status', $liststatus, $search_status, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -848,16 +848,8 @@ if ($resql)
|
|||||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(1, empty($mode)?'checkformerge':'checkforsend');
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
if (empty($mode))
|
|
||||||
{
|
|
||||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkallsend">'.$langs->trans("All").'</a> / <a href="#" id="checknonesend">'.$langs->trans("None").'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -508,7 +508,6 @@ class Form
|
|||||||
|
|
||||||
$ret.='<!-- JS CODE TO ENABLE mass action select -->
|
$ret.='<!-- JS CODE TO ENABLE mass action select -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function () {
|
|
||||||
function initCheckForSelect()
|
function initCheckForSelect()
|
||||||
{
|
{
|
||||||
atleastoneselected=0;
|
atleastoneselected=0;
|
||||||
@ -526,6 +525,8 @@ class Form
|
|||||||
jQuery(".massaction").hide();
|
jQuery(".massaction").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jQuery(document).ready(function () {
|
||||||
initCheckForSelect();
|
initCheckForSelect();
|
||||||
jQuery(".checkforselect").click(function() {
|
jQuery(".checkforselect").click(function() {
|
||||||
initCheckForSelect();
|
initCheckForSelect();
|
||||||
@ -5679,20 +5680,38 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* Return HTML to show the search and clear seach button
|
* Return HTML to show the search and clear seach button
|
||||||
*
|
*
|
||||||
* @param int $addcheckuncheckall Add the check all uncheck al button
|
* @param int $addcheckuncheckall Add the check all uncheck al button
|
||||||
|
* @param string $cssclass CSS class
|
||||||
|
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showFilterAndCheckAddButtons($addcheckuncheckall=0)
|
function showFilterAndCheckAddButtons($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||||
|
$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||||
if ($addcheckuncheckall)
|
if ($addcheckuncheckall)
|
||||||
{
|
{
|
||||||
|
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
||||||
}
|
}
|
||||||
$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
$out.='<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#checkallactions").click(function() {
|
||||||
|
if($(this).is(\':checked\')){
|
||||||
|
console.log("We check all");
|
||||||
|
$(".'.$cssclass.'").prop(\'checked\', true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log("We uncheck all");
|
||||||
|
$(".'.$cssclass.'").prop(\'checked\', false);
|
||||||
|
}';
|
||||||
|
if ($calljsfunction) $out.='initCheckForSelect();';
|
||||||
|
$out.=' });
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -263,7 +263,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
|
|||||||
font-size: <?php print $fontsize ?>px;
|
font-size: <?php print $fontsize ?>px;
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
color: #111;
|
/* color: #111; */
|
||||||
border: 1px solid #C0C0C0;
|
border: 1px solid #C0C0C0;
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
}
|
}
|
||||||
@ -515,7 +515,11 @@ div.myavailability {
|
|||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
.checkallactions {
|
||||||
|
vertical-align: top;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Styles to hide objects */
|
/* Styles to hide objects */
|
||||||
|
|||||||
@ -503,6 +503,11 @@ div.myavailability {
|
|||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
.checkallactions {
|
||||||
|
vertical-align: top;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Styles to hide objects */
|
/* Styles to hide objects */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user