37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/intracommreport/class/intracommreport.class.php';
43$langs->loadLangs(array(
"intracommreport"));
48$exporttype = GETPOSTISSET(
'exporttype') ?
GETPOST(
'exporttype',
'alphanohtml') :
'deb';
51$label = (string)
GETPOST(
'label',
'alphanohtml');
52$type_declaration = (string)
GETPOST(
'type_declaration',
'alphanohtml');
53$backtopage =
GETPOST(
'backtopage',
'alpha');
56 "deb" => $langs->trans(
"DEB"),
57 "des" => $langs->trans(
"DES"),
59$typeOfDeclaration = array(
60 "introduction" => $langs->trans(
"Introduction"),
61 "expedition" => $langs->trans(
"Expedition"),
73$hookmanager->initHooks(array(
'intracommcard',
'globalcard'));
78$permissiontoread = $user->rights->intracommreport->read;
79$permissiontoadd = $user->rights->intracommreport->write;
80$permissiontodelete = $user->rights->intracommreport->delete;
96$parameters = array(
'id' => $id);
98$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
103if ($permissiontodelete && $action ==
'confirm_delete' && $confirm ==
'yes') {
104 $result = $object->delete($id, $user);
106 if (!empty($backtopage)) {
107 header(
"Location: ".$backtopage);
110 header(
"Location: list.php");
114 $errmesg = $object->error;
118if ($action ==
'add' && $permissiontoadd) {
119 $object->label = trim($label);
120 $object->type = trim($exporttype);
121 $object->type_declaration = $type_declaration;
130 if (empty($object->label)) {
132 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
134 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"intracommreport WHERE ref='".$db->escape($object->label).
"'";
135 $result = $db->query($sql);
137 $num = $db->num_rows($result);
141 $langs->load(
"errors");
142 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
147 $id = $object->create($user);
149 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
165$title = $langs->trans(
"IntracommReportTitle");
169if ($action ==
'create') {
172 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
173 print
'<input type="hidden" name="token" value="'.newToken().
'">';
174 print
'<input type="hidden" name="action" value="add" />';
178 print
'<table class="border" width="100%">';
181 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
184 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Declaration").
"</td><td>\n";
185 print $form->selectarray(
"declaration", $declaration,
GETPOST(
'declaration',
'alpha') ?
GETPOST(
'declaration',
'alpha') : $object->declaration, 0);
190 print
'<td class="titlefieldcreate fieldrequired">';
191 print $langs->trans(
"AnalysisPeriod");
194 print $formother->select_month($month ? date(
'M') : $month,
'month', 0, 1,
'widthauto valignmiddle ', true);
195 print $formother->selectyear($year ? date(
'Y') : $year,
'year', 0, 3, 3, 0, 0,
'',
'', true);
200 print
'<tr><td class="fieldrequired">'.$langs->trans(
"TypeOfDeclaration").
"</td><td>\n";
201 print $form->selectarray(
"type_declaration", $typeOfDeclaration,
GETPOST(
'type_declaration',
'alpha') ?
GETPOST(
'type_declaration',
'alpha') : $object->type_declaration, 0);
208 print $form->buttonsSaveCancel();
213if ($id > 0 && $action !=
'edit') {
219 $res = $object->fetch($id);
230 print
dol_get_fiche_head(
"",
'general', $langs->trans(
"IntracommReport"), -1,
'user');
233 if ($action ==
'delete') {
234 $formquestion = array();
236 $formquestion[] = array(
238 'name' =>
'backtopage',
239 'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"])
242 print $form->formconfirm(
243 "card.php?rowid=".urlencode($id),
244 $langs->trans(
"DeleteReport"),
245 $langs->trans(
"ConfirmDeleteReport"),
253 $linkback =
'<a href="'.DOL_URL_ROOT.
'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
257 print
'<div class="fichecenter">';
258 print
'<div class="fichehalfleft">';
260 print
'<div class="underbanner clearboth"></div>';
261 print
'<table class="border tableforfield centpercent">';
264 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$object->declaration.
"</td></tr>\n";
267 print
'<tr><td>'.$langs->trans(
"AnalysisPeriod").
'</td><td class="valeur">'.$object->period.
'</td>';
271 print
'<tr><td>'.$langs->trans(
"TypeOfDeclaration").
'</td><td class="valeur">'.$object->type_declaration.
'</td>';
276 print
"</div></div></div>\n";
277 print
'<div class="clearboth"></div>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage intracomm report.
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
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.