我創建了列表視圖中的自定義引用列表視圖代碼如下。sugarcrm自定義模塊全選多頁全部
總共有25條記錄我選擇了20條記錄(選擇此頁),它對20條記錄執行的操作是正確的,如果我只對其中的20條記錄執行所有執行操作,那麼它不會選擇25條記錄。 ..
protected function buildMyMenuItem()
{
global $app_strings;
return <<<EOHTML
<a class="menuItem" style="width: 150px;" href="#" onmouseover='hiliteItem(this,"yes");'
onmouseout='unhiliteItem(this);'
onclick="sugarListView.get_checks();
if(sugarListView.get_checks_count() < 1) {
alert('{$app_strings['LBL_LISTVIEW_NO_SELECTED']}');
return false;
}
document.MassUpdate.action.value='print';
document.MassUpdate.submit();">Print Label</a>
EOHTML;
}
林稱這是在下面的控制器類是代碼
class CustomLeadsController extends SugarController
{
public function action_print() {
if (!empty($_REQUEST['uid'])) {
$recordIds = explode(',',$_REQUEST['uid']);
print_r($recordIds);
?>
<form>
<div align="right">
<input name="button" type="button" onclick="window.print()" value="print" />
</div>
</form>
<table width="1024px" border="1" cellspacing="1" cellpadding="1" style="border-collapse:collapse;">
<?php
$i = 0;
foreach ($recordIds as $recordId)
{
$bean = SugarModule::get($_REQUEST['module'])->loadBean();
// print_r($bean);
$bean->retrieve($recordId);
if ($i % 4 == 0)
{
echo '<tr>';
}
?>
<td align="left" width="25%" height="100px" STYLE="font-family: 'comic sans ms', fantasy; padding:10px; font-size:12px;">
<?php echo $bean->get_summary_text(); ?>
<br>
<?php echo nl2br($bean->primary_address_street); ?>
<?php
if($bean->primary_address_city != "")
{
echo "<br>";
echo nl2br($bean->primary_address_city);
}
?>
<br>
<?php echo nl2br($bean->primary_address_state); ?>
<br>
<?php echo nl2br($bean->primary_address_postalcode); ?>
</td>
<?php
if ($i % 4 == 3)
{
echo '</tr>';
}
$i++;
}
//here is a check in case you don't have multiple of 3 rows
if ($i % 4 != 0)
{
echo '</tr>';
}
?>
</table>
<?php
}
sugar_die('');
}
}