Merge pull request #21319 from aspangaro/16b2

PHP 8
This commit is contained in:
Laurent Destailleur 2022-06-22 10:07:45 +02:00 committed by GitHub
commit 3749d70ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 82 deletions

View File

@ -1121,7 +1121,7 @@ if ($object->id > 0) {
* Latest contracts
*/
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= " WHERE c.fk_soc = s.rowid ";
$sql .= " AND s.rowid = ".((int) $object->id);
@ -1191,7 +1191,7 @@ if ($object->id > 0) {
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param);
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
}
// $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
@ -1409,6 +1409,7 @@ if ($object->id > 0) {
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
$sql .= ', f.total_ttc';
$sql .= ', f.entity';
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status';
$sql .= ', s.nom, s.rowid as socid';
$sql .= ', SUM(pf.amount) as am';
@ -1475,7 +1476,7 @@ if ($object->id > 0) {
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param);
print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0);
}
// $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search
// Security check
$socid = GETPOST("socid", "int");
if ($user->socid) {
@ -75,6 +77,7 @@ if (empty($search_datev_start)) {
if (empty($search_datev_end)) {
$search_datev_end = GETPOST("search_datev_end", 'int');
}
$search_type_id = GETPOST('search_type_id', 'int');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@ -94,19 +97,6 @@ if (!$sortorder) {
$filtre = GETPOST("filtre", 'alpha');
if (!GETPOST('typeid')) {
$newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre);
foreach ($filterarray as $val) {
$part = explode(':', $val);
if ($part[0] == 'v.fk_typepayment') {
$typeid = $part[1];
}
}
} else {
$typeid = GETPOST('typeid');
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$search_ref = '';
$search_label = '';
@ -120,7 +110,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_bank_entry = '';
$search_accountancy_account = '';
$search_accountancy_subledger = '';
$typeid = '';
$search_type_id = '';
}
$search_all = GETPOSTISSET("search_all") ? trim(GETPOST("search_all", 'alpha')) : trim(GETPOST('sall'));
@ -265,8 +255,8 @@ if ($search_accountancy_account > 0) {
if ($search_accountancy_subledger > 0) {
$sql .= " AND v.subledger_account = ".((int) $search_accountancy_subledger);
}
if ($typeid > 0) {
$sql .= " AND v.fk_typepayment=".((int) $typeid);
if ($search_type_id > 0) {
$sql .= " AND v.fk_typepayment=".((int) $search_type_id);
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@ -324,8 +314,8 @@ if ($resql) {
if ($search_datev_end) {
$param .= '&search_datev_end='.urlencode($search_datev_end);
}
if ($typeid > 0) {
$param .= '&typeid='.urlencode($typeid);
if ($search_type_id > 0) {
$param .= '&search_type_id='.urlencode($search_type_id);
}
if ($search_amount_deb) {
$param .= '&search_amount_deb='.urlencode($search_amount_deb);
@ -375,6 +365,7 @@ if ($resql) {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter= '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
@ -427,7 +418,7 @@ if ($resql) {
// Payment type
if ($arrayfields['type']['checked']) {
print '<td class="liste_titre center">';
$form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16, 1, 'maxwidth100');
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100');
print '</td>';
}
@ -544,6 +535,8 @@ if ($resql) {
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val']['total_cred'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -656,7 +649,7 @@ if ($resql) {
if ($arrayfields['account']['checked']) {
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$obj->accountancy_label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$accountingaccount->label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

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
@ -58,6 +58,7 @@ $filtre = GETPOST("filtre", 'alpha');
if (!$year) {
$year = date("Y", time());
}
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_account = GETPOST('search_account', 'int');
@ -184,7 +185,6 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
@ -204,7 +204,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->label.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->label.'</a></td>';
// Expected to pay
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Ref payment
@ -246,7 +246,6 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@ -274,7 +273,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print load_fiche_titre($langs->trans("VATDeclarations").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
$sql = "SELECT ptva.rowid, pv.rowid as id_tva, pv.amount as amount_tva, ptva.amount, pv.label, pv.datev as dm, ptva.datep as date_payment, ptva.fk_bank,";
$sql = "SELECT ptva.rowid, pv.rowid as id_tva, pv.amount as amount_tva, ptva.amount, pv.label, pv.datev as dm, ptva.datep as date_payment, ptva.fk_bank, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as pv";

View File

@ -256,7 +256,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if (getDolGlobalString("INVOICE_USE_SITUATION") && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
if (getDolGlobalString("INVOICE_USE_SITUATION") && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
@ -138,7 +138,7 @@ $candelete = 0;
if (!empty($user->rights->expensereport->supprimer)) {
$candelete = 1;
}
if ($object->statut == ExpenseReport::STATUS_DRAFT && $user->rights->expensereport->write && in_array($object->fk_user_author, $childids)) {
if ($object->statut == ExpenseReport::STATUS_DRAFT && !empty($user->rights->expensereport->write) && in_array($object->fk_user_author, $childids)) {
$candelete = 1;
}
@ -1467,6 +1467,8 @@ if ($action == 'create') {
}
// Public note
$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : '';
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
@ -1476,6 +1478,8 @@ if ($action == 'create') {
print '</td></tr>';
// Private note
$note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : '';
if (empty($user->socid)) {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
@ -1624,6 +1628,8 @@ if ($action == 'create') {
print dol_get_fiche_head($head, 'card', $langs->trans("ExpenseReport"), -1, 'trip');
$formconfirm = '';
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
@ -1923,6 +1929,7 @@ if ($action == 'create') {
// List of payments already done
$nbcols = 3;
$nbrows = 0;
if (!empty($conf->banque->enabled)) {
$nbrows++;
$nbcols++;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* 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
@ -486,7 +486,7 @@ class PaymentSalary 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 ? $this->num_payment : $this->num_paiement);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* 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
@ -94,6 +94,10 @@ class Salary extends CommonObject
*/
public $user;
/**
* 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
*/
public $paye;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
@ -218,8 +222,6 @@ class Salary extends CommonObject
$sql .= " s.fk_user_author,";
$sql .= " s.fk_user_modif,";
$sql .= " s.fk_account";
/*$sql .= " b.fk_type,";
$sql .= " b.rappro";*/
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
@ -231,28 +233,26 @@ class Salary extends CommonObject
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms);
$this->fk_user = $obj->fk_user;
$this->fk_user = $obj->fk_user;
$this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev);
$this->amount = $obj->amount;
$this->fk_project = $obj->fk_project;
$this->type_payment = $obj->fk_typepayment;
$this->amount = $obj->amount;
$this->fk_project = $obj->fk_project;
$this->type_payment = $obj->fk_typepayment;
$this->label = $obj->label;
$this->datesp = $this->db->jdate($obj->datesp);
$this->dateep = $this->db->jdate($obj->dateep);
$this->note = $obj->note;
$this->paye = $obj->paye;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_account = $this->accountid = $obj->fk_account;
$this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_account = $this->accountid = $obj->fk_account;
// Retreive all extrafield
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
}

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -90,22 +90,10 @@ $search_date_end_to = dol_mktime(23, 59, 59, GETPOST('search_date_end_tomonth',
$search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_status = GETPOST('search_status', 'int');
$search_type_id = GETPOST('search_type_id', 'int');
$filtre = GETPOST("filtre", 'restricthtml');
if (!GETPOST('search_type_id', 'int')) {
$newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre);
foreach ($filterarray as $val) {
$part = explode(':', $val);
if ($part[0] == 's.fk_typepayment') {
$search_type_id = $part[1];
}
}
} else {
$search_type_id = GETPOST('search_type_id', 'int');
}
$childids = $user->getAllChildIds(1);
// Initialize array of search criterias
@ -519,6 +507,9 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
$i = 0;
$total = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray['val']['totalttcfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -391,7 +391,9 @@ if (!empty($socid)) {
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
$moreforfilter = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields