39function is_empty($var, $allow_false =
false, $allow_ws =
false)
41 if (is_null($var) || !isset($var) || ($allow_ws ==
false && trim($var) ==
"" && !is_bool($var)) || ($allow_false ===
false && $var ===
false) || (is_array($var) && empty($var))) {
60 $head[$h][0] = DOL_URL_ROOT.
'/accountancy/admin/card.php?id='.
$object->id;
61 $head[$h][1] = $langs->trans(
"AccountAccounting");
62 $head[$h][2] =
'card';
84 $account = rtrim($account,
"0");
99 if ($account < 0 ||
is_empty($account)) {
110 $i = strlen($account);
138 if ($accounta < 0 ||
is_empty($accounta)) {
149 $i = strlen($accounta);
185function journalHead($nom, $variant, $period, $periodlink, $description, $builddate, $exportlink =
'', $moreparam = array(), $calcmode =
'', $varlink =
'', $moreoptions = array())
189 print
"\n\n<!-- start banner journal -->\n";
192 $varlink =
'?'.$varlink;
197 $head[$h][0] = $_SERVER[
"PHP_SELF"].$varlink;
198 $head[$h][1] = $langs->trans(
"Journalization");
199 $head[$h][2] =
'journal';
201 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].$varlink.
'">';
202 print
'<input type="hidden" name="token" value="'.newToken().
'">';
206 foreach ($moreparam as $key => $value) {
207 print
'<input type="hidden" name="'.$key.
'" value="'.$value.
'">';
209 print
'<table class="border centpercent tableforfield">';
213 print
'<td class="titlefieldcreate">'.$langs->trans(
"Name").
'</td>';
214 print
'<td colspan="3">';
222 print
'<td>'.$langs->trans(
"CalculationMode").
'</td>';
224 print
'<td colspan="3">';
230 print
'</td><td colspan="2">'.$variant;
238 print
'<td>'.$langs->trans(
"ReportPeriod").
'</td>';
240 print
'<td colspan="3">';
248 print
'</td><td colspan="2">'.$periodlink;
255 print
'<td>'.$langs->trans(
"ReportDescription").
'</td>';
256 print
'<td colspan="3">'.$description.
'</td>';
261 foreach ($moreoptions as $key => $value) {
263 print
'<td>'.$langs->trans($key).
'</td>';
264 print
'<td colspan="3">'.$value.
'</td>';
272 print
'<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans(
"Refresh").
'"></div>';
276 print
"\n<!-- end banner journal -->\n\n";
294 $periodbydefaultontransfer =
getDolGlobalInt(
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0);
295 if ($periodbydefaultontransfer == 2) {
296 $sql =
"SELECT date_start, date_end FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear";
297 $sql .=
" WHERE date_start < '".$db->idate(
dol_now()).
"' AND date_end > '".$db->idate(
dol_now()).
"'";
298 $sql .= $db->plimit(1);
299 $res = $db->query($sql);
300 if ($res->num_rows > 0) {
301 $obj = $db->fetch_object($res);
303 $date_start = $db->jdate($obj->date_start);
304 $date_end = $db->jdate($obj->date_end);
311 $year_end = $year_start + 1;
312 $month_end = $month_start - 1;
313 if ($month_end < 1) {
317 $date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
320 } elseif ($periodbydefaultontransfer == 1) {
323 $pastmonthyear = $year_current;
324 if ($pastmonth == 0) {
331 $pastmonthyear = $year_current;
332 if ($pastmonth == 0) {
339 'date_start' => $date_start,
340 'date_end' => $date_end,
341 'pastmonthyear' => $pastmonthyear,
342 'pastmonth' => $pastmonth
360 if ($from_time ===
null) {
364 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
367 $sql =
"SELECT date_start, date_end FROM ".$db->prefix().
"accounting_fiscalyear";
368 $sql .=
" WHERE date_start <= '".$db->idate($from_time, $gm).
"'";
369 if ($withenddateonly) {
370 $sql .=
" AND (date_end >= '".$db->idate($from_time, $gm).
"')";
372 $sql .=
" AND (date_end >= '".$db->idate($from_time, $gm).
"' OR date_end IS NULL)";
375 $sql .=
" AND entity IN (".getEntity(
'accounting_fiscalyear').
")";
376 $sql .= $db->order(
'date_start',
'DESC');
377 $sql .= $db->plimit(1);
379 $res = $db->query($sql);
381 if ($db->num_rows($res) > 0) {
383 $obj = $db->fetch_object($res);
385 $date_start = $db->jdate($obj->date_start, $gm);
390 $conf_fiscal_month_start =
getDolGlobalInt(
'SOCIETE_FISCAL_MONTH_START');
391 if ($conf_fiscal_month_start >= 1 && $conf_fiscal_month_start <= 12) {
392 $month_start = $conf_fiscal_month_start;
394 $year_start = $now_arr[
'year'];
395 if ($conf_fiscal_month_start > $now_arr[
'mon']) {
398 $year_end = $year_start + 1;
399 $month_end = $month_start - 1;
400 if ($month_end < 1) {
404 $date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start, $gm);
409 'date_start' => $date_start,
410 'date_end' => $date_end,
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
accounting_prepare_head(AccountingAccount $object)
Prepare array with list of tabs.
getCurrentPeriodOfFiscalYear($db, $conf, $from_time=null, $gm='tzserver', $withenddateonly=1)
Get current period of fiscal year?
journalHead($nom, $variant, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='', $moreoptions=array())
Show header of a page used to transfer/dispatch data in accounting.
is_empty($var, $allow_false=false, $allow_ws=false)
Check if a value is empty with some options.
getDefaultDatesForTransfer()
Return Default dates for transfer based on periodicity option in accountancy setup.
clean_account($account)
Return accounting account without zero on the right.
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
Class to manage accounting accounts.
dol_get_last_hour($date, $gm='tzserver')
Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
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...
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.