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 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
42 $sortfield =
GETPOST(
"sortfield",
'alpha');
43 $sortorder =
GETPOST(
"sortorder",
'alpha');
45 if ($page == -1 || $page == null) { $page = 0; }
46 $offset = $limit * $page;
47 if (!$sortorder) $sortorder =
"DESC";
48 if (!$sortfield) $sortfield =
"a.datep";
51 $socid =
GETPOST(
'socid',
'int');
52 if ($user->socid) $socid = $user->socid;
53 $result =
restrictedArea($user,
'agenda', $socid,
'',
'myactions');
60 if ($action ==
'builddoc')
63 $result = $cat->write_file(
GETPOST(
'id',
'int'));
79 $sql =
"SELECT count(*) as cc,";
80 $sql .=
" date_format(a.datep, '%m/%Y') as df,";
81 $sql .=
" date_format(a.datep, '%m') as month,";
82 $sql .=
" date_format(a.datep, '%Y') as year";
83 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a,";
84 $sql .=
" ".MAIN_DB_PREFIX.
"user as u";
85 $sql .=
" WHERE a.fk_user_author = u.rowid";
86 $sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
88 $sql .=
" GROUP BY year, month, df";
89 $sql .=
" ORDER BY year DESC, month DESC, df DESC";
91 $nbtotalofrecords =
'';
92 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
94 $result = $db->query($sql);
95 $nbtotalofrecords = $db->num_rows($result);
96 if (($page * $limit) > $nbtotalofrecords)
103 $sql .= $db->plimit($limit + 1, $offset);
107 $resql = $db->query($sql);
110 $num = $db->num_rows(
$resql);
113 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.$limit;
115 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
116 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
117 print '<input type="hidden" name="token" value="'.newToken().
'">';
118 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
119 print '<input type="hidden" name="action" value="list">';
120 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
121 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
123 print_barre_liste($langs->trans(
"EventReports"), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_agenda', 0,
'',
'', $limit, 0, 0, 1);
128 print '<div class="div-table-responsive">';
129 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
131 print '<tr class="liste_titre">';
132 print
'<td>'.$langs->trans(
"Period").
'</td>';
133 print
'<td class="center">'.$langs->trans(
"EventsNb").
'</td>';
134 print
'<td class="center">'.$langs->trans(
"Action").
'</td>';
135 print
'<td>'.$langs->trans(
"PDF").
'</td>';
136 print
'<td class="center">'.$langs->trans(
"Date").
'</td>';
137 print
'<td class="center">'.$langs->trans(
"Size").
'</td>';
140 while ($i < min($num, $limit))
142 $obj = $db->fetch_object(
$resql);
146 print
'<tr class="oddeven">';
149 print
"<td>".$obj->df.
"</td>\n";
152 print
'<td class="center">'.$obj->cc.
'</td>';
155 print
'<td class="center">';
156 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=builddoc&page='.$page.
'&month='.$obj->month.
'&year='.$obj->year.
'">'.
img_picto($langs->trans(
'BuildDoc'),
'filenew').
'</a>';
159 $name =
"actions-".$obj->month.
"-".$obj->year.
".pdf";
160 $relativepath = $name;
161 $file = $conf->agenda->dir_temp.
"/".$name;
162 $modulepart =
'actionsreport';
163 $documenturl = DOL_URL_ROOT.
'/document.php';
164 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
166 if (file_exists($file))
168 print
'<td class="tdoverflowmax300">';
171 $filearray = array(
'name'=>basename($file),
'fullname'=>$file,
'type'=>
'file');
175 $out .=
'<a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
177 if (preg_match(
'/text/', $mime)) $out .=
' target="_blank"';
178 $out .=
' target="_blank">';
179 $out .=
img_mime($filearray[
"name"], $langs->trans(
"File").
': '.$filearray[
"name"]);
180 $out .= $filearray[
"name"];
182 $out .= $formfile->showPreview($filearray, $modulepart, $relativepath, 0, $param);
186 print
'<td class="center">'.dol_print_date(
dol_filemtime($file),
'dayhour').
'</td>';
187 print
'<td class="center">'.dol_print_size(
dol_filesize($file)).
'</td>';
189 print
'<td> </td>';
190 print
'<td> </td>';
191 print
'<td> </td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_filesize($pathoffile)
Return size of a file.
img_mime($file, $titlealt= '', $morecss= '')
Show MIME img of a file.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
dol_mimetype($file, $default= 'application/octet-stream', $mode=0)
Return mime type of a file.
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.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_filemtime($pathoffile)
Return time of a file.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to generate event report.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.