Go to the documentation of this file.
27 require
'../../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/modules/action/rapport.pdf.php';
35 $langs->loadLangs(array(
"agenda",
"commercial"));
37 $action =
GETPOST(
'action',
'aZ09');
38 $month =
GETPOST(
'month',
'int');
41 $optioncss =
GETPOST(
'optioncss',
'alpha');
42 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
43 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
44 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
46 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
50 $offset = $limit * $page;
55 $sortfield =
"a.datep";
59 $socid =
GETPOST(
'socid',
'int');
61 $socid = $user->socid;
64 if ($user->socid && $socid) {
73 if ($action ==
'builddoc') {
75 $result = $cat->write_file(
GETPOST(
'id',
'int'));
90 $sql =
"SELECT count(*) as cc,";
91 $sql .=
" date_format(a.datep, '%m/%Y') as df,";
92 $sql .=
" date_format(a.datep, '%m') as month,";
93 $sql .=
" date_format(a.datep, '%Y') as year";
94 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a,";
95 $sql .=
" ".MAIN_DB_PREFIX.
"user as u";
96 $sql .=
" WHERE a.fk_user_author = u.rowid";
97 $sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
99 $sql .=
" GROUP BY year, month, df";
100 $sql .=
" ORDER BY year DESC, month DESC, df DESC";
102 $nbtotalofrecords =
'';
103 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
104 $result = $db->query($sql);
105 $nbtotalofrecords = $db->num_rows($result);
106 if (($page * $limit) > $nbtotalofrecords) {
112 $sql .= $db->plimit($limit + 1, $offset);
116 $resql = $db->query($sql);
118 $num = $db->num_rows(
$resql);
121 if ($limit > 0 && $limit != $conf->liste_limit) {
122 $param .=
'&limit='.$limit;
125 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
126 if ($optioncss !=
'') {
127 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
129 print
'<input type="hidden" name="token" value="'.newToken().
'">';
130 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
131 print
'<input type="hidden" name="action" value="list">';
132 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
133 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
135 print_barre_liste($langs->trans(
"EventReports"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_agenda', 0,
'',
'', $limit, 0, 0, 1);
140 print
'<div class="div-table-responsive">';
141 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
143 print
'<tr class="liste_titre">';
144 print
'<td>'.$langs->trans(
"Period").
'</td>';
145 print
'<td class="center">'.$langs->trans(
"EventsNb").
'</td>';
146 print
'<td class="center">'.$langs->trans(
"Action").
'</td>';
147 print
'<td>'.$langs->trans(
"PDF").
'</td>';
148 print
'<td class="center">'.$langs->trans(
"Date").
'</td>';
149 print
'<td class="center">'.$langs->trans(
"Size").
'</td>';
152 while ($i < min($num, $limit)) {
153 $obj = $db->fetch_object(
$resql);
156 print
'<tr class="oddeven">';
159 print
"<td>".$obj->df.
"</td>\n";
162 print
'<td class="center">'.$obj->cc.
'</td>';
165 print
'<td class="center">';
166 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=builddoc&token='.
newToken().
'&page='.((int) $page).
'&month='.((int) $obj->month).
'&year='.((int) $obj->year).
'">'.
img_picto($langs->trans(
'BuildDoc'),
'filenew').
'</a>';
169 $name =
"actions-".$obj->month.
"-".$obj->year.
".pdf";
170 $relativepath = $name;
171 $file = $conf->agenda->dir_temp.
"/".$name;
172 $modulepart =
'actionsreport';
173 $documenturl = DOL_URL_ROOT.
'/document.php';
174 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
175 $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
178 if (file_exists($file)) {
179 print
'<td class="tdoverflowmax300">';
182 $filearray = array(
'name'=>basename($file),
'fullname'=>$file,
'type'=>
'file');
186 $out .=
'<a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
188 $out .=
' target="_blank" rel="noopener noreferrer">';
189 $out .=
img_mime($filearray[
"name"], $langs->trans(
"File").
': '.$filearray[
"name"]);
190 $out .= $filearray[
"name"];
192 $out .= $formfile->showPreview($filearray, $modulepart, $relativepath, 0, $param);
196 print
'<td class="center">'.dol_print_date(
dol_filemtime($file),
'dayhour').
'</td>';
197 print
'<td class="center">'.dol_print_size(
dol_filesize($file)).
'</td>';
199 print
'<td> </td>';
200 print
'<td> </td>';
201 print
'<td> </td>';
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_filemtime($pathoffile)
Return time of a file.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
Class to generate event report.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_filesize($pathoffile)
Return size of a file.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.