Go to the documentation of this file.
36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/intracommreport/class/intracommreport.class.php';
41 $langs->loadLangs(array(
"intracommreport"));
48 $label = (string)
GETPOST(
'label',
'alphanohtml');
49 $type_declaration = (string)
GETPOST(
'type_declaration',
'alphanohtml');
50 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 "deb" => $langs->trans(
"DEB"),
53 "des" => $langs->trans(
"DES"),
55 $typeOfDeclaration = array(
56 "introduction" => $langs->trans(
"Introduction"),
57 "expedition" => $langs->trans(
"Expedition"),
67 $hookmanager->initHooks(array(
'intracommcard',
'globalcard'));
71 $permissiontoread = $user->rights->intracommreport->read;
72 $permissiontoadd = $user->rights->intracommreport->write;
73 $permissiontodelete = $user->rights->intracommreport->delete;
91 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
96 if ($permissiontodelete && $action ==
'confirm_delete' && $confirm ==
'yes') {
97 $result = $object->delete($id, $user);
99 if (!empty($backtopage)) {
100 header(
"Location: ".$backtopage);
103 header(
"Location: list.php");
107 $errmesg = $object->error;
111 if ($action ==
'add' && $permissiontoadd) {
112 $object->label = trim($label);
113 $object->type = trim($exporttype);
114 $object->type_declaration = $type_declaration;
115 $object->subscription = (int) $subscription;
123 if (empty($object->label)) {
125 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
127 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"intracommreport WHERE ref='".$db->escape($object->label).
"'";
128 $result = $db->query($sql);
130 $num = $db->num_rows($result);
134 $langs->load(
"errors");
135 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
140 $id = $object->create($user);
142 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
159 if ($action ==
'create') {
160 $title = $langs->trans(
"IntracommReportTitle");
164 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
165 print
'<input type="hidden" name="token" value="'.newToken().
'">';
166 print
'<input type="hidden" name="action" value="add" />';
170 print
'<table class="border" width="100%">';
173 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
176 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Declaration").
"</td><td>\n";
177 print
$form->selectarray(
"declaration", $declaration,
GETPOST(
'declaration',
'alpha') ?
GETPOST(
'declaration',
'alpha') : $object->declaration, 0);
182 print
'<td class="titlefieldcreate fieldrequired">';
183 print $langs->trans(
"AnalysisPeriod");
186 print $formother->select_month($month ? date(
'M') : $month,
'month', 0, 1,
'widthauto valignmiddle ',
true);
187 print $formother->selectyear($year ? date(
'Y') : $year,
'year', 0, 3, 3, 0, 0,
'',
'',
true);
192 print
'<tr><td class="fieldrequired">'.$langs->trans(
"TypeOfDeclaration").
"</td><td>\n";
193 print
$form->selectarray(
"type_declaration", $typeOfDeclaration,
GETPOST(
'type_declaration',
'alpha') ?
GETPOST(
'type_declaration',
'alpha') : $object->type_declaration, 0);
200 print
$form->buttonsSaveCancel();
205 if ($id > 0 && $action !=
'edit') {
211 $res = $object->fetch($id);
222 print
dol_get_fiche_head(
"",
'general', $langs->trans(
"IntracommReport"), -1,
'user');
225 if ($action ==
'delete') {
226 $formquestion = array();
228 $formquestion[] = array(
230 'name' =>
'backtopage',
231 'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"])
234 print
$form->formconfirm(
235 "card.php?rowid=".urlencode($id),
236 $langs->trans(
"DeleteReport"),
237 $langs->trans(
"ConfirmDeleteReport"),
245 $linkback =
'<a href="'.DOL_URL_ROOT.
'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
249 print
'<div class="fichecenter">';
250 print
'<div class="fichehalfleft">';
252 print
'<div class="underbanner clearboth"></div>';
253 print
'<table class="border tableforfield centpercent">';
256 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$object->declaration.
"</td></tr>\n";
259 print
'<tr><td>'.$langs->trans(
"AnalysisPeriod").
'</td><td class="valeur">'.$object->period.
'</td>';
263 print
'<tr><td>'.$langs->trans(
"TypeOfDeclaration").
'</td><td class="valeur">'.$object->type_declaration.
'</td>';
268 print
"</div></div></div>\n";
269 print
'<div style="clear:both"></div>';
Class to manage intracomm report.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.