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"));
50$label = (string)
GETPOST(
'label',
'alphanohtml');
52$exporttype = GETPOSTISSET(
'exporttype') ?
GETPOST(
'exporttype',
'alphanohtml') :
'deb';
53$type_declaration = (string)
GETPOST(
'type_declaration',
'alphanohtml');
55$backtopage =
GETPOST(
'backtopage',
'alpha');
58 "deb" => $langs->trans(
"DEB"),
59 "des" => $langs->trans(
"DES"),
62$typeOfDeclaration = array(
63 "introduction" => $langs->trans(
"Introduction"),
64 "expedition" => $langs->trans(
"Expedition"),
76$hookmanager->initHooks(array(
'intracommcard',
'globalcard'));
81$permissiontoread = $user->rights->intracommreport->read;
82$permissiontoadd = $user->rights->intracommreport->write;
83$permissiontodelete = $user->rights->intracommreport->delete;
90if (empty($conf->intracommreport->enabled)) {
93if (!$permissiontoread) {
103$parameters = array(
'id' => $id);
105$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110if ($permissiontodelete && $action ==
'confirm_delete' && $confirm ==
'yes') {
111 $result = $object->delete($id, $user);
113 if (!empty($backtopage)) {
114 header(
"Location: ".$backtopage);
117 header(
"Location: list.php");
121 $errmesg = $object->error;
125if ($action ==
'add' && $permissiontoadd) {
126 $object->label = trim($label);
127 $object->exporttype = trim($exporttype);
128 $object->type_declaration = $type_declaration;
137 if (empty($object->label)) {
139 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
141 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"intracommreport WHERE ref='".$db->escape($object->label).
"'";
142 $result = $db->query($sql);
144 $num = $db->num_rows($result);
148 $langs->load(
"errors");
149 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
154 $id = $object->create($user);
156 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
172$title = $langs->trans(
"IntracommReportTitle");
176if ($action ==
'create') {
179 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
180 print
'<input type="hidden" name="token" value="'.newToken().
'">';
181 print
'<input type="hidden" name="action" value="add" />';
185 print
'<table class="border" width="100%">';
188 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
191 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Declaration").
"</td><td>\n";
192 print $form->selectarray(
"declaration", $declaration,
GETPOST(
'declaration',
'alpha') ?
GETPOST(
'declaration',
'alpha') : $object->declaration, 0);
197 print
'<td class="titlefieldcreate fieldrequired">';
198 print $langs->trans(
"AnalysisPeriod");
201 print $formother->select_month($month ? date(
'M') : $month,
'month', 0, 1,
'widthauto valignmiddle ', true);
202 print $formother->selectyear($year ? date(
'Y') : $year,
'year', 0, 3, 3, 0, 0,
'',
'', true);
207 print
'<tr><td class="fieldrequired">'.$langs->trans(
"TypeOfDeclaration").
"</td><td>\n";
208 print $form->selectarray(
"type_declaration", $typeOfDeclaration,
GETPOST(
'type_declaration',
'alpha') ?
GETPOST(
'type_declaration',
'alpha') : $object->type_declaration, 0);
215 print $form->buttonsSaveCancel();
220if ($id > 0 && $action !=
'edit') {
226 $res = $object->fetch($id);
237 print
dol_get_fiche_head(
"",
'general', $langs->trans(
"IntracommReport"), -1,
'user');
240 if ($action ==
'delete') {
241 $formquestion = array();
243 $formquestion[] = array(
245 'name' =>
'backtopage',
246 'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"])
249 print $form->formconfirm(
250 "card.php?rowid=".urlencode($id),
251 $langs->trans(
"DeleteReport"),
252 $langs->trans(
"ConfirmDeleteReport"),
260 $linkback =
'<a href="'.DOL_URL_ROOT.
'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
264 print
'<div class="fichecenter">';
265 print
'<div class="fichehalfleft">';
267 print
'<div class="underbanner clearboth"></div>';
268 print
'<table class="border tableforfield centpercent">';
271 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$object->declaration.
"</td></tr>\n";
274 print
'<tr><td>'.$langs->trans(
"AnalysisPeriod").
'</td><td class="valeur">'.$object->period.
'</td>';
278 print
'<tr><td>'.$langs->trans(
"TypeOfDeclaration").
'</td><td class="valeur">'.$object->exporttype.
'</td>';
283 print
"</div></div></div>\n";
284 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.