25 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fiscalyear.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/fiscalyear.class.php';
31 $langs->loadLangs(array(
"admin",
"compta"));
34 if ($user->socid > 0) {
37 if (empty($user->rights->accounting->fiscalyear->write)) {
43 $action =
GETPOST(
'action',
'aZ09');
44 $confirm =
GETPOST(
'confirm',
'alpha');
48 static $tmpstatut2label = array(
49 '0' =>
'OpenFiscalYear',
50 '1' =>
'CloseFiscalYear'
52 $statut2label = array(
55 foreach ($tmpstatut2label as $key => $val) {
56 $statut2label[$key] = $langs->trans($val);
69 if ($action ==
'confirm_delete' && $confirm ==
"yes") {
70 $result = $object->delete($id);
72 header(
"Location: fiscalyear.php");
77 } elseif ($action ==
'add') {
78 if (!
GETPOST(
'cancel',
'alpha')) {
81 $object->date_start = $date_start;
82 $object->date_end = $date_end;
83 $object->label =
GETPOST(
'label',
'alpha');
84 $object->statut =
GETPOST(
'statut',
'int');
87 if (empty($object->date_start) && empty($object->date_end)) {
88 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")), null,
'errors');
91 if (empty($object->label)) {
92 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")), null,
'errors');
99 $id = $object->create($user);
104 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
116 header(
"Location: ./fiscalyear.php");
119 } elseif ($action ==
'update') {
121 if (!
GETPOST(
'cancel',
'alpha')) {
122 $result = $object->fetch($id);
124 $object->date_start =
GETPOST(
"fiscalyear") ? $date_start :
'';
125 $object->date_end =
GETPOST(
"fiscalyearend") ? $date_end :
'';
126 $object->label =
GETPOST(
'label',
'alpha');
127 $object->statut =
GETPOST(
'statut',
'int');
129 $result = $object->update($user);
132 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
138 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
151 $title = $langs->trans(
"Fiscalyear").
" - ".$langs->trans(
"Card");
153 $help_url =
"EN:Module_Double_Entry_Accounting";
157 if ($action ==
'create') {
160 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
161 print
'<input type="hidden" name="token" value="'.newToken().
'">';
162 print
'<input type="hidden" name="action" value="add">';
166 print
'<table class="border centpercent">';
169 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input name="label" size="32" value="'.
GETPOST(
'label',
'alpha').
'"></td></tr>';
172 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
173 print
$form->selectDate(($date_start ? $date_start :
''),
'fiscalyear');
177 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
178 print
$form->selectDate(($date_end ? $date_end : - 1),
'fiscalyearend');
194 print
'<div class="center">';
195 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
196 print
' ';
197 print
'<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
202 $result = $object->fetch($id);
206 if ($action ==
'edit') {
209 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
210 print
'<input type="hidden" name="token" value="'.newToken().
'">';
211 print
'<input type="hidden" name="action" value="update">';
212 print
'<input type="hidden" name="id" value="'.$id.
'">';
214 print
'<table class="border centpercent">';
218 print
'<td class="titlefieldcreate titlefield">'.$langs->trans(
"Ref").
'</td><td>';
223 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td>';
224 print
'<input name="label" class="flat" size="32" value="'.$object->label.
'">';
228 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
229 print
$form->selectDate($object->date_start ? $object->date_start : - 1,
'fiscalyear');
233 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
234 print
$form->selectDate($object->date_end ? $object->date_end : - 1,
'fiscalyearend');
238 print
'<tr><td>'.$langs->trans(
"Statut").
'</td><td>';
240 print $object->getLibStatut(4);
245 print
$form->buttonsSaveCancel();
254 if ($action ==
'delete') {
255 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$id, $langs->trans(
"DeleteFiscalYear"), $langs->trans(
"ConfirmDeleteFiscalYear"),
"confirm_delete");
260 print
'<table class="border centpercent">';
262 $linkback =
'<a href="'.DOL_URL_ROOT.
'/accountancy/admin/fiscalyear.php">'.$langs->trans(
"BackToList").
'</a>';
265 print
'<tr><td class="titlefield">'.$langs->trans(
"Ref").
'</td><td width="50%">';
272 print
'<tr><td class="tdtop">';
273 print
$form->editfieldkey(
"Label",
'label', $object->label, $object, 1,
'alpha:32');
274 print
'</td><td colspan="2">';
275 print
$form->editfieldval(
"Label",
'label', $object->label, $object, 1,
'alpha:32');
280 print
$form->editfieldkey(
"DateStart",
'date_start', $object->date_start, $object, 1,
'datepicker');
281 print
'</td><td colspan="2">';
282 print
$form->editfieldval(
"DateStart",
'date_start', $object->date_start, $object, 1,
'datepicker');
287 print
$form->editfieldkey(
"DateEnd",
'date_end', $object->date_end, $object, 1,
'datepicker');
288 print
'</td><td colspan="2">';
289 print
$form->editfieldval(
"DateEnd",
'date_end', $object->date_end, $object, 1,
'datepicker');
293 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td colspan="2">'.$object->getLibStatut(4).
'</td></tr>';
302 if (!empty($user->rights->accounting->fiscalyear->write)) {
303 print
'<div class="tabsAction">';
305 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$id.
'">'.$langs->trans(
'Modify').
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_now($mode= 'auto')
Return date for now.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
fiscalyear_prepare_head(Fiscalyear $object)
Prepare array with list of tabs.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
Class to manage fiscal year.
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 ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.