|
@@ -58,6 +58,7 @@ $action = GETPOST('action','alpha');
|
|
|
$backtopage = GETPOST('backtopage');
|
|
|
$myparam = GETPOST('myparam','alpha');
|
|
|
|
|
|
+$search_all=trim(GETPOST("sall"));
|
|
|
$search_field1=GETPOST("search_field1");
|
|
|
$search_field2=GETPOST("search_field2");
|
|
|
$search_myfield=GETPOST('search_myfield');
|
|
@@ -141,22 +142,23 @@ $parameters=array();
|
|
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
|
|
|
-include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
-
|
|
|
-// Purge search criteria
|
|
|
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
|
|
+if (empty($reshook))
|
|
|
{
|
|
|
- $search_field1='';
|
|
|
- $search_field2='';
|
|
|
- $search_date_creation='';
|
|
|
- $search_date_update='';
|
|
|
- $toselect='';
|
|
|
- $search_array_options=array();
|
|
|
-}
|
|
|
+ // Selection of new fields
|
|
|
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
|
|
|
+ // Purge search criteria
|
|
|
+ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
|
|
+ {
|
|
|
+ $search_field1='';
|
|
|
+ $search_field2='';
|
|
|
+ $search_date_creation='';
|
|
|
+ $search_date_update='';
|
|
|
+ $toselect='';
|
|
|
+ $search_array_options=array();
|
|
|
+ }
|
|
|
|
|
|
-if (empty($reshook))
|
|
|
-{
|
|
|
+ // Mass actions
|
|
|
$objectclass='Skeleton';
|
|
|
$objectlabel='Skeleton';
|
|
|
$permtoread = $user->rights->skeleton->read;
|
|
@@ -180,7 +182,6 @@ $form=new Form($db);
|
|
|
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
|
|
$help_url='';
|
|
|
$title = $langs->trans('MyModuleListTitle');
|
|
|
-llxHeader('', $title, $help_url);
|
|
|
|
|
|
// Put here content of your page
|
|
|
|
|
@@ -247,305 +248,308 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
|
|
|
$sql.= $db->plimit($limit+1, $offset);
|
|
|
|
|
|
-
|
|
|
dol_syslog($script_file, LOG_DEBUG);
|
|
|
$resql=$db->query($sql);
|
|
|
-if ($resql)
|
|
|
+if (! $resql)
|
|
|
{
|
|
|
- $num = $db->num_rows($resql);
|
|
|
-
|
|
|
- $arrayofselected=is_array($toselect)?$toselect:array();
|
|
|
-
|
|
|
- $params='';
|
|
|
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
|
|
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
|
|
- if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1);
|
|
|
- if ($search_field2 != '') $params.= '&search_field2='.urlencode($search_field2);
|
|
|
- if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
|
|
- // Add $param from extra fields
|
|
|
- foreach ($search_array_options as $key => $val)
|
|
|
- {
|
|
|
- $crit=$val;
|
|
|
- $tmpkey=preg_replace('/search_options_/','',$key);
|
|
|
- if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
|
- }
|
|
|
-
|
|
|
- $arrayofmassactions = array(
|
|
|
- 'presend'=>$langs->trans("SendByMail"),
|
|
|
- 'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
- );
|
|
|
- if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
|
|
- if ($massaction == 'presend') $arrayofmassactions=array();
|
|
|
- $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
|
|
-
|
|
|
- print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
- if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
- print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
- print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
- print '<input type="hidden" name="action" value="list">';
|
|
|
- print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
- print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
-
|
|
|
- print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
|
|
-
|
|
|
- if ($sall)
|
|
|
+ dol_print_error($db);
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
+$num = $db->num_rows($resql);
|
|
|
+
|
|
|
+// Direct jump if only one record found
|
|
|
+if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
|
|
+{
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
+ $id = $obj->rowid;
|
|
|
+ header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id);
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
+llxHeader('', $title, $help_url);
|
|
|
+
|
|
|
+$arrayofselected=is_array($toselect)?$toselect:array();
|
|
|
+
|
|
|
+$param='';
|
|
|
+if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
|
|
+if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1);
|
|
|
+if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2);
|
|
|
+if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
|
|
+// Add $param from extra fields
|
|
|
+foreach ($search_array_options as $key => $val)
|
|
|
+{
|
|
|
+ $crit=$val;
|
|
|
+ $tmpkey=preg_replace('/search_options_/','',$key);
|
|
|
+ if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
|
+}
|
|
|
+
|
|
|
+$arrayofmassactions = array(
|
|
|
+ 'presend'=>$langs->trans("SendByMail"),
|
|
|
+ 'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
+);
|
|
|
+if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
|
|
+if ($massaction == 'presend') $arrayofmassactions=array();
|
|
|
+$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
|
|
+
|
|
|
+print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
+if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
+print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
+print '<input type="hidden" name="action" value="list">';
|
|
|
+print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
+print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
+
|
|
|
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
|
|
+
|
|
|
+if ($sall)
|
|
|
+{
|
|
|
+ foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
|
|
+ print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
|
|
+}
|
|
|
+
|
|
|
+$moreforfilter = '';
|
|
|
+$moreforfilter.='<div class="divsearchfield">';
|
|
|
+$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
|
|
+$moreforfilter.= '</div>';
|
|
|
+
|
|
|
+$parameters=array();
|
|
|
+$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
+if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|
|
+else $moreforfilter = $hookmanager->resPrint;
|
|
|
+
|
|
|
+if (! empty($moreforfilter))
|
|
|
+{
|
|
|
+ print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
|
+ print $moreforfilter;
|
|
|
+ print '</div>';
|
|
|
+}
|
|
|
+
|
|
|
+$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
|
|
+$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
+
|
|
|
+print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
|
+
|
|
|
+// Fields title
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+// LIST_OF_TD_TITLE_FIELDS
|
|
|
+//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
|
|
+//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
|
|
+// Extra fields
|
|
|
+if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
+{
|
|
|
+ foreach($extrafields->attribute_label as $key => $val)
|
|
|
+ {
|
|
|
+ if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
+ {
|
|
|
+ $align=$extrafields->getAlignFlag($key);
|
|
|
+ print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+// Hook fields
|
|
|
+$parameters=array('arrayfields'=>$arrayfields);
|
|
|
+$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
+print $hookmanager->resPrint;
|
|
|
+if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
+if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
+//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
|
|
|
+print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
|
|
+print '</tr>'."\n";
|
|
|
+
|
|
|
+// Fields title search
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+// LIST_OF_TD_TITLE_SEARCH
|
|
|
+//if (! empty($arrayfields['t.field1']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
|
|
|
+//if (! empty($arrayfields['t.field2']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
|
|
|
+// Extra fields
|
|
|
+if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
+{
|
|
|
+ foreach($extrafields->attribute_label as $key => $val)
|
|
|
{
|
|
|
- foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
|
|
- print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
|
|
+ if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
+ {
|
|
|
+ $align=$extrafields->getAlignFlag($key);
|
|
|
+ $typeofextrafield=$extrafields->attribute_type[$key];
|
|
|
+ print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
|
|
+ if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
|
|
+ {
|
|
|
+ $crit=$val;
|
|
|
+ $tmpkey=preg_replace('/search_options_/','',$key);
|
|
|
+ $searchclass='';
|
|
|
+ if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
|
|
+ if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
|
|
+ print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
}
|
|
|
+}
|
|
|
+// Fields from hook
|
|
|
+$parameters=array('arrayfields'=>$arrayfields);
|
|
|
+$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
+print $hookmanager->resPrint;
|
|
|
+if (! empty($arrayfields['t.datec']['checked']))
|
|
|
+{
|
|
|
+ // Date creation
|
|
|
+ print '<td class="liste_titre">';
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
+if (! empty($arrayfields['t.tms']['checked']))
|
|
|
+{
|
|
|
+ // Date modification
|
|
|
+ print '<td class="liste_titre">';
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
+/*if (! empty($arrayfields['u.statut']['checked']))
|
|
|
+{
|
|
|
+ // Status
|
|
|
+ print '<td class="liste_titre" align="center">';
|
|
|
+ print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
|
|
+ print '</td>';
|
|
|
+}*/
|
|
|
+// Action column
|
|
|
+print '<td class="liste_titre" align="right">';
|
|
|
+$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
|
|
+print $searchpitco;
|
|
|
+print '</td>';
|
|
|
+print '</tr>'."\n";
|
|
|
|
|
|
- $moreforfilter = '';
|
|
|
- $moreforfilter.='<div class="divsearchfield">';
|
|
|
- $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escpae_htmltag($search_myfield).'">';
|
|
|
- $moreforfilter.= '</div>';
|
|
|
-
|
|
|
- $parameters=array();
|
|
|
- $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
- if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|
|
- else $moreforfilter = $hookmanager->resPrint;
|
|
|
-
|
|
|
- if (! empty($moreforfilter))
|
|
|
- {
|
|
|
- print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
|
- print $moreforfilter;
|
|
|
- print '</div>';
|
|
|
- }
|
|
|
|
|
|
- $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
|
|
- $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
-
|
|
|
- print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
|
-
|
|
|
- // Fields title
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- // LIST_OF_TD_TITLE_FIELDS
|
|
|
- //if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$params,'',$sortfield,$sortorder);
|
|
|
- //if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$params,'',$sortfield,$sortorder);
|
|
|
- // Extra fields
|
|
|
- if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
- {
|
|
|
- foreach($extrafields->attribute_label as $key => $val)
|
|
|
- {
|
|
|
- if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
- {
|
|
|
- $align=$extrafields->getAlignFlag($key);
|
|
|
- print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // Hook fields
|
|
|
- $parameters=array('arrayfields'=>$arrayfields);
|
|
|
- $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
- if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
- if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
|
|
- //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
|
|
|
- print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
|
|
- print '</tr>'."\n";
|
|
|
-
|
|
|
- // Fields title search
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- // LIST_OF_TD_TITLE_SEARCH
|
|
|
- //if (! empty($arrayfields['t.field1']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
|
|
|
- //if (! empty($arrayfields['t.field2']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
|
|
|
- // Extra fields
|
|
|
- if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
- {
|
|
|
- foreach($extrafields->attribute_label as $key => $val)
|
|
|
+$i=0;
|
|
|
+$var=true;
|
|
|
+$totalarray=array();
|
|
|
+while ($i < min($num, $limit))
|
|
|
+{
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
+ if ($obj)
|
|
|
+ {
|
|
|
+ $var = !$var;
|
|
|
+
|
|
|
+ // Show here line of result
|
|
|
+ print '<tr '.$bc[$var].'>';
|
|
|
+ // LIST_OF_TD_FIELDS_LIST
|
|
|
+ /*
|
|
|
+ if (! empty($arrayfields['t.field1']['checked']))
|
|
|
+ {
|
|
|
+ print '<td>'.$obj->field1.'</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
+ if (! empty($arrayfields['t.field2']['checked']))
|
|
|
{
|
|
|
- if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
- {
|
|
|
- $align=$extrafields->getAlignFlag($key);
|
|
|
- $typeofextrafield=$extrafields->attribute_type[$key];
|
|
|
- print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
|
|
- if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
|
|
+ print '<td>'.$obj->field2.'</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
+ }*/
|
|
|
+ // Extra fields
|
|
|
+ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
+ {
|
|
|
+ foreach($extrafields->attribute_label as $key => $val)
|
|
|
+ {
|
|
|
+ if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
{
|
|
|
- $crit=$val;
|
|
|
- $tmpkey=preg_replace('/search_options_/','',$key);
|
|
|
- $searchclass='';
|
|
|
- if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
|
|
- if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
|
|
- print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
|
|
+ print '<td';
|
|
|
+ $align=$extrafields->getAlignFlag($key);
|
|
|
+ if ($align) print ' align="'.$align.'"';
|
|
|
+ print '>';
|
|
|
+ $tmpkey='options_'.$key;
|
|
|
+ print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
|
|
+ print '</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
}
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // Fields from hook
|
|
|
+ $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
|
|
+ $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
+ print $hookmanager->resPrint;
|
|
|
+ // Date creation
|
|
|
+ if (! empty($arrayfields['t.datec']['checked']))
|
|
|
+ {
|
|
|
+ print '<td align="center">';
|
|
|
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
|
|
+ print '</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
}
|
|
|
- }
|
|
|
- // Fields from hook
|
|
|
- $parameters=array('arrayfields'=>$arrayfields);
|
|
|
- $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
- if (! empty($arrayfields['t.datec']['checked']))
|
|
|
- {
|
|
|
- // Date creation
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- if (! empty($arrayfields['t.tms']['checked']))
|
|
|
- {
|
|
|
// Date modification
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- /*if (! empty($arrayfields['u.statut']['checked']))
|
|
|
- {
|
|
|
+ if (! empty($arrayfields['t.tms']['checked']))
|
|
|
+ {
|
|
|
+ print '<td align="center">';
|
|
|
+ print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
|
|
+ print '</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
// Status
|
|
|
- print '<td class="liste_titre" align="center">';
|
|
|
- print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
|
|
- print '</td>';
|
|
|
- }*/
|
|
|
- // Action column
|
|
|
- print '<td class="liste_titre" align="right">';
|
|
|
- $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
|
|
- print $searchpitco;
|
|
|
- print '</td>';
|
|
|
- print '</tr>'."\n";
|
|
|
-
|
|
|
-
|
|
|
- $i=0;
|
|
|
- $var=true;
|
|
|
- $totalarray=array();
|
|
|
- while ($i < min($num, $limit))
|
|
|
- {
|
|
|
- $obj = $db->fetch_object($resql);
|
|
|
- if ($obj)
|
|
|
+ /*
|
|
|
+ if (! empty($arrayfields['u.statut']['checked']))
|
|
|
+ {
|
|
|
+ $userstatic->statut=$obj->statut;
|
|
|
+ print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // Action column
|
|
|
+ print '<td class="nowrap" align="center">';
|
|
|
+ if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
{
|
|
|
- $var = !$var;
|
|
|
-
|
|
|
- // Show here line of result
|
|
|
- print '<tr '.$bc[$var].'>';
|
|
|
- // LIST_OF_TD_FIELDS_LIST
|
|
|
- /*
|
|
|
- if (! empty($arrayfields['t.field1']['checked']))
|
|
|
- {
|
|
|
- print '<td>'.$obj->field1.'</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
- }
|
|
|
- if (! empty($arrayfields['t.field2']['checked']))
|
|
|
- {
|
|
|
- print '<td>'.$obj->field2.'</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
- }*/
|
|
|
- // Extra fields
|
|
|
- if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
|
- {
|
|
|
- foreach($extrafields->attribute_label as $key => $val)
|
|
|
- {
|
|
|
- if (! empty($arrayfields["ef.".$key]['checked']))
|
|
|
- {
|
|
|
- print '<td';
|
|
|
- $align=$extrafields->getAlignFlag($key);
|
|
|
- if ($align) print ' align="'.$align.'"';
|
|
|
- print '>';
|
|
|
- $tmpkey='options_'.$key;
|
|
|
- print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
|
|
- print '</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // Fields from hook
|
|
|
- $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
|
|
- $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
- // Date creation
|
|
|
- if (! empty($arrayfields['t.datec']['checked']))
|
|
|
- {
|
|
|
- print '<td align="center">';
|
|
|
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
|
|
- print '</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
- }
|
|
|
- // Date modification
|
|
|
- if (! empty($arrayfields['t.tms']['checked']))
|
|
|
- {
|
|
|
- print '<td align="center">';
|
|
|
- print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
|
|
- print '</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
- }
|
|
|
- // Status
|
|
|
- /*
|
|
|
- if (! empty($arrayfields['u.statut']['checked']))
|
|
|
- {
|
|
|
- $userstatic->statut=$obj->statut;
|
|
|
- print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
|
|
- }*/
|
|
|
-
|
|
|
- // Action column
|
|
|
- print '<td class="nowrap" align="center">';
|
|
|
- if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
- {
|
|
|
- $selected=0;
|
|
|
- if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
|
|
- print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
- if (! $i) $totalarray['nbfield']++;
|
|
|
-
|
|
|
- print '</tr>';
|
|
|
+ $selected=0;
|
|
|
+ if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
|
|
+ print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ if (! $i) $totalarray['nbfield']++;
|
|
|
+
|
|
|
+ print '</tr>';
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+}
|
|
|
+
|
|
|
+// Show total line
|
|
|
+if (isset($totalarray['totalhtfield']))
|
|
|
+{
|
|
|
+ print '<tr class="liste_total">';
|
|
|
+ $i=0;
|
|
|
+ while ($i < $totalarray['nbfield'])
|
|
|
+ {
|
|
|
$i++;
|
|
|
+ if ($i == 1)
|
|
|
+ {
|
|
|
+ if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
|
|
+ else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
|
+ }
|
|
|
+ elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
|
|
+ elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
|
|
+ elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
|
|
+ else print '<td></td>';
|
|
|
}
|
|
|
-
|
|
|
- // Show total line
|
|
|
- if (isset($totalarray['totalhtfield']))
|
|
|
- {
|
|
|
- print '<tr class="liste_total">';
|
|
|
- $i=0;
|
|
|
- while ($i < $totalarray['nbfield'])
|
|
|
- {
|
|
|
- $i++;
|
|
|
- if ($i == 1)
|
|
|
- {
|
|
|
- if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
|
|
- else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
|
- }
|
|
|
- elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
|
|
- elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
|
|
- elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
|
|
- else print '<td></td>';
|
|
|
- }
|
|
|
- print '</tr>';
|
|
|
- }
|
|
|
-
|
|
|
- $db->free($resql);
|
|
|
+ print '</tr>';
|
|
|
+}
|
|
|
|
|
|
- $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
|
|
- $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
+$db->free($resql);
|
|
|
|
|
|
- print '</table>'."\n";
|
|
|
+$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
|
|
+$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
|
|
+print $hookmanager->resPrint;
|
|
|
|
|
|
- print '</form>'."\n";
|
|
|
-
|
|
|
-
|
|
|
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
|
|
- {
|
|
|
- // Show list of available documents
|
|
|
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
|
|
- $urlsource.=str_replace('&','&',$param);
|
|
|
-
|
|
|
- $filedir=$diroutputmassaction;
|
|
|
- $genallowed=$user->rights->facture->lire;
|
|
|
- $delallowed=$user->rights->facture->lire;
|
|
|
-
|
|
|
- print '<br><a name="show_files"></a>';
|
|
|
- $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
|
|
|
- $title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
|
|
|
-
|
|
|
- print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
|
|
- }
|
|
|
-
|
|
|
+print '</table>'."\n";
|
|
|
+
|
|
|
+print '</form>'."\n";
|
|
|
+
|
|
|
+
|
|
|
+if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
|
|
+{
|
|
|
+ // Show list of available documents
|
|
|
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
|
|
+ $urlsource.=str_replace('&','&',$param);
|
|
|
+
|
|
|
+ $filedir=$diroutputmassaction;
|
|
|
+ $genallowed=$user->rights->facture->lire;
|
|
|
+ $delallowed=$user->rights->facture->lire;
|
|
|
+
|
|
|
+ print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $error++;
|
|
|
- dol_print_error($db);
|
|
|
+ print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
|
|
}
|
|
|
|
|
|
|