38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/intracommreport/class/intracommreport.class.php';
44$langs->loadLangs(array(
"intracommreport"));
51$label = (string)
GETPOST(
'label',
'alphanohtml');
53$exporttype = GETPOSTISSET(
'exporttype') ?
GETPOST(
'exporttype',
'alphanohtml') :
'deb';
54$type_declaration = (string)
GETPOST(
'type_declaration',
'alphanohtml');
56$backtopage =
GETPOST(
'backtopage',
'alpha');
59 "deb" => $langs->trans(
"DEB"),
60 "des" => $langs->trans(
"DES"),
63$typeOfDeclaration = array(
64 "introduction" => $langs->trans(
"Introduction"),
65 "expedition" => $langs->trans(
"Expedition"),
77$hookmanager->initHooks(array(
'intracommcard',
'globalcard'));
82$permissiontoread = $user->hasRight(
'intracommreport',
'read');
83$permissiontoadd = $user->hasRight(
'intracommreport',
'write');
84$permissiontodelete = $user->hasRight(
'intracommreport',
'delete');
91if (empty($conf->intracommreport->enabled)) {
94if (!$permissiontoread) {
104$parameters = array(
'id' => $id);
106$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
111if ($permissiontodelete && $action ==
'confirm_delete' && $confirm ==
'yes') {
112 $result =
$object->delete($user);
114 if (!empty($backtopage)) {
115 header(
"Location: ".$backtopage);
118 header(
"Location: list.php");
126if ($action ==
'add' && $permissiontoadd) {
128 $object->exporttype = trim($exporttype);
129 $object->type_declaration = $type_declaration;
140 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
142 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"intracommreport WHERE ref='".$db->escape(
$object->label).
"'";
143 $result = $db->query($sql);
145 $num = $db->num_rows($result);
149 $langs->load(
"errors");
150 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
157 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
173$title = $langs->trans(
"IntracommReportTitle");
177if ($action ==
'create') {
180 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
181 print
'<input type="hidden" name="token" value="'.newToken().
'">';
182 print
'<input type="hidden" name="action" value="add" />';
186 print
'<table class="border" width="100%">';
189 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
192 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Declaration").
"</td><td>\n";
193 print $form->selectarray(
"declaration", $declaration,
GETPOST(
'declaration',
'alpha') ?
GETPOST(
'declaration',
'alpha') :
$object->declaration, 0);
198 print
'<td class="titlefieldcreate fieldrequired">';
199 print $langs->trans(
"AnalysisPeriod");
202 print $formother->select_month($month ? date(
'M') : $month,
'month', 0, 1,
'widthauto valignmiddle ', true);
203 print $formother->selectyear($year ? date(
'Y') : $year,
'year', 0, 3, 3, 0, 0,
'',
'', true);
208 print
'<tr><td class="fieldrequired">'.$langs->trans(
"TypeOfDeclaration").
"</td><td>\n";
209 print $form->selectarray(
"type_declaration", $typeOfDeclaration,
GETPOST(
'type_declaration',
'alpha') ?
GETPOST(
'type_declaration',
'alpha') :
$object->type_declaration, 0);
216 print $form->buttonsSaveCancel();
221if ($id > 0 && $action !=
'edit') {
238 print
dol_get_fiche_head(array(),
'general', $langs->trans(
"IntracommReport"), -1,
'user');
241 if ($action ==
'delete') {
242 $formquestion = array();
244 $formquestion[] = array(
246 'name' =>
'backtopage',
247 'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"])
250 print $form->formconfirm(
251 "card.php?rowid=".urlencode((
string) ($id)),
252 $langs->trans(
"DeleteReport"),
253 $langs->trans(
"ConfirmDeleteReport"),
261 $linkback =
'<a href="'.DOL_URL_ROOT.
'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
263 dol_banner_tab(
$object,
'rowid', $linkback);
265 print
'<div class="fichecenter">';
266 print
'<div class="fichehalfleft">';
268 print
'<div class="underbanner clearboth"></div>';
269 print
'<table class="border tableforfield centpercent">';
272 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.
$object->declaration.
"</td></tr>\n";
275 print
'<tr><td>'.$langs->trans(
"AnalysisPeriod").
'</td><td class="valeur">'.
$object->period.
'</td>';
279 print
'<tr><td>'.$langs->trans(
"TypeOfDeclaration").
'</td><td class="valeur">'.
$object->exporttype.
'</td>';
284 print
"</div></div></div>\n";
285 print
'<div class="clearboth"></div>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.