Merge pull request #21255 from aspangaro/16b4-php8_1

PHP 8 in social contribution
This commit is contained in:
Laurent Destailleur 2022-06-22 15:39:29 +02:00 committed by GitHub
commit 313cff77d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 61 deletions

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -254,6 +255,7 @@ if ($action == 'create') {
print "</tr>\n";
$total = 0;
$total_ttc = 0;
$totalrecu = 0;
while ($i < $num) {

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -134,7 +135,7 @@ print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("Pa
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_payment.'</td></tr>';
// Amount
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -53,6 +53,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$lineid = GETPOST('lineid', 'int');
$fk_project = (GETPOST('fk_project') ? GETPOST('fk_project', 'int') : 0);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -544,7 +545,7 @@ class PaymentSocialContribution extends CommonObject
*/
public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
global $conf, $langs;
// Clean data
$this->num_payment = trim($this->num_payment);

View File

@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -41,16 +41,17 @@ if (!empty($conf->project->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills', 'hrm', 'projects'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
$search_ref = GETPOST('search_ref', 'int');
$search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$search_status = GETPOST('search_status', 'int');
$search_typeid = GETPOST('search_typeid', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$search_status = GETPOST('search_status', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
@ -70,11 +71,11 @@ $search_date_limit_end = dol_mktime(23, 59, 59, $search_date_limit_endmonth, $se
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_users = GETPOST('search_users');
$search_type = GETPOST('search_type', 'int');
$search_account = GETPOST('search_account', 'int');
$search_account = GETPOST('search_account', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
@ -93,19 +94,6 @@ if (!$sortorder) {
$filtre = GETPOST("filtre", 'int');
if (!GETPOSTISSET('search_typeid')) {
$newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre);
foreach ($filterarray as $val) {
$part = explode(':', $val);
if ($part[0] == 'cs.fk_type') {
$search_typeid = $part[1];
}
}
} else {
$search_typeid = GETPOST('search_typeid', 'int');
}
$arrayfields = array(
'cs.rowid' =>array('label'=>"Ref", 'checked'=>1, 'position'=>10),
'cs.libelle' =>array('label'=>"Label", 'checked'=>1, 'position'=>20),
@ -388,6 +376,9 @@ if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
$db->close();
}
$moreforfilter = '';
$massactionbutton = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) {
@ -551,7 +542,9 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $
print '</tr>';
$i = 0;
$totalarray = $TLoadedUsers = array();
$totalarray = $TLoadedUsers = array();
$totalarray['nbfield'] = 0;
$totalarray['val']['totalttcfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

View File

@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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,6 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
if (!empty($conf->accounting->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}
$hookmanager = new HookManager($db);
@ -48,6 +51,7 @@ $langs->loadLangs(array('compta', 'bills', 'hrm'));
$year = GETPOST("year", 'int');
$search_sc_type = GETPOST('search_sc_type', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -123,6 +127,9 @@ if ($year) {
if ($search_sc_type) {
$param .= '&search_sc_type='.urlencode($search_sc_type);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
$num = 0;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -139,14 +146,16 @@ $sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
$sql .= " u.rowid as uid, u.lastname, u.firstname, u.email, u.login, u.admin, u.statut,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
$sql .= " aj.label as account_journal";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON ba.fk_accountancy_journal = aj.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = cs.fk_user";
$sql .= " WHERE cs.fk_type = c.id";
$sql .= " AND cs.entity IN (".getEntity("tax").")";
@ -278,7 +287,7 @@ while ($i < min($num, $limit)) {
print $socialcontrib->getNomUrl(1, '');
print '</td>';
// Type
print '<td title="'.dol_escape_htmltag($obj->label).'" class="tdoverflowmax300">'.$obj->label.'</td>';
print '<td title="'.dol_escape_htmltag($obj->label_sc).'" class="tdoverflowmax300">'.$obj->label_sc.'</td>';
// Date
$date = $obj->periode;
if (empty($date)) {
@ -297,8 +306,7 @@ while ($i < min($num, $limit)) {
$userstatic->admin = $obj->admin;
$userstatic->login = $obj->login;
$userstatic->email = $obj->email;
$userstatic->socid = $obj->fk_soc;
$userstatic->statut = $obj->status;
$userstatic->statut = $obj->statut;
print $userstatic->getNomUrl(1);
print "</td>\n";
}
@ -327,13 +335,16 @@ while ($i < min($num, $limit)) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->accountancy_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->label = $obj->blabel;
$accountstatic->iban = $obj->iban;
$accountstatic->bic = $obj->bic;
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$accountstatic->clos = $obj->clos;
if (!empty($conf->accounting->enabled)) {
$accountstatic->account_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->account_journal;
}
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
@ -356,7 +367,6 @@ while ($i < min($num, $limit)) {
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}