diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index e30a9984949..9f5f9d3ca93 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry * Copyright (C) 2013-2020 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,12 +39,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array("accountancy", "compta")); $action = GETPOST('action', 'aZ09'); -$search_date_startyear = GETPOST('search_date_startyear', 'int'); -$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); -$search_date_startday = GETPOST('search_date_startday', 'int'); -$search_date_endyear = GETPOST('search_date_endyear', 'int'); -$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); -$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); $search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); @@ -73,16 +73,22 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_ } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page < 0) { $page = 0; } +if (empty($page) || $page < 0) { + $page = 0; +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($sortorder == "") $sortorder = "ASC"; -if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; +if ($sortorder == "") { + $sortorder = "ASC"; +} +if ($sortfield == "") { + $sortfield = "t.doc_date,t.rowid"; +} // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new BookKeeping($db); @@ -105,11 +111,12 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc } else { $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $year_start = dol_print_date(dol_now(), '%Y'); - if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year + if (dol_print_date(dol_now(), '%m') < $month_start) { + $year_start--; // If current month is lower that starting fiscal month, we start last year + } $year_end = $year_start + 1; $month_end = $month_start - 1; - if ($month_end < 1) - { + if ($month_end < 1) { $month_end = 12; $year_end--; } @@ -130,7 +137,9 @@ $arrayfields = array( 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), ); -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); +if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { + unset($arrayfields['t.lettering_code']); +} if ($search_date_start && empty($search_date_startyear)) { $tmparray = dol_getdate($search_date_start); @@ -149,19 +158,23 @@ if ($search_date_end && empty($search_date_endyear)) { /* * Action */ -if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} $parameters = array('socid'=>$socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} -if (empty($reshook)) -{ +if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers - { + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_doc_date = ''; $search_accountancy_code = ''; $search_accountancy_code_start = ''; @@ -279,8 +292,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme $deljournal = 0; } - if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) - { + if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) { $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0)); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -393,7 +405,9 @@ if ($action == 'delbookkeepingyear') { print '
'; print ''; print ''; -if ($optioncss != '') print ''; +if ($optioncss != '') { + print ''; +} print ''; print ''; print ''; @@ -409,8 +423,12 @@ if (empty($reshook)) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); } -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -418,11 +436,16 @@ print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded")); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); +if ($massactionbutton) { + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); +} // Reverse sort order -if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; -else $sortorder = "desc"; +if (preg_match('/^asc/i', $sortorder)) { + $sortorder = "asc"; +} else { + $sortorder = "desc"; +} $moreforfilter = ''; @@ -439,8 +462,11 @@ $moreforfilter .= ''; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; -else $moreforfilter = $hookmanager->resPrint; +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} print '
'; print $moreforfilter; @@ -470,8 +496,7 @@ if (!empty($arrayfields['t.doc_date']['checked'])) { print ''; } // Movement number -if (!empty($arrayfields['t.piece_num']['checked'])) -{ +if (!empty($arrayfields['t.piece_num']['checked'])) { print ''; } // Ref document @@ -491,8 +516,7 @@ if (!empty($arrayfields['t.credit']['checked'])) { print ''; } // Lettering code -if (!empty($arrayfields['t.lettering_code']['checked'])) -{ +if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''; print ''; print '
'.$langs->trans("NotReconciled").''; @@ -512,14 +536,30 @@ print ''; print "\n"; print ''; -if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); -if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); -if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); -if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); -if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.code_journal']['checked'])) { + print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); +} +if (!empty($arrayfields['t.doc_date']['checked'])) { + print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); +} +if (!empty($arrayfields['t.piece_num']['checked'])) { + print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); +} +if (!empty($arrayfields['t.doc_ref']['checked'])) { + print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['t.label_operation']['checked'])) { + print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['t.debit']['checked'])) { + print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); +} +if (!empty($arrayfields['t.credit']['checked'])) { + print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); +} +if (!empty($arrayfields['t.lettering_code']['checked'])) { + print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +} // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook @@ -538,8 +578,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu // -------------------------------------------------------------------- $i = 0; $totalarray = array(); -while ($i < min($num, $limit)) -{ +while ($i < min($num, $limit)) { $line = $object->lines[$i]; $total_debit += $line->debit; @@ -550,15 +589,15 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; - } else { - $colnumber = 4; - $colnumberend = 7; - } - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -571,8 +610,7 @@ while ($i < min($num, $limit)) $balance = $sous_total_debit - $sous_total_credit; print ''; print ''.$langs->trans("Balance").':'; - if ($balance > 0) - { + if ($balance > 0) { print ''; print price($sous_total_debit - $sous_total_credit); print ''; @@ -595,7 +633,9 @@ while ($i < min($num, $limit)) } else { // Should not happen: subledger account must be null or a non empty value print ''.$langs->trans("Unknown"); - if ($line->subledger_label) print ' ('.$line->subledger_label.')'; + if ($line->subledger_label) { + print ' ('.$line->subledger_label.')'; + } $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined'; print $form->textwithpicto('', $htmltext); print ''; @@ -614,38 +654,39 @@ while ($i < min($num, $limit)) print ''; // Journal code - if (!empty($arrayfields['t.code_journal']['checked'])) - { + if (!empty($arrayfields['t.code_journal']['checked'])) { $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); print ''.$journaltoshow.''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Document date - if (!empty($arrayfields['t.doc_date']['checked'])) - { + if (!empty($arrayfields['t.doc_date']['checked'])) { print ''.dol_print_date($line->doc_date, 'day').''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Piece number - if (!empty($arrayfields['t.piece_num']['checked'])) - { + if (!empty($arrayfields['t.piece_num']['checked'])) { print ''; $object->id = $line->id; $object->piece_num = $line->piece_num; print $object->getNomUrl(1, '', 0, '', 1); print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Document ref - if (!empty($arrayfields['t.doc_ref']['checked'])) - { - if ($line->doc_type == 'customer_invoice') - { + if (!empty($arrayfields['t.doc_ref']['checked'])) { + if ($line->doc_type == 'customer_invoice') { $langs->loadLangs(array('bills')); require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -657,8 +698,7 @@ while ($i < min($num, $limit)) $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } elseif ($line->doc_type == 'supplier_invoice') - { + } elseif ($line->doc_type == 'supplier_invoice') { $langs->loadLangs(array('bills')); require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; @@ -670,8 +710,7 @@ while ($i < min($num, $limit)) $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); - } elseif ($line->doc_type == 'expense_report') - { + } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; @@ -683,8 +722,7 @@ while ($i < min($num, $limit)) $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - } elseif ($line->doc_type == 'bank') - { + } elseif ($line->doc_type == 'bank') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $objectstatic = new AccountLine($db); $objectstatic->fetch($line->fk_doc); @@ -698,8 +736,7 @@ while ($i < min($num, $limit)) // Picto + Ref print ''; - if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') - { + if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') { print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); print $documentlink; } elseif ($line->doc_type == 'bank') { @@ -712,7 +749,9 @@ while ($i < min($num, $limit)) print ''; print "\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Label operation @@ -720,31 +759,41 @@ while ($i < min($num, $limit)) // Affiche un lien vers la facture client/fournisseur $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); print strlen(length_accounta($line->subledger_account)) == 0 ? ''.$line->label_operation.'' : ''.$line->label_operation.'
('.length_accounta($line->subledger_account).')'; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Amount debit - if (!empty($arrayfields['t.debit']['checked'])) - { + if (!empty($arrayfields['t.debit']['checked'])) { print ''.($line->debit ? price($line->debit) : '').''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; + } $totalarray['val']['totaldebit'] += $line->debit; } // Amount credit if (!empty($arrayfields['t.credit']['checked'])) { print ''.($line->credit ? price($line->credit) : '').''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; + } $totalarray['val']['totalcredit'] += $line->credit; } // Lettering code - if (!empty($arrayfields['t.lettering_code']['checked'])) - { + if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''.$line->lettering_code.''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Fields from hook @@ -763,7 +812,9 @@ while ($i < min($num, $limit)) } } print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Comptabilise le sous-total $sous_total_debit += $line->debit; @@ -777,11 +828,11 @@ while ($i < min($num, $limit)) if ($num > 0) { // Show sub-total of last shown account if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; + $colnumber = 3; + $colnumberend = 7; } else { - $colnumber = 4; - $colnumberend = 7; + $colnumber = 4; + $colnumberend = 7; } $colspan = $totalarray['nbfield'] - $colnumber; $colspanend = $totalarray['nbfield'] - $colnumberend; @@ -795,8 +846,7 @@ if ($num > 0) { $balance = $sous_total_debit - $sous_total_credit; print ''; print ''.$langs->trans("Balance").':'; - if ($balance > 0) - { + if ($balance > 0) { print ''; print price($sous_total_debit - $sous_total_credit); print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index e831e21f814..2d90c9a7b14 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -4,7 +4,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,14 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "accountancy")); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +$confirm = GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); +// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +// Security check +$socid = GETPOSTINT("socid"); +// if ($user->socid) $socid=$user->socid; -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -54,10 +57,12 @@ if (empty($page) || $page == - 1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($sortorder == "") +if ($sortorder == "") { $sortorder = "ASC"; -if ($sortfield == "") +} +if ($sortfield == "") { $sortfield = "bk.doc_date"; +} /* $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); @@ -74,23 +79,18 @@ if (!empty($lettering)) { /* if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { - $search_date_start = ''; - $search_date_end = ''; + $search_date_start = ''; + $search_date_end = ''; //$search_doc_type = ''; $search_doc_ref = ''; } */ -// Security check -$socid = GETPOST("socid", 'int'); -// if ($user->socid) $socid=$user->socid; - $lettering = new Lettering($db); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result < 0) -{ +if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -208,30 +208,30 @@ if ($resql) { print ''."\n"; /* - print ''; - //print ''; + print ''; + //print ''; - // Date - print ''; + // Date + print ''; - // Piece - print ''; + // Piece + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; */ print ''; @@ -251,7 +251,9 @@ if ($resql) { $tmp = ''; while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; + if ($tmp != $obj->lettering_code || empty($tmp)) { + $tmp = $obj->lettering_code; + } /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index b5620f3ec25..31acb9f0191 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -41,7 +41,11 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); +// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); +// Security check +$socid = GETPOSTINT("socid"); +// if ($user->socid) $socid=$user->socid; + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -53,10 +57,12 @@ if (empty($page) || $page == - 1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($sortorder == "") +if ($sortorder == "") { $sortorder = "ASC"; -if ($sortfield == "") +} +if ($sortfield == "") { $sortfield = "bk.doc_date"; +} /* $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); @@ -73,24 +79,18 @@ if (!empty($lettering)) { /* if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { - $search_date_start = ''; - $search_date_end = ''; + $search_date_start = ''; + $search_date_end = ''; //$search_doc_type=''; $search_doc_ref=''; } */ - -// Security check -$socid = GETPOST("socid", 'int'); -// if ($user->socid) $socid=$user->socid; - $lettering = new Lettering($db); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result < 0) -{ +if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -159,8 +159,7 @@ $solde = 0; // Count total nb of records and calc total sum $nbtotalofrecords = ''; $resql = $db->query($sql); -if (!$resql) -{ +if (!$resql) { dol_print_error($db); exit; } @@ -206,30 +205,30 @@ if ($resql) { print '
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
'; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); + print '
'; + print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
 '; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'."\n"; /* - print ''; - //print ''; + print ''; + //print ''; - // Date - print ''; + // Date + print ''; - // Piece - print ''; + // Piece + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; */ print ''; @@ -248,7 +247,9 @@ if ($resql) { $solde = 0; $tmp = ''; while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; + if ($tmp != $obj->lettering_code || empty($tmp)) { + $tmp = $obj->lettering_code; + } /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); print '';
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
'; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); + print '
'; + print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
 '; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '