27require
'../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/fiscalyear.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/fiscalyear.class.php';
40$langs->loadLangs(array(
"admin",
"compta"));
46$action =
GETPOST(
'action',
'aZ09');
47$confirm =
GETPOST(
'confirm',
'alpha');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
52$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
60include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
76$permissiontoadd = $user->hasRight(
'accounting',
'fiscalyear',
'write');
79if ($user->socid > 0) {
82if (!$permissiontoadd) {
92$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
97if ($action ==
'confirm_delete' && $confirm ==
"yes" ) {
98 $result =
$object->delete($user);
100 header(
"Location: fiscalyear.php");
105} elseif ($action ==
'add' ) {
106 if (!
GETPOST(
'cancel',
'alpha')) {
116 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
120 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
130 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
136 if ($id == -5 && !empty(
$object->errors[0])) {
147 header(
"Location: ./fiscalyear.php");
150} elseif ($action ==
'update' ) {
152 if (!
GETPOST(
'cancel',
'alpha')) {
160 $result =
$object->update($user);
162 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
166 if ($result == -5 && !empty(
$object->errors[0])) {
173 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
176} elseif ($action ==
'reopen' &&
getDolGlobalString(
'ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD')) {
180 $result =
$object->update($user);
183 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
197$title = $langs->trans(
"Fiscalyear").
" - ".$langs->trans(
"Card");
198if ($action ==
'create') {
199 $title = $langs->trans(
"NewFiscalYear");
202$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
204llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-fiscalyear');
206if ($action ==
'create') {
209 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
210 print
'<input type="hidden" name="token" value="'.newToken().
'">';
211 print
'<input type="hidden" name="action" value="add">';
215 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
218 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td>';
219 print
'<input name="label" size="32" value="'.GETPOST(
'label',
'alpha').
'">';
223 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
228 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
229 print $form->selectDate(($date_end ? $date_end : - 1),
'fiscalyearend');
247 print
'</table>'.
"\n";
251 print $form->buttonsSaveCancel(
"Create");
260if (($id || $ref) && $action ==
'edit') {
261 print
load_fiche_titre($langs->trans(
"Fiscalyear"),
'',
'object_'.$object->picto);
263 print
'<form method="POST" name="update" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
264 print
'<input type="hidden" name="token" value="'.newToken().
'">';
265 print
'<input type="hidden" name="action" value="update">';
266 print
'<input type="hidden" name="status" value="' .
$object->status .
'">';
267 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
269 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
271 if ($backtopageforcancel) {
272 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
277 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
281 print
'<td class="titlefieldcreate titlefield">'.$langs->trans(
"Ref").
'</td><td>';
286 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td>';
287 print
'<input name="label" class="flat" size="32" value="'.$object->label.
'">';
291 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
292 print $form->selectDate(
$object->date_start ?
$object->date_start : - 1,
'fiscalyear');
296 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
297 print $form->selectDate(
$object->date_end ?
$object->date_end : - 1,
'fiscalyearend');
301 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
302 print
$object->getLibStatut(4);
315 print $form->buttonsSaveCancel();
321if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
324 print
dol_get_fiche_head($head,
'card', $langs->trans(
"Fiscalyear"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
333 if ($action ==
'delete') {
334 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteFiscalYear"), $langs->trans(
"ConfirmDeleteFiscalYear"),
"confirm_delete",
'', 0, 1);
342 $linkback =
'<a href="'.DOL_URL_ROOT.
'/accountancy/admin/fiscalyear.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
344 dol_banner_tab($object,
'label', $linkback, 1,
'label',
'label', $morehtmlref);
347 print
'<div class="fichecenter">';
348 print
'<div class="fichehalfleft">';
349 print
'<div class="underbanner clearboth"></div>';
351 print
'<table class="border centpercent tableforfield">'.
"\n";
355 print
'<td class="titlefield">'.$langs->trans(
"Id").
'</td><td>';
360 print
'<tr><td class="tdtop">';
361 print $form->editfieldkey(
"Label",
'label',
$object->label, $object, 0,
'alpha:32');
363 print $form->editfieldval(
"Label",
'label',
$object->label, $object, 0,
'alpha:32');
368 print $form->editfieldkey(
"DateStart",
'date_start', (
string)
$object->date_start, $object, 0,
'datepicker');
370 print $form->editfieldval(
"DateStart",
'date_start',
$object->date_start, $object, 0,
'datepicker');
375 print $form->editfieldkey(
"DateEnd",
'date_end', (
string)
$object->date_end, $object, 0,
'datepicker');
377 print $form->editfieldval(
"DateEnd",
'date_end',
$object->date_end, $object, 0,
'datepicker');
385 print
'<div class="clearboth"></div>';
393 if ($user->hasRight(
'accounting',
'fiscalyear',
'write')) {
394 print
'<div class="tabsAction">';
397 print dolGetButtonAction($langs->trans(
"ReOpen"),
'',
'reopen', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=reopen&token='.newToken(),
'reopen', (
int) $permissiontoadd);
400 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.
$id.
'">'.$langs->trans(
'Modify').
'</a>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage fiscal year.
fiscalyear_prepare_head(Fiscalyear $object)
Prepare array with list of tabs.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.