From 37ff10eafc6b2e17016b5426aae8a1b5e0427ddb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:13:53 +0200 Subject: [PATCH 1/8] PHP 8 in social contribution --- htdocs/compta/paiement_charge.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index db48b2767f2..ba62c36b0fa 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,6 +1,7 @@ * Copyright (C) 2016-2018 Frédéric France + * Copyright (C) 2022 Alexandre Spangaro * * 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 "\n"; $total = 0; + $total_ttc = 0; $totalrecu = 0; while ($i < $num) { From cfed286e63d698fe71b1ebde4972e0c5ceefab40 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:14:00 +0200 Subject: [PATCH 2/8] PHP 8 in social contribution --- htdocs/compta/payment_sc/card.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index b1ec9800aa5..f5ff5a101f2 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2022 Alexandre Spangaro * * 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 ''.$langs->trans('Mode').''.$langs->trans("Pa print ''.$langs->trans('Numero').''.$object->num_payment.''; // Amount -print ''.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; +print ''.$langs->trans('Amount').''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).''; // Note print ''.$langs->trans('Note').''.nl2br($object->note).''; From 489ed743be4c48de8f74f98b32e9e58a11ebb8c4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:14:08 +0200 Subject: [PATCH 3/8] PHP 8 in social contribution --- htdocs/compta/sociales/card.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 900f1a179e9..b6c69c0182c 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -1,9 +1,9 @@ - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2016-2018 Frédéric France - * Copyright (C) 2017 Alexandre Spangaro - * Copyright (C) 2021 Gauthier VERDOL +/* Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2016-2018 Frédéric France + * Copyright (C) 2017-2022 Alexandre Spangaro + * Copyright (C) 2021 Gauthier VERDOL * * 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); From 4cbe6fb48d005b0a474221eca5878100f1b8d1d9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:14:14 +0200 Subject: [PATCH 4/8] PHP 8 in social contribution --- .../sociales/class/paymentsocialcontribution.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 1b83915714d..318e7fcd96b 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2004-2007 Laurent Destailleur +/* Copyright (C) 2002 Rodolphe Quiedeville + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2022 Alexandre Spangaro * * 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); From bba32869a3552ed892ed99c1fff067802389f31b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:14:30 +0200 Subject: [PATCH 5/8] PHP 8 in social contribution --- htdocs/compta/sociales/list.php | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 082a485f817..785d00d9468 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2016 Frédéric France - * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2021 Alexandre Spangaro +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2016 Frédéric France + * Copyright (C) 2020 Pierre Ardoin + * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2021-2022 Alexandre Spangaro * * 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,16 @@ if (!empty($conf->projet->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_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 +70,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) { @@ -388,6 +388,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 +554,9 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $ print ''; $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); From f94b25c8372d62cec808580aa89f33d904779887 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:14:56 +0200 Subject: [PATCH 6/8] PHP 8 in social contribution --- htdocs/compta/sociales/payments.php | 41 ++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index d2646d241ea..99d4b760d40 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2016 Alexandre Spangaro - * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021 Gauthier VERDOL +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011-2022 Alexandre Spangaro + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2021 Gauthier VERDOL * * 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 '
'; @@ -139,7 +146,7 @@ $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 .= " 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 .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql .= " ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -278,7 +285,7 @@ while ($i < min($num, $limit)) { print $socialcontrib->getNomUrl(1, ''); print ''; // Type - print ''.$obj->label.''; + print ''.$obj->label_sc.''; // Date $date = $obj->periode; if (empty($date)) { @@ -297,8 +304,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 "\n"; } @@ -327,13 +333,19 @@ 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; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->fk_accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } print $accountstatic->getNomUrl(1); } else { print ' '; @@ -356,7 +368,6 @@ while ($i < min($num, $limit)) { print ''; $total = $total + $obj->total; - $totalnb = $totalnb + $obj->nb; $totalpaid = $totalpaid + $obj->totalpaid; $i++; } From 56e03b9a113bd2704c8208de3ab13aea33cfb1d0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Jun 2022 09:22:53 +0200 Subject: [PATCH 7/8] PHP 8 in social contribution --- htdocs/compta/sociales/list.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 785d00d9468..1590ddc83f2 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -49,6 +49,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sc $search_ref = GETPOST('search_ref', 'int'); $search_label = GETPOST('search_label', 'alpha'); +$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'); @@ -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), From 50e5cf1a566b593ce082b21c7a2ee779526b956a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 19 Jun 2022 21:29:45 +0200 Subject: [PATCH 8/8] Fix fetch label journal --- htdocs/compta/sociales/payments.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 99d4b760d40..843dbd58a50 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -147,13 +147,15 @@ $sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.d $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 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 .= " 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").")"; @@ -341,10 +343,7 @@ while ($i < min($num, $limit)) { if (!empty($conf->accounting->enabled)) { $accountstatic->account_number = $obj->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + $accountstatic->accountancy_journal = $obj->account_journal; } print $accountstatic->getNomUrl(1); } else {